Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(194)

Side by Side Diff: content/browser/webui/web_ui.h

Issue 8889041: first cut at uber page (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: mac compile Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/common/url_constants.cc ('k') | content/browser/webui/web_ui.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_H_ 5 #ifndef CONTENT_BROWSER_WEBUI_WEB_UI_H_
6 #define CONTENT_BROWSER_WEBUI_WEB_UI_H_ 6 #define CONTENT_BROWSER_WEBUI_WEB_UI_H_
7 #pragma once 7 #pragma once
8 8
9 #include <map> 9 #include <map>
10 #include <string> 10 #include <string>
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 // Indicates whether RegisterMessageCallback() will overwrite an existing 111 // Indicates whether RegisterMessageCallback() will overwrite an existing
112 // message callback mapping. Serves as the hook for test mocks. 112 // message callback mapping. Serves as the hook for test mocks.
113 bool register_callback_overwrites() const { 113 bool register_callback_overwrites() const {
114 return register_callback_overwrites_; 114 return register_callback_overwrites_;
115 } 115 }
116 116
117 void set_register_callback_overwrites(bool value) { 117 void set_register_callback_overwrites(bool value) {
118 register_callback_overwrites_ = value; 118 register_callback_overwrites_ = value;
119 } 119 }
120 120
121 void set_frame_xpath(const std::string& xpath) {
122 frame_xpath_ = xpath;
123 }
124
121 // Call a Javascript function by sending its name and arguments down to 125 // Call a Javascript function by sending its name and arguments down to
122 // the renderer. This is asynchronous; there's no way to get the result 126 // the renderer. This is asynchronous; there's no way to get the result
123 // of the call, and should be thought of more like sending a message to 127 // of the call, and should be thought of more like sending a message to
124 // the page. 128 // the page.
125 // All function names in WebUI must consist of only ASCII characters. 129 // All function names in WebUI must consist of only ASCII characters.
126 // There are variants for calls with more arguments. 130 // There are variants for calls with more arguments.
127 void CallJavascriptFunction(const std::string& function_name); 131 void CallJavascriptFunction(const std::string& function_name);
128 void CallJavascriptFunction(const std::string& function_name, 132 void CallJavascriptFunction(const std::string& function_name,
129 const base::Value& arg); 133 const base::Value& arg);
130 void CallJavascriptFunction(const std::string& function_name, 134 void CallJavascriptFunction(const std::string& function_name,
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 std::vector<WebUIMessageHandler*> handlers_; 187 std::vector<WebUIMessageHandler*> handlers_;
184 188
185 // Non-owning pointer to the TabContents this WebUI is associated with. 189 // Non-owning pointer to the TabContents this WebUI is associated with.
186 TabContents* tab_contents_; 190 TabContents* tab_contents_;
187 191
188 private: 192 private:
189 // A map of message name -> message handling callback. 193 // A map of message name -> message handling callback.
190 typedef std::map<std::string, MessageCallback> MessageCallbackMap; 194 typedef std::map<std::string, MessageCallback> MessageCallbackMap;
191 MessageCallbackMap message_callbacks_; 195 MessageCallbackMap message_callbacks_;
192 196
197 // The path for the iframe this WebUI is embedded in (empty if not in an
198 // iframe).
199 std::string frame_xpath_;
200
193 DISALLOW_COPY_AND_ASSIGN(WebUI); 201 DISALLOW_COPY_AND_ASSIGN(WebUI);
194 }; 202 };
195 203
196 // Messages sent from the DOM are forwarded via the WebUI to handler 204 // Messages sent from the DOM are forwarded via the WebUI to handler
197 // classes. These objects are owned by WebUI and destroyed when the 205 // classes. These objects are owned by WebUI and destroyed when the
198 // host is destroyed. 206 // host is destroyed.
199 class CONTENT_EXPORT WebUIMessageHandler { 207 class CONTENT_EXPORT WebUIMessageHandler {
200 public: 208 public:
201 WebUIMessageHandler(); 209 WebUIMessageHandler();
202 virtual ~WebUIMessageHandler(); 210 virtual ~WebUIMessageHandler();
(...skipping 25 matching lines...) Expand all
228 // Returns the attached WebUI for this handler. 236 // Returns the attached WebUI for this handler.
229 WebUI* web_ui() const { return web_ui_; } 237 WebUI* web_ui() const { return web_ui_; }
230 238
231 WebUI* web_ui_; // TODO(wyck): Make private after merge conflicts go away. 239 WebUI* web_ui_; // TODO(wyck): Make private after merge conflicts go away.
232 240
233 private: 241 private:
234 DISALLOW_COPY_AND_ASSIGN(WebUIMessageHandler); 242 DISALLOW_COPY_AND_ASSIGN(WebUIMessageHandler);
235 }; 243 };
236 244
237 #endif // CONTENT_BROWSER_WEBUI_WEB_UI_H_ 245 #endif // CONTENT_BROWSER_WEBUI_WEB_UI_H_
OLDNEW
« no previous file with comments | « chrome/common/url_constants.cc ('k') | content/browser/webui/web_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698