diff options
author | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-13 07:29:32 +0000 |
---|---|---|
committer | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-13 07:29:32 +0000 |
commit | 8093a5439afecec131b78422abdeb7038de6f7a3 (patch) | |
tree | a2f7dc196c51970186615d10d0a884e18c2b7ae9 /content | |
parent | 697a650a1084ef9c77f9c5675f891d6157f36e99 (diff) | |
download | chromium_src-8093a5439afecec131b78422abdeb7038de6f7a3.zip chromium_src-8093a5439afecec131b78422abdeb7038de6f7a3.tar.gz chromium_src-8093a5439afecec131b78422abdeb7038de6f7a3.tar.bz2 |
Get rid of the remaining content settings code in the content module.
Add user data to content::ResourceContext that points to chrome's ProfileIOData. That way when the embedder code is called by content, it can get back to its profile specific data structures like HostContentSettingsMap.
BUG=76793
Review URL: http://codereview.chromium.org/7014025
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@85247 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content')
23 files changed, 44 insertions, 324 deletions
diff --git a/content/browser/DEPS b/content/browser/DEPS index 8515ee5..ca5f7c5 100644 --- a/content/browser/DEPS +++ b/content/browser/DEPS @@ -15,10 +15,8 @@ include_rules = [ "+chrome/browser/browser_url_handler.h",
# http://crbug.com/76793
- "+chrome/browser/content_settings/content_settings_details.h",
"+chrome/browser/content_settings/host_content_settings_map.h",
"+chrome/browser/content_settings/tab_specific_content_settings.h",
- "+chrome/common/content_settings.h",
"+chrome/common/content_settings_types.h",
"+chrome/browser/chromeos/cros/cros_library.h",
diff --git a/content/browser/in_process_webkit/indexed_db_dispatcher_host.cc b/content/browser/in_process_webkit/indexed_db_dispatcher_host.cc index 8265d09..bc40db4 100644 --- a/content/browser/in_process_webkit/indexed_db_dispatcher_host.cc +++ b/content/browser/in_process_webkit/indexed_db_dispatcher_host.cc @@ -6,7 +6,6 @@ #include "base/command_line.h" #include "base/utf_string_conversions.h" -#include "chrome/browser/content_settings/host_content_settings_map.h" #include "content/browser/browser_thread.h" #include "content/browser/in_process_webkit/indexed_db_callbacks.h" #include "content/browser/in_process_webkit/indexed_db_database_callbacks.h" @@ -60,10 +59,8 @@ void DeleteOnWebKitThread(T* obj) { } IndexedDBDispatcherHost::IndexedDBDispatcherHost( - int process_id, WebKitContext* webkit_context, - HostContentSettingsMap* host_content_settings_map) + int process_id, WebKitContext* webkit_context) : webkit_context_(webkit_context), - host_content_settings_map_(host_content_settings_map), ALLOW_THIS_IN_INITIALIZER_LIST(database_dispatcher_host_( new DatabaseDispatcherHost(this))), ALLOW_THIS_IN_INITIALIZER_LIST(index_dispatcher_host_( diff --git a/content/browser/in_process_webkit/indexed_db_dispatcher_host.h b/content/browser/in_process_webkit/indexed_db_dispatcher_host.h index 2376834..fbe8bfc 100644 --- a/content/browser/in_process_webkit/indexed_db_dispatcher_host.h +++ b/content/browser/in_process_webkit/indexed_db_dispatcher_host.h @@ -12,7 +12,6 @@ #include "content/browser/in_process_webkit/webkit_context.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebExceptionCode.h" -class HostContentSettingsMap; class IndexedDBKey; class NullableString16; class Profile; @@ -37,9 +36,7 @@ class WebIDBTransaction; class IndexedDBDispatcherHost : public BrowserMessageFilter { public: // Only call the constructor from the UI thread. - IndexedDBDispatcherHost( - int process_id, WebKitContext* webkit_context, - HostContentSettingsMap* host_content_settings_map); + IndexedDBDispatcherHost(int process_id, WebKitContext* webkit_context); // BrowserMessageFilter implementation. virtual void OnChannelClosing(); @@ -258,9 +255,6 @@ class IndexedDBDispatcherHost : public BrowserMessageFilter { // Data shared between renderer processes with the same profile. scoped_refptr<WebKitContext> webkit_context_; - // Tells us whether the user wants to allow databases to be opened. - scoped_refptr<HostContentSettingsMap> host_content_settings_map_; - // Only access on WebKit thread. scoped_ptr<DatabaseDispatcherHost> database_dispatcher_host_; scoped_ptr<IndexDispatcherHost> index_dispatcher_host_; diff --git a/content/browser/renderer_host/async_resource_handler.cc b/content/browser/renderer_host/async_resource_handler.cc index 735266c..7c0e621 100644 --- a/content/browser/renderer_host/async_resource_handler.cc +++ b/content/browser/renderer_host/async_resource_handler.cc @@ -11,7 +11,6 @@ #include "base/logging.h" #include "base/shared_memory.h" #include "chrome/browser/debugger/devtools_netlog_observer.h" -#include "chrome/browser/content_settings/host_content_settings_map.h" #include "chrome/browser/net/load_timing_observer.h" #include "chrome/common/render_messages.h" #include "content/browser/host_zoom_map.h" @@ -82,12 +81,10 @@ AsyncResourceHandler::AsyncResourceHandler( int routing_id, const GURL& url, HostZoomMap* host_zoom_map, - HostContentSettingsMap* host_content_settings_map, ResourceDispatcherHost* resource_dispatcher_host) : filter_(filter), routing_id_(routing_id), host_zoom_map_(host_zoom_map), - host_content_settings_map_(host_content_settings_map), rdh_(resource_dispatcher_host), next_buffer_size_(kInitialReadBufSize) { } @@ -132,9 +129,6 @@ bool AsyncResourceHandler::OnResponseStarted(int request_id, if (info->resource_type() == ResourceType::MAIN_FRAME && request->context()) { GURL request_url(request->url()); - filter_->Send(new ViewMsg_SetContentSettingsForLoadingURL( - info->route_id(), request_url, - host_content_settings_map_->GetContentSettings(request_url))); filter_->Send(new ViewMsg_SetZoomLevelForLoadingURL( info->route_id(), request_url, host_zoom_map_->GetZoomLevel(request_url))); diff --git a/content/browser/renderer_host/async_resource_handler.h b/content/browser/renderer_host/async_resource_handler.h index 8c60256..ea33a19 100644 --- a/content/browser/renderer_host/async_resource_handler.h +++ b/content/browser/renderer_host/async_resource_handler.h @@ -10,7 +10,6 @@ #include "content/browser/renderer_host/resource_handler.h" -class HostContentSettingsMap; class HostZoomMap; class ResourceDispatcherHost; class ResourceMessageFilter; @@ -24,7 +23,6 @@ class AsyncResourceHandler : public ResourceHandler { int routing_id, const GURL& url, HostZoomMap* host_zoom_map, - HostContentSettingsMap* host_content_settings_map, ResourceDispatcherHost* resource_dispatcher_host); // ResourceHandler implementation: @@ -51,7 +49,6 @@ class AsyncResourceHandler : public ResourceHandler { ResourceMessageFilter* filter_; int routing_id_; HostZoomMap* host_zoom_map_; - HostContentSettingsMap* host_content_settings_map_; ResourceDispatcherHost* rdh_; // |next_buffer_size_| is the size of the buffer to be allocated on the next diff --git a/content/browser/renderer_host/browser_render_process_host.cc b/content/browser/renderer_host/browser_render_process_host.cc index 9245a06..ef8d040 100644 --- a/content/browser/renderer_host/browser_render_process_host.cc +++ b/content/browser/renderer_host/browser_render_process_host.cc @@ -356,8 +356,7 @@ void BrowserRenderProcessHost::CreateMessageFilters() { channel_->AddFilter( new DOMStorageMessageFilter(id(), profile()->GetWebKitContext())); channel_->AddFilter( - new IndexedDBDispatcherHost(id(), profile()->GetWebKitContext(), - profile()->GetHostContentSettingsMap())); + new IndexedDBDispatcherHost(id(), profile()->GetWebKitContext())); channel_->AddFilter( GeolocationDispatcherHost::New( id(), profile()->GetGeolocationPermissionContext())); diff --git a/content/browser/renderer_host/database_message_filter.h b/content/browser/renderer_host/database_message_filter.h index 9d14d32..1cfc659 100644 --- a/content/browser/renderer_host/database_message_filter.h +++ b/content/browser/renderer_host/database_message_filter.h @@ -8,7 +8,6 @@ #include "base/hash_tables.h" #include "base/string16.h" -#include "chrome/common/content_settings.h" #include "content/browser/browser_message_filter.h" #include "webkit/database/database_connections.h" #include "webkit/database/database_tracker.h" diff --git a/content/browser/renderer_host/render_message_filter.cc b/content/browser/renderer_host/render_message_filter.cc index 2deb61b..6529ea3 100644 --- a/content/browser/renderer_host/render_message_filter.cc +++ b/content/browser/renderer_host/render_message_filter.cc @@ -13,7 +13,6 @@ #include "base/threading/worker_pool.h" #include "base/utf_string_conversions.h" #include "chrome/browser/browser_process.h" -#include "chrome/browser/content_settings/host_content_settings_map.h" #include "chrome/browser/download/download_types.h" #include "chrome/browser/download/download_util.h" #include "chrome/browser/extensions/extension_info_map.h" @@ -277,7 +276,6 @@ RenderMessageFilter::RenderMessageFilter( plugin_service_(plugin_service), profile_(profile), extension_info_map_(profile->GetExtensionInfoMap()), - content_settings_(profile->GetHostContentSettingsMap()), request_context_(request_context), resource_context_(profile->GetResourceContext()), extensions_request_context_(profile->GetRequestContextForExtensions()), @@ -585,21 +583,13 @@ void RenderMessageFilter::OnGetPluginInfo( const std::string& mime_type, bool* found, webkit::npapi::WebPluginInfo* info, - int* setting, std::string* actual_mime_type) { *found = plugin_service_->GetFirstAllowedPluginInfo( render_process_id_, routing_id, url, mime_type, info, actual_mime_type); - *setting = CONTENT_SETTING_DEFAULT; if (*found) { if (!plugin_service_->PluginAllowedForURL(info->path, policy_url)) info->enabled |= webkit::npapi::WebPluginInfo::POLICY_DISABLED; - std::string resource = - webkit::npapi::PluginList::Singleton()->GetPluginGroupIdentifier(*info); - *setting = content_settings_->GetContentSetting( - policy_url, - CONTENT_SETTINGS_TYPE_PLUGINS, - resource); } } diff --git a/content/browser/renderer_host/render_message_filter.h b/content/browser/renderer_host/render_message_filter.h index efd471c..d1702c0 100644 --- a/content/browser/renderer_host/render_message_filter.h +++ b/content/browser/renderer_host/render_message_filter.h @@ -19,7 +19,6 @@ #include "base/string16.h" #include "base/task.h" #include "build/build_config.h" -#include "chrome/common/content_settings.h" #include "content/browser/browser_message_filter.h" #include "content/browser/in_process_webkit/webkit_context.h" #include "content/browser/renderer_host/resource_dispatcher_host.h" @@ -157,7 +156,6 @@ class RenderMessageFilter : public BrowserMessageFilter { const std::string& mime_type, bool* found, webkit::npapi::WebPluginInfo* info, - int* setting, std::string* actual_mime_type); void OnOpenChannelToPlugin(int routing_id, const GURL& url, @@ -241,10 +239,6 @@ class RenderMessageFilter : public BrowserMessageFilter { // access it on other threads. ExtensionInfoMap* extension_info_map_; - // The host content settings map. Stored separately from the profile so we can - // access it on other threads. - HostContentSettingsMap* content_settings_; - // Contextual information to be used for requests created here. scoped_refptr<net::URLRequestContextGetter> request_context_; diff --git a/content/browser/renderer_host/render_view_host.cc b/content/browser/renderer_host/render_view_host.cc index 1b5f88f..bd54a62 100644 --- a/content/browser/renderer_host/render_view_host.cc +++ b/content/browser/renderer_host/render_view_host.cc @@ -771,8 +771,6 @@ bool RenderViewHost::OnMessageReceived(const IPC::Message& msg) { IPC_MESSAGE_HANDLER(ViewHostMsg_AccessibilityNotifications, OnAccessibilityNotifications) IPC_MESSAGE_HANDLER(ViewHostMsg_OnCSSInserted, OnCSSInserted) - IPC_MESSAGE_HANDLER(ViewHostMsg_ContentBlocked, OnContentBlocked) - IPC_MESSAGE_HANDLER(ViewHostMsg_AppCacheAccessed, OnAppCacheAccessed) IPC_MESSAGE_HANDLER(ViewHostMsg_FocusedNodeChanged, OnMsgFocusedNodeChanged) IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateZoomLimits, OnUpdateZoomLimits) IPC_MESSAGE_HANDLER(ViewHostMsg_ScriptEvalResponse, OnScriptEvalResponse) @@ -1332,11 +1330,6 @@ void RenderViewHost::PerformCustomContextMenuAction( action)); } -void RenderViewHost::SendContentSettings(const GURL& url, - const ContentSettings& settings) { - Send(new ViewMsg_SetContentSettingsForCurrentURL(url, settings)); -} - void RenderViewHost::EnablePreferredSizeChangedMode(int flags) { Send(new ViewMsg_EnablePreferredSizeChangedMode(routing_id(), flags)); } @@ -1406,23 +1399,6 @@ void RenderViewHost::OnCSSInserted() { delegate_->DidInsertCSS(); } -void RenderViewHost::OnContentBlocked(ContentSettingsType type, - const std::string& resource_identifier) { - RenderViewHostDelegate::ContentSettings* content_settings_delegate = - delegate_->GetContentSettingsDelegate(); - if (content_settings_delegate) - content_settings_delegate->OnContentBlocked(type, resource_identifier); -} - -void RenderViewHost::OnAppCacheAccessed(const GURL& manifest_url, - bool blocked_by_policy) { - RenderViewHostDelegate::ContentSettings* content_settings_delegate = - delegate_->GetContentSettingsDelegate(); - if (content_settings_delegate) - content_settings_delegate->OnAppCacheAccessed(manifest_url, - blocked_by_policy); -} - void RenderViewHost::OnUpdateZoomLimits(int minimum_percent, int maximum_percent, bool remember) { diff --git a/content/browser/renderer_host/render_view_host.h b/content/browser/renderer_host/render_view_host.h index abc2bf0..958df19 100644 --- a/content/browser/renderer_host/render_view_host.h +++ b/content/browser/renderer_host/render_view_host.h @@ -13,7 +13,6 @@ #include "base/observer_list.h" #include "base/process_util.h" #include "chrome/browser/ui/find_bar/find_bar_controller.h" -#include "chrome/common/content_settings_types.h" #include "chrome/common/view_types.h" #include "content/browser/renderer_host/render_widget_host.h" #include "content/common/page_zoom.h" @@ -36,7 +35,6 @@ class SessionStorageNamespace; class SiteInstance; class SkBitmap; class ViewMsg_Navigate; -struct ContentSettings; struct ContextMenuParams; struct MediaPlayerAction; struct ViewHostMsg_AccessibilityNotification_Params; @@ -421,10 +419,6 @@ class RenderViewHost : public RenderWidgetHost { const webkit_glue::CustomContextMenuContext& custom_context, unsigned action); - // Informs renderer of updated content settings. - void SendContentSettings(const GURL& url, - const ContentSettings& settings); - // Tells the renderer to notify us when the page contents preferred size // changed. |flags| is a combination of // |ViewHostMsg_EnablePreferredSizeChangedMode_Flags| values, which is defined @@ -536,9 +530,6 @@ class RenderViewHost : public RenderWidgetHost { void OnAccessibilityNotifications( const std::vector<ViewHostMsg_AccessibilityNotification_Params>& params); void OnCSSInserted(); - void OnContentBlocked(ContentSettingsType type, - const std::string& resource_identifier); - void OnAppCacheAccessed(const GURL& manifest_url, bool blocked_by_policy); void OnUpdateZoomLimits(int minimum_percent, int maximum_percent, bool remember); diff --git a/content/browser/renderer_host/render_view_host_delegate.cc b/content/browser/renderer_host/render_view_host_delegate.cc index e6e7df3..c2fcd8a 100644 --- a/content/browser/renderer_host/render_view_host_delegate.cc +++ b/content/browser/renderer_host/render_view_host_delegate.cc @@ -20,11 +20,6 @@ RenderViewHostDelegate::GetRendererManagementDelegate() { return NULL; } -RenderViewHostDelegate::ContentSettings* -RenderViewHostDelegate::GetContentSettingsDelegate() { - return NULL; -} - RenderViewHostDelegate::BookmarkDrag* RenderViewHostDelegate::GetBookmarkDragDelegate() { return NULL; diff --git a/content/browser/renderer_host/render_view_host_delegate.h b/content/browser/renderer_host/render_view_host_delegate.h index cb48801..2cc0b0c 100644 --- a/content/browser/renderer_host/render_view_host_delegate.h +++ b/content/browser/renderer_host/render_view_host_delegate.h @@ -13,9 +13,7 @@ #include "base/memory/ref_counted.h" #include "base/process_util.h" #include "base/string16.h" -#include "chrome/common/content_settings_types.h" #include "chrome/common/view_types.h" -#include "content/common/dom_storage_common.h" #include "content/common/window_container_type.h" #include "ipc/ipc_channel.h" #include "net/base/load_states.h" @@ -239,66 +237,6 @@ class RenderViewHostDelegate : public IPC::Channel::Listener { virtual ~RendererManagement() {} }; - // ContentSettings------------------------------------------------------------ - // Interface for content settings related events. - - class ContentSettings { - public: - // Called when content in the current page was blocked due to the user's - // content settings. - virtual void OnContentBlocked(ContentSettingsType type, - const std::string& resource_identifier) = 0; - - // Called when cookies for the given URL were read either from within the - // current page or while loading it. |blocked_by_policy| should be true, if - // reading cookies was blocked due to the user's content settings. In that - // case, this function should invoke OnContentBlocked. - virtual void OnCookiesRead( - const GURL& url, - const net::CookieList& cookie_list, - bool blocked_by_policy) = 0; - - // Called when a specific cookie in the current page was changed. - // |blocked_by_policy| should be true, if the cookie was blocked due to the - // user's content settings. In that case, this function should invoke - // OnContentBlocked. - virtual void OnCookieChanged(const GURL& url, - const std::string& cookie_line, - const net::CookieOptions& options, - bool blocked_by_policy) = 0; - - // Called when a specific indexed db factory in the current page was - // accessed. If access was blocked due to the user's content settings, - // |blocked_by_policy| should be true, and this function should invoke - // OnContentBlocked. - virtual void OnIndexedDBAccessed(const GURL& url, - const string16& description, - bool blocked_by_policy) = 0; - - // Called when a specific local storage area in the current page was - // accessed. If access was blocked due to the user's content settings, - // |blocked_by_policy| should be true, and this function should invoke - // OnContentBlocked. - virtual void OnLocalStorageAccessed(const GURL& url, - DOMStorageType storage_type, - bool blocked_by_policy) = 0; - - // Called when a specific appcache in the current page was accessed. If - // access was blocked due to the user's content settings, - // |blocked_by_policy| should eb true, and this function should invoke - // OnContentBlocked. - virtual void OnAppCacheAccessed(const GURL& manifest_url, - bool blocked_by_policy) = 0; - - // Called when geolocation permission was set in a frame on the current - // page. - virtual void OnGeolocationPermissionSet(const GURL& requesting_frame, - bool allowed) = 0; - - protected: - virtual ~ContentSettings() {} - }; - // BookmarkDrag -------------------------------------------------------------- // Interface for forwarding bookmark drag and drop to extenstions. @@ -360,7 +298,6 @@ class RenderViewHostDelegate : public IPC::Channel::Listener { // there is no corresponding delegate. virtual View* GetViewDelegate(); virtual RendererManagement* GetRendererManagementDelegate(); - virtual ContentSettings* GetContentSettingsDelegate(); virtual BookmarkDrag* GetBookmarkDragDelegate(); virtual SSL* GetSSLDelegate(); diff --git a/content/browser/renderer_host/render_view_host_notification_task.h b/content/browser/renderer_host/render_view_host_notification_task.h index c1904ba..c5e79da 100644 --- a/content/browser/renderer_host/render_view_host_notification_task.h +++ b/content/browser/renderer_host/render_view_host_notification_task.h @@ -70,33 +70,6 @@ inline void CallRenderViewHostHelper(int render_process_id, int render_view_id, params)); } -// For proxying calls to RenderViewHostDelegate::ContentSettings - -class RenderViewHostToContentSettingsDelegate { - public: - typedef RenderViewHostDelegate::ContentSettings MappedType; - static MappedType* Map(RenderViewHost* rvh) { - return rvh ? rvh->delegate()->GetContentSettingsDelegate() : NULL; - } -}; - -template <typename Method, typename Params> -inline void CallRenderViewHostContentSettingsDelegateHelper( - int render_process_id, - int render_view_id, - Method method, - const Params& params) { - - BrowserThread::PostTask( - BrowserThread::UI, FROM_HERE, - new RenderViewHostNotificationTask< - Method, Params, RenderViewHostToContentSettingsDelegate>( - render_process_id, - render_view_id, - method, - params)); -} - // For proxying calls to RenderViewHostDelegate::RendererManagement class RenderViewHostToRendererManagementDelegate { @@ -188,84 +161,6 @@ inline void CallRenderViewHost(int render_process_id, } // ---------------------------------------------------------------------------- -// Proxy calls to the specified RenderViewHost's ContentSettings delegate. - -template <typename Method> -inline void CallRenderViewHostContentSettingsDelegate(int render_process_id, - int render_view_id, - Method method) { - internal::CallRenderViewHostContentSettingsDelegateHelper(render_process_id, - render_view_id, - method, - MakeTuple()); -} - -template <typename Method, typename A> -inline void CallRenderViewHostContentSettingsDelegate(int render_process_id, - int render_view_id, - Method method, - const A& a) { - internal::CallRenderViewHostContentSettingsDelegateHelper(render_process_id, - render_view_id, - method, - MakeTuple(a)); - } - -template <typename Method, typename A, typename B> -inline void CallRenderViewHostContentSettingsDelegate(int render_process_id, - int render_view_id, - Method method, - const A& a, - const B& b) { - internal::CallRenderViewHostContentSettingsDelegateHelper(render_process_id, - render_view_id, - method, - MakeTuple(a, b)); -} - -template <typename Method, typename A, typename B, typename C> -inline void CallRenderViewHostContentSettingsDelegate(int render_process_id, - int render_view_id, - Method method, - const A& a, - const B& b, - const C& c) { - internal::CallRenderViewHostContentSettingsDelegateHelper(render_process_id, - render_view_id, - method, - MakeTuple(a, b, c)); -} - -template <typename Method, typename A, typename B, typename C, typename D> -inline void CallRenderViewHostContentSettingsDelegate(int render_process_id, - int render_view_id, - Method method, - const A& a, - const B& b, - const C& c, - const D& d) { - internal::CallRenderViewHostContentSettingsDelegateHelper( - render_process_id, - render_view_id, - method, - MakeTuple(a, b, c, d)); -} - -template <typename Method, - typename A, typename B, typename C, typename D, typename E> -inline void CallRenderViewHostContentSettingsDelegate(int render_process_id, - int render_view_id, - Method method, - const A& a, - const B& b, - const C& c, - const D& d, - const E& e) { - internal::CallRenderViewHostContentSettingsDelegateHelper( - render_process_id, render_view_id, method, MakeTuple(a, b, c, d, e)); -} - -// ---------------------------------------------------------------------------- // Proxy calls to the specified RenderViewHost's RendererManagement delegate. template <typename Method> diff --git a/content/browser/renderer_host/resource_dispatcher_host.cc b/content/browser/renderer_host/resource_dispatcher_host.cc index a9525dd..fac9a705 100644 --- a/content/browser/renderer_host/resource_dispatcher_host.cc +++ b/content/browser/renderer_host/resource_dispatcher_host.cc @@ -454,9 +454,7 @@ void ResourceDispatcherHost::BeginRequest( filter_, request_data.url, sync_result, this); } else { handler = new AsyncResourceHandler( - filter_, route_id, request_data.url, - resource_context.host_zoom_map(), - resource_context.host_content_settings_map(), + filter_, route_id, request_data.url, resource_context.host_zoom_map(), this); } diff --git a/content/browser/resource_context.cc b/content/browser/resource_context.cc index d167c77..6af4651 100644 --- a/content/browser/resource_context.cc +++ b/content/browser/resource_context.cc @@ -22,6 +22,17 @@ ResourceContext::ResourceContext() ResourceContext::~ResourceContext() {} +void* ResourceContext::GetUserData(const void* key) const { + UserDataMap::const_iterator found = user_data_.find(key); + if (found != user_data_.end()) + return found->second; + return NULL; +} + +void ResourceContext::SetUserData(const void* key, void* data) { + user_data_[key] = data; +} + net::HostResolver* ResourceContext::host_resolver() const { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); EnsureInitialized(); @@ -117,18 +128,6 @@ void ResourceContext::set_host_zoom_map(HostZoomMap* host_zoom_map) { host_zoom_map_ = host_zoom_map; } -HostContentSettingsMap* ResourceContext::host_content_settings_map() const { - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); - EnsureInitialized(); - return host_content_settings_map_; -} - -void ResourceContext::set_host_content_settings_map( - HostContentSettingsMap* host_content_settings_map) { - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); - host_content_settings_map_ = host_content_settings_map; -} - const ExtensionInfoMap* ResourceContext::extension_info_map() const { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); EnsureInitialized(); diff --git a/content/browser/resource_context.h b/content/browser/resource_context.h index 85376d0..3e71ef4 100644 --- a/content/browser/resource_context.h +++ b/content/browser/resource_context.h @@ -5,6 +5,8 @@ #ifndef CONTENT_BROWSER_RESOURCE_CONTEXT_H_ #define CONTENT_BROWSER_RESOURCE_CONTEXT_H_ +#include <map> + #include "base/basictypes.h" #include "base/memory/ref_counted.h" #include "base/memory/weak_ptr.h" @@ -12,7 +14,6 @@ class ChromeAppCacheService; class ChromeBlobStorageContext; class ExtensionInfoMap; -class HostContentSettingsMap; class HostZoomMap; namespace fileapi { class FileSystemContext; @@ -41,6 +42,11 @@ class ResourceContext { public: virtual ~ResourceContext(); + // The user data allows the clients to associate data with this request. + // Multiple user data values can be stored under different keys. + void* GetUserData(const void* key) const; + void SetUserData(const void* key, void* data); + net::HostResolver* host_resolver() const; void set_host_resolver(net::HostResolver* host_resolver); @@ -68,11 +74,6 @@ class ResourceContext { // ======================================================================= // TODO(willchan): These don't belong in content/. Remove them eventually. - // TODO(jam): Kill this one. - HostContentSettingsMap* host_content_settings_map() const; - void set_host_content_settings_map( - HostContentSettingsMap* host_content_settings_map); - // TODO(mpcomplete): Kill this one. const ExtensionInfoMap* extension_info_map() const; void set_extension_info_map(ExtensionInfoMap* extension_info_map); @@ -97,10 +98,14 @@ class ResourceContext { quota::QuotaManager* quota_manager_; HostZoomMap* host_zoom_map_; + // Externally-defined data accessible by key. + typedef std::map<const void*, void*> UserDataMap; + UserDataMap user_data_; + + // ======================================================================= // TODO(willchan): These don't belong in content/. Remove them eventually. - HostContentSettingsMap* host_content_settings_map_; ExtensionInfoMap* extension_info_map_; base::WeakPtr<prerender::PrerenderManager> prerender_manager_; diff --git a/content/browser/tab_contents/tab_contents.cc b/content/browser/tab_contents/tab_contents.cc index 4d33f4e..fc201e4 100644 --- a/content/browser/tab_contents/tab_contents.cc +++ b/content/browser/tab_contents/tab_contents.cc @@ -15,8 +15,6 @@ #include "base/utf_string_conversions.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/browser_shutdown.h" -#include "chrome/browser/content_settings/content_settings_details.h" -#include "chrome/browser/content_settings/host_content_settings_map.h" #include "chrome/browser/content_settings/tab_specific_content_settings.h" #include "chrome/browser/debugger/devtools_manager.h" #include "chrome/browser/defaults.h" @@ -270,10 +268,6 @@ TabContents::TabContents(Profile* profile, registrar_.Add(this, NotificationType::USER_STYLE_SHEET_UPDATED, NotificationService::AllSources()); - // Register for notifications about content setting changes. - registrar_.Add(this, NotificationType::CONTENT_SETTINGS_CHANGED, - NotificationService::AllSources()); - // Listen for Google URL changes. registrar_.Add(this, NotificationType::GOOGLE_URL_UPDATED, NotificationService::AllSources()); @@ -1029,10 +1023,13 @@ void TabContents::OnDidStartProvisionalLoadForFrame(int64 frame_id, render_view_host()->FilterURL(ChildProcessSecurityPolicy::GetInstance(), GetRenderProcessHost()->id(), &validated_url); + RenderViewHost* rvh = + render_manager_.pending_render_view_host() ? + render_manager_.pending_render_view_host() : render_view_host(); // Notify observers about the start of the provisional load. FOR_EACH_OBSERVER(TabContentsObserver, observers_, DidStartProvisionalLoadForFrame(frame_id, is_main_frame, - validated_url, is_error_page)); + validated_url, is_error_page, rvh)); if (is_main_frame) { // Notify observers about the provisional change in the main frame URL. @@ -1503,11 +1500,6 @@ TabContents::GetRendererManagementDelegate() { return &render_manager_; } -RenderViewHostDelegate::ContentSettings* -TabContents::GetContentSettingsDelegate() { - return content_settings_delegate_.get(); -} - RenderViewHostDelegate::SSL* TabContents::GetSSLDelegate() { return GetSSLHelper(); } @@ -2189,21 +2181,6 @@ void TabContents::Observe(NotificationType type, UpdateWebPreferences(); break; - case NotificationType::CONTENT_SETTINGS_CHANGED: { - Details<const ContentSettingsDetails> settings_details(details); - NavigationEntry* entry = controller_.GetActiveEntry(); - GURL entry_url; - if (entry) - entry_url = entry->url(); - if (settings_details.ptr()->update_all() || - settings_details.ptr()->pattern().Matches(entry_url)) { - render_view_host()->SendContentSettings(entry_url, - profile()->GetHostContentSettingsMap()-> - GetContentSettings(entry_url)); - } - break; - } - case NotificationType::GOOGLE_URL_UPDATED: UpdateAlternateErrorPageURL(); break; diff --git a/content/browser/tab_contents/tab_contents.h b/content/browser/tab_contents/tab_contents.h index 6f124435..87e0fde 100644 --- a/content/browser/tab_contents/tab_contents.h +++ b/content/browser/tab_contents/tab_contents.h @@ -554,8 +554,6 @@ class TabContents : public PageNavigator, // the pending WebUI, the committed WebUI, or NULL. WebUI* GetWebUIForCurrentState(); - // From RenderViewHostDelegate. - virtual RenderViewHostDelegate::ContentSettings* GetContentSettingsDelegate(); protected: friend class TabContentsObserver; diff --git a/content/browser/tab_contents/tab_contents_observer.cc b/content/browser/tab_contents/tab_contents_observer.cc index 5649de6..3056608 100644 --- a/content/browser/tab_contents/tab_contents_observer.cc +++ b/content/browser/tab_contents/tab_contents_observer.cc @@ -44,7 +44,8 @@ void TabContentsObserver::DidStartProvisionalLoadForFrame( int64 frame_id, bool is_main_frame, const GURL& validated_url, - bool is_error_page) { + bool is_error_page, + RenderViewHost* render_view_host) { } void TabContentsObserver::ProvisionalChangeToMainFrameUrl(const GURL& url) { diff --git a/content/browser/tab_contents/tab_contents_observer.h b/content/browser/tab_contents/tab_contents_observer.h index bc1aba2..cc73b4f 100644 --- a/content/browser/tab_contents/tab_contents_observer.h +++ b/content/browser/tab_contents/tab_contents_observer.h @@ -10,6 +10,7 @@ #include "ipc/ipc_channel.h" #include "webkit/glue/window_open_disposition.h" +class RenderViewHost; struct ViewHostMsg_FrameNavigate_Params; // An observer API implemented by classes which are interested in various page @@ -47,10 +48,14 @@ class TabContentsObserver : public IPC::Channel::Listener, virtual void DidNavigateAnyFramePostCommit( const NavigationController::LoadCommittedDetails& details, const ViewHostMsg_FrameNavigate_Params& params); - virtual void DidStartProvisionalLoadForFrame(int64 frame_id, - bool is_main_frame, - const GURL& validated_url, - bool is_error_page); + // |render_view_host| is the RenderViewHost for which the provisional load is + // happening. + virtual void DidStartProvisionalLoadForFrame( + int64 frame_id, + bool is_main_frame, + const GURL& validated_url, + bool is_error_page, + RenderViewHost* render_view_host); virtual void ProvisionalChangeToMainFrameUrl(const GURL& url); virtual void DidCommitProvisionalLoadForFrame( int64 frame_id, diff --git a/content/common/view_messages.h b/content/common/view_messages.h index 16e07a2..dfbc1be 100644 --- a/content/common/view_messages.h +++ b/content/common/view_messages.h @@ -1489,34 +1489,16 @@ IPC_SYNC_MESSAGE_CONTROL1_1(ViewHostMsg_GetPlugins, // type. If there is no matching plugin, |found| is false. If // |enabled| in the WebPluginInfo struct is false, the plug-in is // treated as if it was not installed at all. -// -// TODO(jam): until we get ContentSetting out of content completely, sending it -// as int temporarily so we can move these messages to content. -// -// If |setting| is set to CONTENT_SETTING_BLOCK, the plug-in is -// blocked by the content settings for |policy_url|. It still -// appears in navigator.plugins in Javascript though, and can be -// loaded via click-to-play. -// -// If |setting| is set to CONTENT_SETTING_ALLOW, the domain is -// explicitly white-listed for the plug-in, or the user has chosen -// not to block nonsandboxed plugins. -// -// If |setting| is set to CONTENT_SETTING_DEFAULT, the plug-in is -// neither blocked nor white-listed, which means that it's allowed -// by default and can still be blocked if it's non-sandboxed. -// // |actual_mime_type| is the actual mime type supported by the // plugin found that match the URL given (one for each item in // |info|). -IPC_SYNC_MESSAGE_CONTROL4_4(ViewHostMsg_GetPluginInfo, +IPC_SYNC_MESSAGE_CONTROL4_3(ViewHostMsg_GetPluginInfo, int /* routing_id */, GURL /* url */, GURL /* policy_url */, std::string /* mime_type */, bool /* found */, webkit::npapi::WebPluginInfo /* plugin info */, - int /* setting */, std::string /* actual_mime_type */) // A renderer sends this to the browser process when it wants to diff --git a/content/renderer/render_view.cc b/content/renderer/render_view.cc index 2469fcf..25c3763 100644 --- a/content/renderer/render_view.cc +++ b/content/renderer/render_view.cc @@ -530,11 +530,10 @@ WebPlugin* RenderView::CreatePluginNoCheck(WebFrame* frame, const WebPluginParams& params) { webkit::npapi::WebPluginInfo info; bool found; - int content_setting; std::string mime_type; Send(new ViewHostMsg_GetPluginInfo( routing_id_, params.url, frame->top()->url(), params.mimeType.utf8(), - &found, &info, &content_setting, &mime_type)); + &found, &info, &mime_type)); if (!found || !webkit::npapi::IsPluginEnabled(info)) return NULL; |