diff options
12 files changed, 79 insertions, 11 deletions
diff --git a/chrome/browser/extensions/extension_host.cc b/chrome/browser/extensions/extension_host.cc index a2f119b..f91c259 100644 --- a/chrome/browser/extensions/extension_host.cc +++ b/chrome/browser/extensions/extension_host.cc @@ -278,6 +278,15 @@ void ExtensionHost::UpdatePreferredSize(const gfx::Size& new_size) { view_->UpdatePreferredSize(new_size); } +void ExtensionHost::UpdateInspectorSetting(const std::string& key, + const std::string& value) { + RenderViewHostDelegateHelper::UpdateInspectorSetting(profile(), key, value); +} + +void ExtensionHost::ClearInspectorSettings() { + RenderViewHostDelegateHelper::ClearInspectorSettings(profile()); +} + void ExtensionHost::RenderViewGone(RenderViewHost* render_view_host) { // During browser shutdown, we may use sudden termination on an extension // process, so it is expected to lose our connection to the render view. diff --git a/chrome/browser/extensions/extension_host.h b/chrome/browser/extensions/extension_host.h index fe208c8..49b8191 100644 --- a/chrome/browser/extensions/extension_host.h +++ b/chrome/browser/extensions/extension_host.h @@ -174,6 +174,9 @@ class ExtensionHost : public RenderViewHostDelegate, virtual void HandleMouseUp(); virtual void HandleMouseActivate(); virtual void UpdatePreferredSize(const gfx::Size& new_size); + virtual void UpdateInspectorSetting(const std::string& key, + const std::string& value); + virtual void ClearInspectorSettings(); // NotificationObserver virtual void Observe(NotificationType type, diff --git a/chrome/browser/notifications/balloon_host.cc b/chrome/browser/notifications/balloon_host.cc index 4251086..8faaebf 100644 --- a/chrome/browser/notifications/balloon_host.cc +++ b/chrome/browser/notifications/balloon_host.cc @@ -166,6 +166,16 @@ void BalloonHost::EnableDOMUI() { enable_dom_ui_ = true; } +void BalloonHost::UpdateInspectorSetting(const std::string& key, + const std::string& value) { + RenderViewHostDelegateHelper::UpdateInspectorSetting( + GetProfile(), key, value); +} + +void BalloonHost::ClearInspectorSettings() { + RenderViewHostDelegateHelper::ClearInspectorSettings(GetProfile()); +} + void BalloonHost::NotifyDisconnect() { if (!should_notify_on_disconnect_) return; diff --git a/chrome/browser/notifications/balloon_host.h b/chrome/browser/notifications/balloon_host.h index fde3bf5..4677241 100644 --- a/chrome/browser/notifications/balloon_host.h +++ b/chrome/browser/notifications/balloon_host.h @@ -121,6 +121,10 @@ class BalloonHost : public RenderViewHostDelegate, // Enable DOM UI. This has to be called before renderer is created. void EnableDOMUI(); + virtual void UpdateInspectorSetting(const std::string& key, + const std::string& value); + virtual void ClearInspectorSettings(); + protected: virtual ~BalloonHost() {} // Must override in platform specific implementations. diff --git a/chrome/browser/renderer_host/render_view_host_delegate.h b/chrome/browser/renderer_host/render_view_host_delegate.h index 64022e3..7ef8c9e 100644 --- a/chrome/browser/renderer_host/render_view_host_delegate.h +++ b/chrome/browser/renderer_host/render_view_host_delegate.h @@ -716,9 +716,9 @@ class RenderViewHostDelegate { // Inspector setting was changed and should be persisted. virtual void UpdateInspectorSetting(const std::string& key, - const std::string& value) {} + const std::string& value) = 0; - virtual void ClearInspectorSettings() {} + virtual void ClearInspectorSettings() = 0; // The page is trying to close the RenderView's representation in the client. virtual void Close(RenderViewHost* render_view_host) {} diff --git a/chrome/browser/tab_contents/background_contents.cc b/chrome/browser/tab_contents/background_contents.cc index 5121d29..41735d8 100644 --- a/chrome/browser/tab_contents/background_contents.cc +++ b/chrome/browser/tab_contents/background_contents.cc @@ -135,6 +135,17 @@ gfx::NativeWindow BackgroundContents::GetMessageBoxRootWindow() { return NULL; } +void BackgroundContents::UpdateInspectorSetting(const std::string& key, + const std::string& value) { + Profile* profile = render_view_host_->process()->profile(); + RenderViewHostDelegateHelper::UpdateInspectorSetting(profile, key, value); +} + +void BackgroundContents::ClearInspectorSettings() { + Profile* profile = render_view_host_->process()->profile(); + RenderViewHostDelegateHelper::ClearInspectorSettings(profile); +} + void BackgroundContents::Close(RenderViewHost* render_view_host) { Profile* profile = render_view_host->process()->profile(); NotificationService::current()->Notify( diff --git a/chrome/browser/tab_contents/background_contents.h b/chrome/browser/tab_contents/background_contents.h index 009dd0a..0e48416 100644 --- a/chrome/browser/tab_contents/background_contents.h +++ b/chrome/browser/tab_contents/background_contents.h @@ -124,6 +124,10 @@ class BackgroundContents : public RenderViewHostDelegate, virtual TabContents* AsTabContents() { return NULL; } virtual ExtensionHost* AsExtensionHost() { return NULL; } + virtual void UpdateInspectorSetting(const std::string& key, + const std::string& value); + virtual void ClearInspectorSettings(); + protected: // Exposed for testing. BackgroundContents(); diff --git a/chrome/browser/tab_contents/interstitial_page.cc b/chrome/browser/tab_contents/interstitial_page.cc index 660dbec..fcf7e76 100644 --- a/chrome/browser/tab_contents/interstitial_page.cc +++ b/chrome/browser/tab_contents/interstitial_page.cc @@ -697,3 +697,12 @@ void InterstitialPage::InterstitialPageRVHViewDelegate::OnFindReply( int InterstitialPage::GetBrowserWindowID() const { return tab_->GetBrowserWindowID(); } + +void InterstitialPage::UpdateInspectorSetting(const std::string& key, + const std::string& value) { + RenderViewHostDelegateHelper::UpdateInspectorSetting(tab_->profile(), key, value); +} + +void InterstitialPage::ClearInspectorSettings() { + RenderViewHostDelegateHelper::ClearInspectorSettings(tab_->profile()); +} diff --git a/chrome/browser/tab_contents/interstitial_page.h b/chrome/browser/tab_contents/interstitial_page.h index 097fbde..50ede04 100644 --- a/chrome/browser/tab_contents/interstitial_page.h +++ b/chrome/browser/tab_contents/interstitial_page.h @@ -111,6 +111,10 @@ class InterstitialPage : public NotificationObserver, } bool reload_on_dont_proceed() const { return reload_on_dont_proceed_; } + virtual void UpdateInspectorSetting(const std::string& key, + const std::string& value); + virtual void ClearInspectorSettings(); + protected: // NotificationObserver method: virtual void Observe(NotificationType type, diff --git a/chrome/browser/tab_contents/render_view_host_delegate_helper.cc b/chrome/browser/tab_contents/render_view_host_delegate_helper.cc index ed52587..5db7189 100644 --- a/chrome/browser/tab_contents/render_view_host_delegate_helper.cc +++ b/chrome/browser/tab_contents/render_view_host_delegate_helper.cc @@ -323,3 +323,19 @@ WebPreferences RenderViewHostDelegateHelper::GetWebkitPrefs( return web_prefs; } + +void RenderViewHostDelegateHelper::UpdateInspectorSetting( + Profile* profile, const std::string& key, const std::string& value) { + DictionaryValue* inspector_settings = + profile->GetPrefs()->GetMutableDictionary( + prefs::kWebKitInspectorSettings); + inspector_settings->SetWithoutPathExpansion(key, + Value::CreateStringValue(value)); +} + +void RenderViewHostDelegateHelper::ClearInspectorSettings(Profile* profile) { + DictionaryValue* inspector_settings = + profile->GetPrefs()->GetMutableDictionary( + prefs::kWebKitInspectorSettings); + inspector_settings->Clear(); +} diff --git a/chrome/browser/tab_contents/render_view_host_delegate_helper.h b/chrome/browser/tab_contents/render_view_host_delegate_helper.h index a1f2b9b..53cefcb 100644 --- a/chrome/browser/tab_contents/render_view_host_delegate_helper.h +++ b/chrome/browser/tab_contents/render_view_host_delegate_helper.h @@ -99,6 +99,11 @@ class RenderViewHostDelegateHelper { public: static WebPreferences GetWebkitPrefs(Profile* profile, bool is_dom_ui); + static void UpdateInspectorSetting(Profile* profile, + const std::string& key, + const std::string& value); + static void ClearInspectorSettings(Profile* profile); + private: RenderViewHostDelegateHelper(); diff --git a/chrome/browser/tab_contents/tab_contents.cc b/chrome/browser/tab_contents/tab_contents.cc index e695633..1f645e5 100644 --- a/chrome/browser/tab_contents/tab_contents.cc +++ b/chrome/browser/tab_contents/tab_contents.cc @@ -2553,18 +2553,11 @@ void TabContents::UpdateThumbnail(const GURL& url, void TabContents::UpdateInspectorSetting(const std::string& key, const std::string& value) { - DictionaryValue* inspector_settings = - profile()->GetPrefs()->GetMutableDictionary( - prefs::kWebKitInspectorSettings); - inspector_settings->SetWithoutPathExpansion(key, - Value::CreateStringValue(value)); + RenderViewHostDelegateHelper::UpdateInspectorSetting(profile(), key, value); } void TabContents::ClearInspectorSettings() { - DictionaryValue* inspector_settings = - profile()->GetPrefs()->GetMutableDictionary( - prefs::kWebKitInspectorSettings); - inspector_settings->Clear(); + RenderViewHostDelegateHelper::ClearInspectorSettings(profile()); } void TabContents::Close(RenderViewHost* rvh) { |