diff options
author | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-25 19:45:26 +0000 |
---|---|---|
committer | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-25 19:45:26 +0000 |
commit | 11f764bbe5614c7973203308235d907fd275f1f6 (patch) | |
tree | 2ac36f660c9cc44edf03e9917c5f26d855a751b3 /content | |
parent | 882e27ed5c8f54c2ac783594a07a78dbb9dc6c30 (diff) | |
download | chromium_src-11f764bbe5614c7973203308235d907fd275f1f6.zip chromium_src-11f764bbe5614c7973203308235d907fd275f1f6.tar.gz chromium_src-11f764bbe5614c7973203308235d907fd275f1f6.tar.bz2 |
Remove dependency on PrefChangeRegistrar and renderer_preferences_util from content.
BUG=76697
Review URL: http://codereview.chromium.org/7066039
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@86679 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content')
-rw-r--r-- | content/browser/DEPS | 4 | ||||
-rw-r--r-- | content/browser/content_browser_client.cc | 4 | ||||
-rw-r--r-- | content/browser/content_browser_client.h | 3 | ||||
-rw-r--r-- | content/browser/renderer_host/render_message_filter.cc | 10 | ||||
-rw-r--r-- | content/browser/renderer_host/render_message_filter.h | 1 | ||||
-rw-r--r-- | content/browser/renderer_host/render_view_host.cc | 12 | ||||
-rw-r--r-- | content/browser/renderer_host/render_view_host_delegate.cc | 4 | ||||
-rw-r--r-- | content/browser/renderer_host/render_view_host_delegate.h | 5 | ||||
-rw-r--r-- | content/browser/renderer_host/render_view_host_observer.cc | 3 | ||||
-rw-r--r-- | content/browser/renderer_host/render_view_host_observer.h | 4 | ||||
-rw-r--r-- | content/browser/tab_contents/interstitial_page.cc | 5 | ||||
-rw-r--r-- | content/browser/tab_contents/interstitial_page.h | 3 | ||||
-rw-r--r-- | content/browser/tab_contents/tab_contents.cc | 109 | ||||
-rw-r--r-- | content/browser/tab_contents/tab_contents.h | 15 | ||||
-rw-r--r-- | content/browser/tab_contents/tab_contents_observer.cc | 3 | ||||
-rw-r--r-- | content/browser/tab_contents/tab_contents_observer.h | 2 |
16 files changed, 20 insertions, 167 deletions
diff --git a/content/browser/DEPS b/content/browser/DEPS index 1ed42d6..9991d2d 100644 --- a/content/browser/DEPS +++ b/content/browser/DEPS @@ -41,7 +41,6 @@ include_rules = [ "+chrome/browser/mach_broker_mac.h",
"+chrome/browser/net/load_timing_observer.h",
- "+chrome/browser/net/predictor_api.h",
"+chrome/browser/notifications/desktop_notification_service.h",
"+chrome/browser/notifications/desktop_notification_service_factory.h",
@@ -49,7 +48,6 @@ include_rules = [ "+chrome/browser/platform_util.h",
- "+chrome/browser/prefs/pref_change_registrar.h",
"+chrome/browser/prefs/pref_service.h",
"+chrome/common/pref_names.h",
@@ -62,8 +60,6 @@ include_rules = [ "+chrome/browser/renderer_host/web_cache_manager.h",
- "+chrome/browser/renderer_preferences_util.h",
-
# http://crbug.com/77089
"+chrome/browser/safe_browsing/safe_browsing_service.h",
"+chrome/browser/renderer_host/safe_browsing_resource_handler.h",
diff --git a/content/browser/content_browser_client.cc b/content/browser/content_browser_client.cc index 782988a..b35096e 100644 --- a/content/browser/content_browser_client.cc +++ b/content/browser/content_browser_client.cc @@ -37,10 +37,6 @@ bool ContentBrowserClient::IsURLSameAsAnySiteInstance(const GURL& url) { return false; } -GURL ContentBrowserClient::GetAlternateErrorPageURL(const TabContents* tab) { - return GURL(); -} - std::string ContentBrowserClient::GetCanonicalEncodingNameByAliasName( const std::string& alias_name) { return alias_name; diff --git a/content/browser/content_browser_client.h b/content/browser/content_browser_client.h index 83e9c19..1e78d29 100644 --- a/content/browser/content_browser_client.h +++ b/content/browser/content_browser_client.h @@ -61,9 +61,6 @@ class ContentBrowserClient { // SiteInstance. virtual bool IsURLSameAsAnySiteInstance(const GURL& url); - // See RenderViewHostDelegate's comment. - virtual GURL GetAlternateErrorPageURL(const TabContents* tab); - // See CharacterEncoding's comment. virtual std::string GetCanonicalEncodingNameByAliasName( const std::string& alias_name); diff --git a/content/browser/renderer_host/render_message_filter.cc b/content/browser/renderer_host/render_message_filter.cc index 0f7d310..e78cb12 100644 --- a/content/browser/renderer_host/render_message_filter.cc +++ b/content/browser/renderer_host/render_message_filter.cc @@ -16,7 +16,6 @@ #include "chrome/browser/download/download_types.h" #include "chrome/browser/download/download_util.h" #include "chrome/browser/extensions/extension_info_map.h" -#include "chrome/browser/net/predictor_api.h" #include "chrome/browser/notifications/desktop_notification_service.h" #include "chrome/browser/notifications/desktop_notification_service_factory.h" #include "chrome/browser/notifications/notifications_prefs_cache.h" @@ -383,7 +382,6 @@ bool RenderMessageFilter::OnMessageReceived(const IPC::Message& message, IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_ClearCache, OnClearCache) IPC_MESSAGE_HANDLER(ViewHostMsg_ClearHostResolverCache, OnClearHostResolverCache) - IPC_MESSAGE_HANDLER(ViewHostMsg_ClearPredictorCache, OnClearPredictorCache) IPC_MESSAGE_HANDLER(ViewHostMsg_DidGenerateCacheableMetadata, OnCacheableMetadataAvailable) IPC_MESSAGE_HANDLER(ViewHostMsg_EnableSpdy, OnEnableSpdy) @@ -771,14 +769,6 @@ void RenderMessageFilter::OnClearHostResolverCache(int* result) { } } -void RenderMessageFilter::OnClearPredictorCache(int* result) { - // This function is disabled unless the user has enabled - // benchmarking extensions. - CHECK(CheckBenchmarkingEnabled()); - chrome_browser_net::ClearPredictorCache(); - *result = 0; -} - bool RenderMessageFilter::CheckPreparsedJsCachingEnabled() const { static bool checked = false; static bool result = false; diff --git a/content/browser/renderer_host/render_message_filter.h b/content/browser/renderer_host/render_message_filter.h index ab7f84b..9b9379f 100644 --- a/content/browser/renderer_host/render_message_filter.h +++ b/content/browser/renderer_host/render_message_filter.h @@ -190,7 +190,6 @@ class RenderMessageFilter : public BrowserMessageFilter { void OnSetCacheMode(bool enabled); void OnClearCache(bool preserve_ssl_host_info, IPC::Message* reply_msg); void OnClearHostResolverCache(int* result); - void OnClearPredictorCache(int* result); void OnCacheableMetadataAvailable(const GURL& url, double expected_response_time, const std::vector<char>& data); diff --git a/content/browser/renderer_host/render_view_host.cc b/content/browser/renderer_host/render_view_host.cc index d0cd465..96eb779 100644 --- a/content/browser/renderer_host/render_view_host.cc +++ b/content/browser/renderer_host/render_view_host.cc @@ -15,7 +15,6 @@ #include "base/time.h" #include "base/utf_string_conversions.h" #include "base/values.h" -#include "chrome/browser/net/predictor_api.h" #include "chrome/browser/profiles/profile.h" #include "chrome/common/chrome_switches.h" #include "content/browser/browser_message_filter.h" @@ -171,10 +170,6 @@ bool RenderViewHost::CreateRenderView(const string16& frame_name) { params.frame_name = frame_name; Send(new ViewMsg_New(params)); - // Set the alternate error page, which is profile specific, in the renderer. - GURL url = delegate_->GetAlternateErrorPageURL(); - Send(new ViewMsg_SetAltErrorPageURL(routing_id(), url)); - // If it's enabled, tell the renderer to set up the Javascript bindings for // sending messages back to the browser. Send(new ViewMsg_AllowBindings(routing_id(), enabled_bindings_)); @@ -233,10 +228,9 @@ void RenderViewHost::Navigate(const ViewMsg_Navigate_Params& params) { if (!params.url.SchemeIs(chrome::kJavaScriptScheme)) delegate_->DidStartLoading(); } - const GURL& url = params.url; - if (!delegate_->IsExternalTabContainer() && - (url.SchemeIs(chrome::kHttpScheme) || url.SchemeIs(chrome::kHttpsScheme))) - chrome_browser_net::PreconnectUrlAndSubresources(url); + + FOR_EACH_OBSERVER( + RenderViewHostObserver, observers_, Navigate(params)); } void RenderViewHost::NavigateToURL(const GURL& url) { diff --git a/content/browser/renderer_host/render_view_host_delegate.cc b/content/browser/renderer_host/render_view_host_delegate.cc index da831b2..46b7bfa 100644 --- a/content/browser/renderer_host/render_view_host_delegate.cc +++ b/content/browser/renderer_host/render_view_host_delegate.cc @@ -41,10 +41,6 @@ BackgroundContents* RenderViewHostDelegate::GetAsBackgroundContents() { return NULL; } -GURL RenderViewHostDelegate::GetAlternateErrorPageURL() const { - return GURL(); -} - WebPreferences RenderViewHostDelegate::GetWebkitPrefs() { return WebPreferences(); } diff --git a/content/browser/renderer_host/render_view_host_delegate.h b/content/browser/renderer_host/render_view_host_delegate.h index 0eded02..9fed5f2 100644 --- a/content/browser/renderer_host/render_view_host_delegate.h +++ b/content/browser/renderer_host/render_view_host_delegate.h @@ -374,11 +374,6 @@ class RenderViewHostDelegate : public IPC::Channel::Listener { const std::wstring& message, IPC::Message* reply_msg) {} - // |url| is assigned to a server that can provide alternate error pages. If - // the returned URL is empty, the default error page built into WebKit will - // be used. - virtual GURL GetAlternateErrorPageURL() const; - // Return a dummy RendererPreferences object that will be used by the renderer // associated with the owning RenderViewHost. virtual RendererPreferences GetRendererPrefs(Profile* profile) const = 0; diff --git a/content/browser/renderer_host/render_view_host_observer.cc b/content/browser/renderer_host/render_view_host_observer.cc index 15463d4..3b03040 100644 --- a/content/browser/renderer_host/render_view_host_observer.cc +++ b/content/browser/renderer_host/render_view_host_observer.cc @@ -24,6 +24,9 @@ void RenderViewHostObserver::RenderViewHostDestroyed() { delete this; } +void RenderViewHostObserver::Navigate(const ViewMsg_Navigate_Params& params) { +} + bool RenderViewHostObserver::OnMessageReceived(const IPC::Message& message) { return false; } diff --git a/content/browser/renderer_host/render_view_host_observer.h b/content/browser/renderer_host/render_view_host_observer.h index 2727fb3..2c3b7492 100644 --- a/content/browser/renderer_host/render_view_host_observer.h +++ b/content/browser/renderer_host/render_view_host_observer.h @@ -8,6 +8,7 @@ #include "ipc/ipc_channel.h" class RenderViewHost; +struct ViewMsg_Navigate_Params; // An observer API implemented by classes which want to filter IPC messages from // RenderViewHost. @@ -28,6 +29,9 @@ class RenderViewHostObserver : public IPC::Channel::Listener, // chance to cleanup. The base implementation will delete the object. virtual void RenderViewHostDestroyed(); + // Notifies that a navigation is starting. + virtual void Navigate(const ViewMsg_Navigate_Params& params); + // IPC::Channel::Listener implementation. virtual bool OnMessageReceived(const IPC::Message& message); diff --git a/content/browser/tab_contents/interstitial_page.cc b/content/browser/tab_contents/interstitial_page.cc index d455472..3d86c38 100644 --- a/content/browser/tab_contents/interstitial_page.cc +++ b/content/browser/tab_contents/interstitial_page.cc @@ -12,8 +12,6 @@ #include "base/threading/thread.h" #include "base/utf_string_conversions.h" #include "chrome/browser/browser_process.h" -#include "chrome/browser/profiles/profile.h" -#include "chrome/browser/renderer_preferences_util.h" #include "content/browser/browser_thread.h" #include "content/browser/renderer_host/render_process_host.h" #include "content/browser/renderer_host/render_view_host.h" @@ -158,9 +156,6 @@ InterstitialPage::InterstitialPage(TabContents* tab, resource_dispatcher_host_notified_(false), ALLOW_THIS_IN_INITIALIZER_LIST(rvh_view_delegate_( new InterstitialPageRVHViewDelegate(this))) { - renderer_preferences_util::UpdateFromSystemSettings( - &renderer_preferences_, tab_->profile()); - InitInterstitialPageMap(); // It would be inconsistent to create an interstitial with no new navigation // (which is the case when the interstitial was triggered by a sub-resource on diff --git a/content/browser/tab_contents/interstitial_page.h b/content/browser/tab_contents/interstitial_page.h index 33c4485..1340893 100644 --- a/content/browser/tab_contents/interstitial_page.h +++ b/content/browser/tab_contents/interstitial_page.h @@ -144,6 +144,9 @@ class InterstitialPage : public NotificationObserver, TabContents* tab() const { return tab_; } const GURL& url() const { return url_; } RenderViewHost* render_view_host() const { return render_view_host_; } + void set_renderer_preferences(const RendererPreferences& prefs) { + renderer_preferences_ = prefs; + } // Creates the RenderViewHost containing the interstitial content. // Overriden in unit tests. diff --git a/content/browser/tab_contents/tab_contents.cc b/content/browser/tab_contents/tab_contents.cc index 51b9623..cf049ac 100644 --- a/content/browser/tab_contents/tab_contents.cc +++ b/content/browser/tab_contents/tab_contents.cc @@ -22,7 +22,6 @@ #include "chrome/browser/prefs/pref_service.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/renderer_host/web_cache_manager.h" -#include "chrome/browser/renderer_preferences_util.h" #include "chrome/browser/ui/app_modal_dialogs/message_box_handler.h" #include "chrome/browser/ui/browser_dialogs.h" #include "chrome/common/chrome_constants.h" @@ -117,32 +116,6 @@ const int kQueryStateDelay = 5000; const int kSyncWaitDelay = 40; -// The list of prefs we want to observe. -const char* kPrefsToObserve[] = { - prefs::kAlternateErrorPagesEnabled, - prefs::kDefaultZoomLevel, - prefs::kWebKitJavaEnabled, - prefs::kWebKitJavascriptEnabled, - prefs::kWebKitLoadsImagesAutomatically, - prefs::kWebKitPluginsEnabled, - prefs::kWebKitUsesUniversalDetector, - prefs::kWebKitStandardFontFamily, - prefs::kWebKitSerifFontFamily, - prefs::kWebKitSansSerifFontFamily, - prefs::kWebKitFixedFontFamily, - prefs::kWebKitDefaultFontSize, - prefs::kWebKitDefaultFixedFontSize, - prefs::kWebKitMinimumFontSize, - prefs::kWebKitMinimumLogicalFontSize, - prefs::kWebkitTabsToLinks, - prefs::kWebKitAllowRunningInsecureContent, - prefs::kWebKitAllowDisplayingInsecureContent, - prefs::kDefaultCharset, - prefs::kEnableReferrers -}; - -const int kPrefsToObserveLength = arraysize(kPrefsToObserve); - #if defined(OS_WIN) BOOL CALLBACK InvalidateWindow(HWND hwnd, LPARAM lparam) { @@ -231,8 +204,6 @@ TabContents::TabContents(Profile* profile, static_cast<int>(WebKit::WebView::maxTextSizeMultiplier * 100)), temporary_zoom_settings_(false), content_restrictions_(0) { - renderer_preferences_util::UpdateFromSystemSettings( - &renderer_preferences_, profile); render_manager_.Init(profile, site_instance, routing_id); @@ -241,27 +212,8 @@ TabContents::TabContents(Profile* profile, view_->CreateView(base_tab_contents ? base_tab_contents->view()->GetContainerSize() : gfx::Size()); - // Register for notifications about all interested prefs change. - PrefService* prefs = profile->GetPrefs(); - pref_change_registrar_.Init(prefs); - if (prefs) { - for (int i = 0; i < kPrefsToObserveLength; ++i) - pref_change_registrar_.Add(kPrefsToObserve[i], this); - } - registrar_.Add(this, NotificationType::RENDER_WIDGET_HOST_DESTROYED, NotificationService::AllSources()); -#if defined(OS_LINUX) - registrar_.Add(this, NotificationType::BROWSER_THEME_CHANGED, - NotificationService::AllSources()); -#endif - - registrar_.Add(this, NotificationType::USER_STYLE_SHEET_UPDATED, - NotificationService::AllSources()); - - // Listen for Google URL changes. - registrar_.Add(this, NotificationType::GOOGLE_URL_UPDATED, - NotificationService::AllSources()); // Can only add observers after render_manager_.Init() is called, since that's // what sets up the render_view_host which TabContentObserver's constructor @@ -274,7 +226,6 @@ TabContents::~TabContents() { // We don't want any notifications while we're running our destructor. registrar_.RemoveAll(); - pref_change_registrar_.RemoveAll(); NotifyDisconnected(); browser::HideHungRendererDialog(this); @@ -1195,22 +1146,6 @@ void TabContents::CloseConstrainedWindows() { } } -void TabContents::UpdateAlternateErrorPageURL() { - GURL url = GetAlternateErrorPageURL(); - render_view_host()->Send(new ViewMsg_SetAltErrorPageURL( - render_view_host()->routing_id(), url)); -} - -void TabContents::UpdateWebPreferences() { - render_view_host()->Send(new ViewMsg_UpdateWebPreferences( - render_view_host()->routing_id(), GetWebkitPrefs())); -} - -void TabContents::UpdateZoomLevel() { - render_view_host()->Send(new ViewMsg_SetZoomLevel( - render_view_host()->routing_id(), GetZoomLevel())); -} - void TabContents::UpdateMaxPageIDIfNecessary(SiteInstance* site_instance, RenderViewHost* rvh) { // If we are creating a RVH for a restored controller, then we might @@ -1355,6 +1290,9 @@ void TabContents::RenderViewCreated(RenderViewHost* render_view_host) { } view()->RenderViewCreated(render_view_host); + + FOR_EACH_OBSERVER( + TabContentsObserver, observers_, RenderViewCreated(render_view_host)); } void TabContents::RenderViewReady(RenderViewHost* rvh) { @@ -1705,10 +1643,6 @@ void TabContents::RunBeforeUnloadConfirm(const RenderViewHost* rvh, RunBeforeUnloadDialog(this, message, reply_msg); } -GURL TabContents::GetAlternateErrorPageURL() const { - return content::GetContentClient()->browser()->GetAlternateErrorPageURL(this); -} - WebPreferences TabContents::GetWebkitPrefs() { Profile* profile = render_view_host()->process()->profile(); bool is_web_ui = false; @@ -1887,46 +1821,9 @@ void TabContents::Observe(NotificationType type, const NotificationSource& source, const NotificationDetails& details) { switch (type.value) { - case NotificationType::PREF_CHANGED: { - std::string* pref_name_in = Details<std::string>(details).ptr(); - DCHECK(Source<PrefService>(source).ptr() == profile()->GetPrefs()); - if (*pref_name_in == prefs::kAlternateErrorPagesEnabled) { - UpdateAlternateErrorPageURL(); - } else if ((*pref_name_in == prefs::kDefaultCharset) || - StartsWithASCII(*pref_name_in, "webkit.webprefs.", true)) { - UpdateWebPreferences(); - } else if (*pref_name_in == prefs::kDefaultZoomLevel) { - UpdateZoomLevel(); - } else if (*pref_name_in == prefs::kEnableReferrers) { - renderer_preferences_util::UpdateFromSystemSettings( - &renderer_preferences_, profile()); - render_view_host()->SyncRendererPrefs(); - } else { - NOTREACHED() << "unexpected pref change notification" << *pref_name_in; - } - break; - } case NotificationType::RENDER_WIDGET_HOST_DESTROYED: view_->RenderWidgetHostDestroyed(Source<RenderWidgetHost>(source).ptr()); break; - -#if defined(OS_LINUX) - case NotificationType::BROWSER_THEME_CHANGED: { - renderer_preferences_util::UpdateFromSystemSettings( - &renderer_preferences_, profile()); - render_view_host()->SyncRendererPrefs(); - break; - } -#endif - - case NotificationType::USER_STYLE_SHEET_UPDATED: - UpdateWebPreferences(); - break; - - case NotificationType::GOOGLE_URL_UPDATED: - UpdateAlternateErrorPageURL(); - break; - default: NOTREACHED(); } diff --git a/content/browser/tab_contents/tab_contents.h b/content/browser/tab_contents/tab_contents.h index f4020c9..67a2d50 100644 --- a/content/browser/tab_contents/tab_contents.h +++ b/content/browser/tab_contents/tab_contents.h @@ -14,7 +14,6 @@ #include "base/gtest_prod_util.h" #include "base/memory/scoped_ptr.h" #include "base/string16.h" -#include "chrome/browser/prefs/pref_change_registrar.h" #include "chrome/browser/ui/app_modal_dialogs/js_modal_dialog.h" #include "content/browser/renderer_host/render_view_host_delegate.h" #include "content/browser/tab_contents/constrained_window.h" @@ -601,16 +600,6 @@ class TabContents : public PageNavigator, // Closes all constrained windows. void CloseConstrainedWindows(); - // Send the alternate error page URL to the renderer. This method is virtual - // so special html pages can override this (e.g., the new tab page). - virtual void UpdateAlternateErrorPageURL(); - - // Send webkit specific settings to the renderer. - void UpdateWebPreferences(); - - // Instruct the renderer to update the zoom level. - void UpdateZoomLevel(); - // If our controller was restored and the page id is > than the site // instance's page id, the site instances page id is updated as well as the // renderers max page id. @@ -690,7 +679,6 @@ class TabContents : public PageNavigator, virtual void RunBeforeUnloadConfirm(const RenderViewHost* rvh, const std::wstring& message, IPC::Message* reply_msg); - virtual GURL GetAlternateErrorPageURL() const; virtual RendererPreferences GetRendererPrefs(Profile* profile) const; virtual WebPreferences GetWebkitPrefs(); virtual void OnUserGesture(); @@ -771,9 +759,6 @@ class TabContents : public PageNavigator, // Registers and unregisters us for notifications. NotificationRegistrar registrar_; - // Registers and unregisters for pref notifications. - PrefChangeRegistrar pref_change_registrar_; - // Handles drag and drop event forwarding to extensions. BookmarkDrag* bookmark_drag_; diff --git a/content/browser/tab_contents/tab_contents_observer.cc b/content/browser/tab_contents/tab_contents_observer.cc index 100a836..0a80847 100644 --- a/content/browser/tab_contents/tab_contents_observer.cc +++ b/content/browser/tab_contents/tab_contents_observer.cc @@ -25,6 +25,9 @@ void TabContentsObserver::Registrar::Observe(TabContents* tab) { tab_->AddObserver(observer_); } +void TabContentsObserver::RenderViewCreated(RenderViewHost* render_view_host) { +} + void TabContentsObserver::NavigateToPendingEntry( const GURL& url, NavigationController::ReloadType reload_type) { diff --git a/content/browser/tab_contents/tab_contents_observer.h b/content/browser/tab_contents/tab_contents_observer.h index 81ca4f2..7dc51fe 100644 --- a/content/browser/tab_contents/tab_contents_observer.h +++ b/content/browser/tab_contents/tab_contents_observer.h @@ -40,10 +40,10 @@ class TabContentsObserver : public IPC::Channel::Listener, DISALLOW_COPY_AND_ASSIGN(Registrar); }; + virtual void RenderViewCreated(RenderViewHost* render_view_host); virtual void NavigateToPendingEntry( const GURL& url, NavigationController::ReloadType reload_type); - virtual void DidNavigateMainFramePostCommit( const NavigationController::LoadCommittedDetails& details, const ViewHostMsg_FrameNavigate_Params& params); |