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