| 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_BROWSER_WEBUI_WEB_UI_IMPL_H_ | 5 #ifndef CONTENT_BROWSER_WEBUI_WEB_UI_IMPL_H_ |
| 6 #define CONTENT_BROWSER_WEBUI_WEB_UI_IMPL_H_ | 6 #define CONTENT_BROWSER_WEBUI_WEB_UI_IMPL_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <set> | 10 #include <set> |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 // Called when the owning RenderFrameHost has started swapping out. | 39 // Called when the owning RenderFrameHost has started swapping out. |
| 40 void RenderFrameHostSwappingOut(); | 40 void RenderFrameHostSwappingOut(); |
| 41 | 41 |
| 42 // WebUI implementation: | 42 // WebUI implementation: |
| 43 WebContents* GetWebContents() const override; | 43 WebContents* GetWebContents() const override; |
| 44 WebUIController* GetController() const override; | 44 WebUIController* GetController() const override; |
| 45 void SetController(WebUIController* controller) override; | 45 void SetController(WebUIController* controller) override; |
| 46 float GetDeviceScaleFactor() const override; | 46 float GetDeviceScaleFactor() const override; |
| 47 const base::string16& GetOverriddenTitle() const override; | 47 const base::string16& GetOverriddenTitle() const override; |
| 48 void OverrideTitle(const base::string16& title) override; | 48 void OverrideTitle(const base::string16& title) override; |
| 49 ui::PageTransition GetLinkTransitionType() const override; | |
| 50 void SetLinkTransitionType(ui::PageTransition type) override; | |
| 51 int GetBindings() const override; | 49 int GetBindings() const override; |
| 52 void SetBindings(int bindings) override; | 50 void SetBindings(int bindings) override; |
| 53 bool HasRenderFrame() override; | 51 bool HasRenderFrame() override; |
| 54 void AddMessageHandler(WebUIMessageHandler* handler) override; | 52 void AddMessageHandler(WebUIMessageHandler* handler) override; |
| 55 typedef base::Callback<void(const base::ListValue*)> MessageCallback; | 53 typedef base::Callback<void(const base::ListValue*)> MessageCallback; |
| 56 void RegisterMessageCallback(const std::string& message, | 54 void RegisterMessageCallback(const std::string& message, |
| 57 const MessageCallback& callback) override; | 55 const MessageCallback& callback) override; |
| 58 void ProcessWebUIMessage(const GURL& source_url, | 56 void ProcessWebUIMessage(const GURL& source_url, |
| 59 const std::string& message, | 57 const std::string& message, |
| 60 const base::ListValue& args) override; | 58 const base::ListValue& args) override; |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 // Called internally and by the owned MainFrameNavigationObserver. | 104 // Called internally and by the owned MainFrameNavigationObserver. |
| 107 void DisallowJavascriptOnAllHandlers(); | 105 void DisallowJavascriptOnAllHandlers(); |
| 108 | 106 |
| 109 // A map of message name -> message handling callback. | 107 // A map of message name -> message handling callback. |
| 110 typedef std::map<std::string, MessageCallback> MessageCallbackMap; | 108 typedef std::map<std::string, MessageCallback> MessageCallbackMap; |
| 111 MessageCallbackMap message_callbacks_; | 109 MessageCallbackMap message_callbacks_; |
| 112 | 110 |
| 113 // Options that may be overridden by individual Web UI implementations. The | 111 // Options that may be overridden by individual Web UI implementations. The |
| 114 // bool options default to false. See the public getters for more information. | 112 // bool options default to false. See the public getters for more information. |
| 115 base::string16 overridden_title_; // Defaults to empty string. | 113 base::string16 overridden_title_; // Defaults to empty string. |
| 116 ui::PageTransition link_transition_type_; // Defaults to LINK. | |
| 117 int bindings_; // The bindings from BindingsPolicy that should be enabled for | 114 int bindings_; // The bindings from BindingsPolicy that should be enabled for |
| 118 // this page. | 115 // this page. |
| 119 | 116 |
| 120 // The WebUIMessageHandlers we own. | 117 // The WebUIMessageHandlers we own. |
| 121 ScopedVector<WebUIMessageHandler> handlers_; | 118 ScopedVector<WebUIMessageHandler> handlers_; |
| 122 | 119 |
| 123 // Non-owning pointer to the WebContents this WebUI is associated with. | 120 // Non-owning pointer to the WebContents this WebUI is associated with. |
| 124 WebContents* web_contents_; | 121 WebContents* web_contents_; |
| 125 | 122 |
| 126 // Notifies this WebUI about notifications in the main frame. | 123 // Notifies this WebUI about notifications in the main frame. |
| 127 std::unique_ptr<MainFrameNavigationObserver> web_contents_observer_; | 124 std::unique_ptr<MainFrameNavigationObserver> web_contents_observer_; |
| 128 | 125 |
| 129 // The name of the frame this WebUI is embedded in. If empty, the main frame | 126 // The name of the frame this WebUI is embedded in. If empty, the main frame |
| 130 // is used. | 127 // is used. |
| 131 const std::string frame_name_; | 128 const std::string frame_name_; |
| 132 | 129 |
| 133 std::unique_ptr<WebUIController> controller_; | 130 std::unique_ptr<WebUIController> controller_; |
| 134 | 131 |
| 135 DISALLOW_COPY_AND_ASSIGN(WebUIImpl); | 132 DISALLOW_COPY_AND_ASSIGN(WebUIImpl); |
| 136 }; | 133 }; |
| 137 | 134 |
| 138 } // namespace content | 135 } // namespace content |
| 139 | 136 |
| 140 #endif // CONTENT_BROWSER_WEBUI_WEB_UI_IMPL_H_ | 137 #endif // CONTENT_BROWSER_WEBUI_WEB_UI_IMPL_H_ |
| OLD | NEW |