| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CONTENT_PUBLIC_BROWSER_WEB_UI_CONTROLLER_H_ | 5 #ifndef CONTENT_PUBLIC_BROWSER_WEB_UI_CONTROLLER_H_ |
| 6 #define CONTENT_PUBLIC_BROWSER_WEB_UI_CONTROLLER_H_ | 6 #define CONTENT_PUBLIC_BROWSER_WEB_UI_CONTROLLER_H_ |
| 7 | 7 |
| 8 #include "base/strings/string16.h" | 8 #include "base/strings/string16.h" |
| 9 #include "content/common/content_export.h" | 9 #include "content/common/content_export.h" |
| 10 | 10 |
| 11 class GURL; | 11 class GURL; |
| 12 | 12 |
| 13 namespace base { | 13 namespace base { |
| 14 class ListValue; | 14 class ListValue; |
| 15 } | 15 } |
| 16 | 16 |
| 17 namespace content { | 17 namespace content { |
| 18 | 18 |
| 19 class RenderFrameHost; | 19 class RenderFrameHost; |
| 20 class RenderViewHost; | |
| 21 class WebUI; | 20 class WebUI; |
| 22 | 21 |
| 23 // A WebUI page is controller by the embedder's WebUIController object. It | 22 // A WebUI page is controller by the embedder's WebUIController object. It |
| 24 // manages the data source and message handlers. | 23 // manages the data source and message handlers. |
| 25 class CONTENT_EXPORT WebUIController { | 24 class CONTENT_EXPORT WebUIController { |
| 26 public: | 25 public: |
| 27 explicit WebUIController(WebUI* web_ui) : web_ui_(web_ui) {} | 26 explicit WebUIController(WebUI* web_ui) : web_ui_(web_ui) {} |
| 28 virtual ~WebUIController() {} | 27 virtual ~WebUIController() {} |
| 29 | 28 |
| 30 // Allows the controller to override handling all messages from the page. | 29 // Allows the controller to override handling all messages from the page. |
| 31 // Return true if the message handling was overridden. | 30 // Return true if the message handling was overridden. |
| 32 virtual bool OverrideHandleWebUIMessage(const GURL& source_url, | 31 virtual bool OverrideHandleWebUIMessage(const GURL& source_url, |
| 33 const std::string& message, | 32 const std::string& message, |
| 34 const base::ListValue& args); | 33 const base::ListValue& args); |
| 35 | 34 |
| 36 // Called when a RenderFrame is created. This is *not* called for every | 35 // Called when a RenderFrame is created. This is *not* called for every |
| 37 // page load because in some cases a RenderFrame will be reused, for example | 36 // page load because in some cases a RenderFrame will be reused, for example |
| 38 // when reloading or navigating to a same-site URL. | 37 // when reloading or navigating to a same-site URL. |
| 39 virtual void RenderFrameCreated(RenderFrameHost* render_frame_host) {} | 38 virtual void RenderFrameCreated(RenderFrameHost* render_frame_host) {} |
| 40 | 39 |
| 41 WebUI* web_ui() const { return web_ui_; } | 40 WebUI* web_ui() const { return web_ui_; } |
| 42 | 41 |
| 43 private: | 42 private: |
| 44 WebUI* web_ui_; | 43 WebUI* web_ui_; |
| 45 }; | 44 }; |
| 46 | 45 |
| 47 } // namespace content | 46 } // namespace content |
| 48 | 47 |
| 49 #endif // CONTENT_PUBLIC_BROWSER_WEB_UI_CONTROLLER_H_ | 48 #endif // CONTENT_PUBLIC_BROWSER_WEB_UI_CONTROLLER_H_ |
| OLD | NEW |