| 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 | 9 |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 // Called by WebContentsImpl when the RenderView is first created. This is | 25 // Called by WebContentsImpl when the RenderView is first created. This is |
| 26 // *not* called for every page load because in some cases | 26 // *not* called for every page load because in some cases |
| 27 // RenderViewHostManager will reuse RenderView instances. | 27 // RenderViewHostManager will reuse RenderView instances. |
| 28 void RenderViewCreated(RenderViewHost* render_view_host); | 28 void RenderViewCreated(RenderViewHost* render_view_host); |
| 29 | 29 |
| 30 // WebUI implementation: | 30 // WebUI implementation: |
| 31 virtual WebContents* GetWebContents() const OVERRIDE; | 31 virtual WebContents* GetWebContents() const OVERRIDE; |
| 32 virtual WebUIController* GetController() const OVERRIDE; | 32 virtual WebUIController* GetController() const OVERRIDE; |
| 33 virtual void SetController(WebUIController* controller) OVERRIDE; | 33 virtual void SetController(WebUIController* controller) OVERRIDE; |
| 34 virtual ui::ScaleFactor GetDeviceScaleFactor() const OVERRIDE; | 34 virtual ui::ScaleFactor GetDeviceScaleFactor() const OVERRIDE; |
| 35 virtual bool ShouldHideFavicon() const OVERRIDE; | |
| 36 virtual void HideFavicon() OVERRIDE; | |
| 37 virtual bool ShouldFocusLocationBarByDefault() const OVERRIDE; | |
| 38 virtual void FocusLocationBarByDefault() OVERRIDE; | |
| 39 virtual bool ShouldHideURL() const OVERRIDE; | |
| 40 virtual void HideURL() OVERRIDE; | |
| 41 virtual const string16& GetOverriddenTitle() const OVERRIDE; | 35 virtual const string16& GetOverriddenTitle() const OVERRIDE; |
| 42 virtual void OverrideTitle(const string16& title) OVERRIDE; | 36 virtual void OverrideTitle(const string16& title) OVERRIDE; |
| 43 virtual PageTransition GetLinkTransitionType() const OVERRIDE; | 37 virtual PageTransition GetLinkTransitionType() const OVERRIDE; |
| 44 virtual void SetLinkTransitionType(PageTransition type) OVERRIDE; | 38 virtual void SetLinkTransitionType(PageTransition type) OVERRIDE; |
| 45 virtual int GetBindings() const OVERRIDE; | 39 virtual int GetBindings() const OVERRIDE; |
| 46 virtual void SetBindings(int bindings) OVERRIDE; | 40 virtual void SetBindings(int bindings) OVERRIDE; |
| 47 virtual void SetFrameXPath(const std::string& xpath) OVERRIDE; | 41 virtual void SetFrameXPath(const std::string& xpath) OVERRIDE; |
| 48 virtual void AddMessageHandler(WebUIMessageHandler* handler) OVERRIDE; | 42 virtual void AddMessageHandler(WebUIMessageHandler* handler) OVERRIDE; |
| 49 typedef base::Callback<void(const base::ListValue*)> MessageCallback; | 43 typedef base::Callback<void(const base::ListValue*)> MessageCallback; |
| 50 virtual void RegisterMessageCallback( | 44 virtual void RegisterMessageCallback( |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 | 78 |
| 85 // Execute a string of raw Javascript on the page. | 79 // Execute a string of raw Javascript on the page. |
| 86 void ExecuteJavascript(const string16& javascript); | 80 void ExecuteJavascript(const string16& javascript); |
| 87 | 81 |
| 88 // A map of message name -> message handling callback. | 82 // A map of message name -> message handling callback. |
| 89 typedef std::map<std::string, MessageCallback> MessageCallbackMap; | 83 typedef std::map<std::string, MessageCallback> MessageCallbackMap; |
| 90 MessageCallbackMap message_callbacks_; | 84 MessageCallbackMap message_callbacks_; |
| 91 | 85 |
| 92 // Options that may be overridden by individual Web UI implementations. The | 86 // Options that may be overridden by individual Web UI implementations. The |
| 93 // bool options default to false. See the public getters for more information. | 87 // bool options default to false. See the public getters for more information. |
| 94 bool hide_favicon_; | |
| 95 bool focus_location_bar_by_default_; | |
| 96 bool should_hide_url_; | |
| 97 string16 overridden_title_; // Defaults to empty string. | 88 string16 overridden_title_; // Defaults to empty string. |
| 98 PageTransition link_transition_type_; // Defaults to LINK. | 89 PageTransition link_transition_type_; // Defaults to LINK. |
| 99 int bindings_; // The bindings from BindingsPolicy that should be enabled for | 90 int bindings_; // The bindings from BindingsPolicy that should be enabled for |
| 100 // this page. | 91 // this page. |
| 101 | 92 |
| 102 // The WebUIMessageHandlers we own. | 93 // The WebUIMessageHandlers we own. |
| 103 std::vector<WebUIMessageHandler*> handlers_; | 94 std::vector<WebUIMessageHandler*> handlers_; |
| 104 | 95 |
| 105 // Non-owning pointer to the WebContents this WebUI is associated with. | 96 // Non-owning pointer to the WebContents this WebUI is associated with. |
| 106 WebContents* web_contents_; | 97 WebContents* web_contents_; |
| 107 | 98 |
| 108 // The path for the iframe this WebUI is embedded in (empty if not in an | 99 // The path for the iframe this WebUI is embedded in (empty if not in an |
| 109 // iframe). | 100 // iframe). |
| 110 std::string frame_xpath_; | 101 std::string frame_xpath_; |
| 111 | 102 |
| 112 scoped_ptr<WebUIController> controller_; | 103 scoped_ptr<WebUIController> controller_; |
| 113 | 104 |
| 114 DISALLOW_COPY_AND_ASSIGN(WebUIImpl); | 105 DISALLOW_COPY_AND_ASSIGN(WebUIImpl); |
| 115 }; | 106 }; |
| 116 | 107 |
| 117 } // namespace content | 108 } // namespace content |
| 118 | 109 |
| 119 #endif // CONTENT_BROWSER_WEBUI_WEB_UI_IMPL_H_ | 110 #endif // CONTENT_BROWSER_WEBUI_WEB_UI_IMPL_H_ |
| OLD | NEW |