diff options
author | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-12-13 02:15:33 +0000 |
---|---|---|
committer | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-12-13 02:15:33 +0000 |
commit | 2f18c44fbb5db9fac1cf5f1d0ce6d303940894d2 (patch) | |
tree | b4b09644d3bdd0107042021fa1bfbffd8d0631e7 /content | |
parent | e2cadec89844f232f4b8887e85cfb72182d49107 (diff) | |
download | chromium_src-2f18c44fbb5db9fac1cf5f1d0ce6d303940894d2.zip chromium_src-2f18c44fbb5db9fac1cf5f1d0ce6d303940894d2.tar.gz chromium_src-2f18c44fbb5db9fac1cf5f1d0ce6d303940894d2.tar.bz2 |
first cut at uber page
the subpages are iframes. On the C++ side, the uber WebUI keeps a collection of subpage WebUIs and proxies function calls to them. Calls into JS are directed to the correct iframe by setting a frame name.
The fact it's in an iframe is almost completely transparent to the options page (both from the C++ and JS side); you'll notice there are no changes to any options files.*
*exception: temporary command line changes
BUG=100885
TEST=chrome://uber should have an iframe with chrome://settings in it (fully functional)
Review URL: http://codereview.chromium.org/8889041
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@114152 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content')
-rw-r--r-- | content/browser/webui/web_ui.cc | 4 | ||||
-rw-r--r-- | content/browser/webui/web_ui.h | 8 | ||||
-rw-r--r-- | content/renderer/web_ui_bindings.cc | 2 |
3 files changed, 11 insertions, 3 deletions
diff --git a/content/browser/webui/web_ui.cc b/content/browser/webui/web_ui.cc index 202e755..c8b23a5 100644 --- a/content/browser/webui/web_ui.cc +++ b/content/browser/webui/web_ui.cc @@ -173,8 +173,8 @@ void WebUI::AddMessageHandler(WebUIMessageHandler* handler) { } void WebUI::ExecuteJavascript(const string16& javascript) { - tab_contents_->render_view_host()->ExecuteJavascriptInWebFrame(string16(), - javascript); + tab_contents_->render_view_host()->ExecuteJavascriptInWebFrame( + ASCIIToUTF16(frame_xpath_), javascript); } /////////////////////////////////////////////////////////////////////////////// diff --git a/content/browser/webui/web_ui.h b/content/browser/webui/web_ui.h index 5cba59f..25ea9b6 100644 --- a/content/browser/webui/web_ui.h +++ b/content/browser/webui/web_ui.h @@ -118,6 +118,10 @@ class CONTENT_EXPORT WebUI : public IPC::Channel::Listener { register_callback_overwrites_ = value; } + void set_frame_xpath(const std::string& xpath) { + frame_xpath_ = xpath; + } + // Call a Javascript function by sending its name and arguments down to // the renderer. This is asynchronous; there's no way to get the result // of the call, and should be thought of more like sending a message to @@ -190,6 +194,10 @@ class CONTENT_EXPORT WebUI : public IPC::Channel::Listener { typedef std::map<std::string, MessageCallback> MessageCallbackMap; MessageCallbackMap message_callbacks_; + // The path for the iframe this WebUI is embedded in (empty if not in an + // iframe). + std::string frame_xpath_; + DISALLOW_COPY_AND_ASSIGN(WebUI); }; diff --git a/content/renderer/web_ui_bindings.cc b/content/renderer/web_ui_bindings.cc index 9427a36..7db8b8b3 100644 --- a/content/renderer/web_ui_bindings.cc +++ b/content/renderer/web_ui_bindings.cc @@ -99,7 +99,7 @@ void WebUIBindings::Send(const CppArgumentList& args, CppVariant* result) { } void DOMBoundBrowserObject::SetProperty(const std::string& name, - const std::string& value) { + const std::string& value) { CppVariant* cpp_value = new CppVariant; cpp_value->Set(value); BindProperty(name, cpp_value); |