OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CONTENT_PUBLIC_BROWSER_WEB_UI_CONTROLLER_H_ |
| 6 #define CONTENT_PUBLIC_BROWSER_WEB_UI_CONTROLLER_H_ |
| 7 #pragma once |
| 8 |
| 9 #include "base/basictypes.h" |
| 10 #include "base/string16.h" |
| 11 #include "content/common/content_export.h" |
| 12 |
| 13 class GURL; |
| 14 class RenderViewHost; |
| 15 |
| 16 namespace base { |
| 17 class ListValue; |
| 18 } |
| 19 |
| 20 namespace content { |
| 21 |
| 22 // A WebUI page is controller by the embedder's WebUIController object. It |
| 23 // manages the data source and message handlers. |
| 24 class CONTENT_EXPORT WebUIController { |
| 25 public: |
| 26 virtual ~WebUIController() {} |
| 27 |
| 28 // Allows the controller to override handling all messages from the page. If |
| 29 // it wants to override it, |overridden| should be set to true. |
| 30 virtual void HandleWebUIMessage(const GURL& source_url, |
| 31 const std::string& message, |
| 32 const base::ListValue& args, |
| 33 bool* overridden) {} |
| 34 |
| 35 // Called when RenderView is first created. This is *not* called for every |
| 36 // page load because in some cases a RenderView will be reused. In those |
| 37 // cases, RenderViewReused will be called instead. |
| 38 virtual void RenderViewCreated(RenderViewHost* render_view_host) {} |
| 39 |
| 40 // Called when a RenderView is reused to display a page. |
| 41 virtual void RenderViewReused(RenderViewHost* render_view_host) {} |
| 42 |
| 43 // Called when this becomes the active WebUI instance for a re-used |
| 44 // RenderView; this is the point at which this WebUI instance will receive |
| 45 // DOM messages instead of the previous WebUI instance. |
| 46 // |
| 47 // If a WebUI instance has code that is usually triggered from a JavaScript |
| 48 // onload handler, this should be overridden to check to see if the web page's |
| 49 // DOM is still intact (e.g., due to a back/forward navigation that remains |
| 50 // within the same page), and if so trigger that code manually since onload |
| 51 // won't be run in that case. |
| 52 virtual void DidBecomeActiveForReusedRenderView() {} |
| 53 }; |
| 54 |
| 55 } // namespace content |
| 56 |
| 57 #endif // CONTENT_PUBLIC_BROWSER_WEB_UI_CONTROLLER_H_ |
OLD | NEW |