Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2136)

Unified Diff: content/browser/webui/web_ui.h

Issue 9188056: Start splitting out WebUI into an implementation class and an interface that each page implements... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 8 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/browser/webui/web_ui.h
===================================================================
--- content/browser/webui/web_ui.h (revision 117388)
+++ content/browser/webui/web_ui.h (working copy)
@@ -27,6 +27,7 @@
namespace content {
class WebContents;
+class WebUIController;
class WebUIMessageHandler;
}
@@ -37,36 +38,17 @@
// ChromeWebUI.
class CONTENT_EXPORT WebUI : public IPC::Channel::Listener {
public:
- explicit WebUI(content::WebContents* contents);
+ WebUI(content::WebContents* contentsm, content::WebUIController* controller);
mmenke 2012/01/12 23:59:23 random driveby nit: -m
jam 2012/01/13 00:06:03 Done.
virtual ~WebUI();
- // IPC message handling.
+ // IPC::Channel::Listener implementation:
virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
- virtual void OnWebUISend(const GURL& source_url,
- const std::string& message,
- const base::ListValue& args);
- // Called by RenderViewHost when the RenderView is first created. This is
- // *not* called for every page load because in some cases
- // RenderViewHostManager will reuse RenderView instances. In those cases,
- // RenderViewReused will be called instead.
- virtual void RenderViewCreated(RenderViewHost* render_view_host);
+ // Called by TabContents when the RenderView is first created. This is *not*
+ // called for every page load because in some cases RenderViewHostManager will
+ // reuse RenderView instances.
+ void RenderViewCreated(RenderViewHost* render_view_host);
- // Called by RenderViewHostManager when a RenderView is reused to display a
- // page.
- virtual void RenderViewReused(RenderViewHost* render_view_host) {}
-
- // Called when this becomes the active WebUI instance for a re-used
- // RenderView; this is the point at which this WebUI instance will receive
- // DOM messages instead of the previous WebUI instance.
- //
- // If a WebUI instance has code that is usually triggered from a JavaScript
- // onload handler, this should be overridden to check to see if the web page's
- // DOM is still intact (e.g., due to a back/forward navigation that remains
- // within the same page), and if so trigger that code manually since onload
- // won't be run in that case.
- virtual void DidBecomeActiveForReusedRenderView() {}
-
// Used by WebUIMessageHandlers. If the given message is already registered,
// the call has no effect unless |register_callback_overwrites_| is set to
// true.
@@ -123,6 +105,8 @@
frame_xpath_ = xpath;
}
+ content::WebUIController* controller() const { return controller_.get(); }
+
// Call a Javascript function by sending its name and arguments down to
// the renderer. This is asynchronous; there's no way to get the result
// of the call, and should be thought of more like sending a message to
@@ -190,7 +174,14 @@
// Non-owning pointer to the WebContents this WebUI is associated with.
content::WebContents* web_contents_;
+ scoped_ptr<content::WebUIController> controller_;
+
private:
+ // IPC message handling.
+ void OnWebUISend(const GURL& source_url,
+ const std::string& message,
+ const base::ListValue& args);
+
// A map of message name -> message handling callback.
typedef std::map<std::string, MessageCallback> MessageCallbackMap;
MessageCallbackMap message_callbacks_;

Powered by Google App Engine
This is Rietveld 408576698