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

Unified Diff: content/public/browser/web_ui_controller.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/public/browser/web_ui_controller.h
===================================================================
--- content/public/browser/web_ui_controller.h (revision 0)
+++ content/public/browser/web_ui_controller.h (revision 0)
@@ -0,0 +1,57 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CONTENT_PUBLIC_BROWSER_WEB_UI_CONTROLLER_H_
+#define CONTENT_PUBLIC_BROWSER_WEB_UI_CONTROLLER_H_
+#pragma once
+
+#include "base/basictypes.h"
+#include "base/string16.h"
+#include "content/common/content_export.h"
+
+class GURL;
+class RenderViewHost;
+
+namespace base {
+class ListValue;
+}
+
+namespace content {
+
+// A WebUI page is controller by the embedder's WebUIController object. It
+// manages the data source and message handlers.
+class CONTENT_EXPORT WebUIController {
+ public:
+ virtual ~WebUIController() {}
+
+ // Allows the controller to override handling all messages from the page. If
+ // it wants to override it, |overridden| should be set to true.
+ virtual void HandleWebUIMessage(const GURL& source_url,
+ const std::string& message,
+ const base::ListValue& args,
+ bool* overridden) {}
Evan Stade 2012/01/12 23:55:37 why is overridden an outparam instead of return va
jam 2012/01/13 00:06:03 this is slightly nicer because we can then avoid a
+
+ // Called when RenderView is first created. This is *not* called for every
+ // page load because in some cases a RenderView will be reused. In those
+ // cases, RenderViewReused will be called instead.
+ virtual void RenderViewCreated(RenderViewHost* render_view_host) {}
+
+ // Called 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() {}
+};
+
+} // namespace content
+
+#endif // CONTENT_PUBLIC_BROWSER_WEB_UI_CONTROLLER_H_
Property changes on: content\public\browser\web_ui_controller.h
___________________________________________________________________
Added: svn:eol-style
+ LF

Powered by Google App Engine
This is Rietveld 408576698