diff options
author | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-06 20:29:18 +0000 |
---|---|---|
committer | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-06 20:29:18 +0000 |
commit | 1ee61486ee0854be7b82d9fca66bb49d563ede4c (patch) | |
tree | 6f8ba801a5f19e022a281d622d7eaf467d637214 /chrome/browser/extensions | |
parent | 0928fb62d472e45d2bd23d97aa43b5f704c00bec (diff) | |
download | chromium_src-1ee61486ee0854be7b82d9fca66bb49d563ede4c.zip chromium_src-1ee61486ee0854be7b82d9fca66bb49d563ede4c.tar.gz chromium_src-1ee61486ee0854be7b82d9fca66bb49d563ede4c.tar.bz2 |
Do some refactoring of renderer_host.
This removes the last dependency on tab_contents from the renderer_host code
and into the RenderViewHostDelegate. Some of the tests depended on tab_contents,
so I moved to a new directory with the tab_contents include allowed via DEPS.
Now DEPS can enforce that no additional tab_contents includes are added to
renderer_host.
RenderViewHost delegate is now pure virtual. After spending a while *again*
figuring out why my code didn't work, only to find it was because the default
implementation of a function was getting called instead of the real one, I
decided to make this pure virtual. It is implemented by TabContents, which
implements basically everything, and two other places that implement less. Only
two lists of duplicate functions seems not too bad, although long-term it would
be nice if this delegate was somehow more succinct.
Review URL: http://codereview.chromium.org/155071
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@19982 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/extensions')
-rw-r--r-- | chrome/browser/extensions/extension_host.cc | 53 | ||||
-rw-r--r-- | chrome/browser/extensions/extension_host.h | 21 |
2 files changed, 36 insertions, 38 deletions
diff --git a/chrome/browser/extensions/extension_host.cc b/chrome/browser/extensions/extension_host.cc index 15319b3..2169a80 100644 --- a/chrome/browser/extensions/extension_host.cc +++ b/chrome/browser/extensions/extension_host.cc @@ -165,25 +165,6 @@ void ExtensionHost::RenderViewGone(RenderViewHost* render_view_host) { Details<ExtensionHost>(this)); } -WebPreferences ExtensionHost::GetWebkitPrefs() { - PrefService* prefs = render_view_host()->process()->profile()->GetPrefs(); - const bool kIsDomUI = true; - return RenderViewHostDelegateHelper::GetWebkitPrefs(prefs, kIsDomUI); -} - -void ExtensionHost::RunJavaScriptMessage( - const std::wstring& message, - const std::wstring& default_prompt, - const GURL& frame_url, - const int flags, - IPC::Message* reply_msg, - bool* did_suppress_message) { - // Automatically cancel the javascript alert (otherwise the renderer hangs - // indefinitely). - *did_suppress_message = true; - render_view_host()->JavaScriptMessageBoxClosed(reply_msg, true, L""); -} - void ExtensionHost::DidStopLoading(RenderViewHost* render_view_host) { // TODO(aa): This is toolstrip-specific and should probably not be here. // ExtensionToolstrip in bookmark_bar_view.cc? @@ -195,6 +176,32 @@ void ExtensionHost::DidStopLoading(RenderViewHost* render_view_host) { did_stop_loading_ = true; } +void ExtensionHost::RunJavaScriptMessage(const std::wstring& message, + const std::wstring& default_prompt, + const GURL& frame_url, + const int flags, + IPC::Message* reply_msg, + bool* did_suppress_message) { + // Automatically cancel the javascript alert (otherwise the renderer hangs + // indefinitely). + *did_suppress_message = true; + render_view_host()->JavaScriptMessageBoxClosed(reply_msg, true, L""); +} + +WebPreferences ExtensionHost::GetWebkitPrefs() { + PrefService* prefs = render_view_host()->process()->profile()->GetPrefs(); + const bool kIsDomUI = true; + return RenderViewHostDelegateHelper::GetWebkitPrefs(prefs, kIsDomUI); +} + +void ExtensionHost::ProcessDOMUIMessage(const std::string& message, + const std::string& content, + int request_id, + bool has_callback) { + extension_function_dispatcher_->HandleRequest(message, content, request_id, + has_callback); +} + void ExtensionHost::DidInsertCSS() { #if defined(TOOLKIT_VIEWS) if (view_.get()) @@ -304,14 +311,6 @@ Browser* ExtensionHost::GetBrowser() { return browser; } -void ExtensionHost::ProcessDOMUIMessage(const std::string& message, - const std::string& content, - int request_id, - bool has_callback) { - extension_function_dispatcher_->HandleRequest(message, content, request_id, - has_callback); -} - void ExtensionHost::RenderViewCreated(RenderViewHost* render_view_host) { extension_function_dispatcher_.reset( new ExtensionFunctionDispatcher(render_view_host_, this, url_)); diff --git a/chrome/browser/extensions/extension_host.h b/chrome/browser/extensions/extension_host.h index a3b04f2..b2f32b2 100644 --- a/chrome/browser/extensions/extension_host.h +++ b/chrome/browser/extensions/extension_host.h @@ -65,25 +65,24 @@ class ExtensionHost : public RenderViewHostDelegate, // process crashed. void RecoverCrashedExtension(); - // RenderViewHostDelegate + // RenderViewHostDelegate implementation. + virtual RenderViewHostDelegate::View* GetViewDelegate() const; virtual const GURL& GetURL() const { return url_; } virtual void RenderViewCreated(RenderViewHost* render_view_host); virtual void RenderViewGone(RenderViewHost* render_view_host); - virtual WebPreferences GetWebkitPrefs(); - virtual void RunJavaScriptMessage( - const std::wstring& message, - const std::wstring& default_prompt, - const GURL& frame_url, - const int flags, - IPC::Message* reply_msg, - bool* did_suppress_message); virtual void DidStopLoading(RenderViewHost* render_view_host); - virtual RenderViewHostDelegate::View* GetViewDelegate() const; - virtual void DidInsertCSS(); + virtual WebPreferences GetWebkitPrefs(); virtual void ProcessDOMUIMessage(const std::string& message, const std::string& content, int request_id, bool has_callback); + virtual void RunJavaScriptMessage(const std::wstring& message, + const std::wstring& default_prompt, + const GURL& frame_url, + const int flags, + IPC::Message* reply_msg, + bool* did_suppress_message); + virtual void DidInsertCSS(); // RenderViewHostDelegate::View virtual void CreateNewWindow(int route_id, |