summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/browser_resources.grd2
-rw-r--r--chrome/browser/resources/options/browser_options.js2
-rw-r--r--chrome/browser/resources/options/language_options.js2
-rw-r--r--chrome/browser/resources/options/personal_options.js8
-rw-r--r--chrome/browser/resources/uber/uber.css10
-rw-r--r--chrome/browser/resources/uber/uber.html19
-rw-r--r--chrome/browser/resources/uber/uber.js6
-rw-r--r--chrome/browser/ui/webui/chrome_web_ui_factory.cc7
-rw-r--r--chrome/browser/ui/webui/uber/uber_ui.cc75
-rw-r--r--chrome/browser/ui/webui/uber/uber_ui.h38
-rw-r--r--chrome/chrome_browser.gypi2
-rw-r--r--chrome/common/url_constants.cc1
-rw-r--r--chrome/common/url_constants.h1
-rw-r--r--content/browser/webui/web_ui.cc4
-rw-r--r--content/browser/webui/web_ui.h8
-rw-r--r--content/renderer/web_ui_bindings.cc2
16 files changed, 176 insertions, 11 deletions
diff --git a/chrome/browser/browser_resources.grd b/chrome/browser/browser_resources.grd
index 34b3d19..71ee450 100644
--- a/chrome/browser/browser_resources.grd
+++ b/chrome/browser/browser_resources.grd
@@ -117,6 +117,8 @@
<include name="IDR_TRACING_HTML" file="resources\tracing.html" flattenhtml="true" allowexternalscript="true" type="BINDATA" />
<include name="IDR_TRACING_JS" file="resources\tracing.js" flattenhtml="true" type="BINDATA" />
<include name="IDR_TRANSLATE_JS" file="resources\translate.js" type="BINDATA" />
+ <include name="IDR_UBER_HTML" file="resources\uber\uber.html" flattenhtml="true" type="BINDATA" />
+ <include name="IDR_UBER_JS" file="resources\uber\uber.js" type="BINDATA" />
<include name="IDR_WEBSTORE_MANIFEST" file="resources\webstore_app\manifest.json" type="BINDATA" />
<include name="IDR_ENTERPRISE_WEBSTORE_MANIFEST" file="resources\enterprise_webstore_app\manifest.json" type="BINDATA" />
<if expr="not pp_ifdef('chromeos')">
diff --git a/chrome/browser/resources/options/browser_options.js b/chrome/browser/resources/options/browser_options.js
index 2ba42d2..ba59d3d 100644
--- a/chrome/browser/resources/options/browser_options.js
+++ b/chrome/browser/resources/options/browser_options.js
@@ -120,7 +120,7 @@ cr.define('options', function() {
startupPagesList.autoExpands = true;
// Check if we are in the guest mode.
- if (cr.commandLine.options['--bwsi']) {
+ if (cr.commandLine && cr.commandLine.options['--bwsi']) {
// Hide the startup section.
$('startupSection').hidden = true;
} else {
diff --git a/chrome/browser/resources/options/language_options.js b/chrome/browser/resources/options/language_options.js
index 7503212..452c61c 100644
--- a/chrome/browser/resources/options/language_options.js
+++ b/chrome/browser/resources/options/language_options.js
@@ -350,7 +350,7 @@ cr.define('options', function() {
} else if (languageCode in templateData.uiLanguageCodeSet) {
// If the language is supported as UI language, users can click on
// the button to change the UI language.
- if (cr.commandLine.options['--bwsi']) {
+ if (cr.commandLine && cr.commandLine.options['--bwsi']) {
// In the guest mode for ChromeOS, changing UI language does not make
// sense because it does not take effect after browser restart.
uiLanguageButton.hidden = true;
diff --git a/chrome/browser/resources/options/personal_options.js b/chrome/browser/resources/options/personal_options.js
index 3a4f0f0..78d40dc 100644
--- a/chrome/browser/resources/options/personal_options.js
+++ b/chrome/browser/resources/options/personal_options.js
@@ -87,7 +87,7 @@ cr.define('options', function() {
chrome.send('coreOptionsUserMetricsAction',
['Options_ShowAutofillSettings']);
};
- if (cr.isChromeOS && cr.commandLine.options['--bwsi']) {
+ if (cr.isChromeOS && cr.commandLine && cr.commandLine.options['--bwsi']) {
// Hide Autofill options for the guest user.
$('autofill-section').hidden = true;
}
@@ -118,7 +118,7 @@ cr.define('options', function() {
};
this.updateAccountPicture_();
- if (cr.commandLine.options['--bwsi']) {
+ if (cr.commandLine && cr.commandLine.options['--bwsi']) {
// Disable the screen lock checkbox and change-picture-button in
// guest mode.
$('enable-screen-lock').disabled = true;
@@ -317,7 +317,7 @@ cr.define('options', function() {
* @return {boolean} True if password management should be disabled.
*/
PersonalOptions.disablePasswordManagement = function() {
- return cr.commandLine.options['--bwsi'];
+ return cr.commandLine && cr.commandLine.options['--bwsi'];
};
/**
@@ -325,7 +325,7 @@ cr.define('options', function() {
* @return {boolean} True if password management should be disabled.
*/
PersonalOptions.disableAutofillManagement = function() {
- return cr.commandLine.options['--bwsi'];
+ return cr.commandLine && cr.commandLine.options['--bwsi'];
};
if (cr.isChromeOS) {
diff --git a/chrome/browser/resources/uber/uber.css b/chrome/browser/resources/uber/uber.css
new file mode 100644
index 0000000..684205e
--- /dev/null
+++ b/chrome/browser/resources/uber/uber.css
@@ -0,0 +1,10 @@
+/* Copyright (c) 2011 The Chromium Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file. */
+
+iframe {
+ border: 1px solid red;
+ height: 500px;
+ margin-bottom: 50px;
+ width: 100%;
+}
diff --git a/chrome/browser/resources/uber/uber.html b/chrome/browser/resources/uber/uber.html
new file mode 100644
index 0000000..2cd563e
--- /dev/null
+++ b/chrome/browser/resources/uber/uber.html
@@ -0,0 +1,19 @@
+<!DOCTYPE html>
+<html i18n-values="dir:textdirection;">
+<head>
+<meta charset="utf-8">
+<title i18n-content="pageTitle"></title>
+
+<link rel="stylesheet" href="uber.css">
+
+<script src="chrome://uber/uber.js"></script>
+<script src="chrome://resources/js/command_line.js"></script>
+<script src="chrome://resources/js/util.js"></script>
+</head>
+
+<body>
+
+<iframe id="settings" src="chrome://settings"></iframe>
+
+</body>
+</html>
diff --git a/chrome/browser/resources/uber/uber.js b/chrome/browser/resources/uber/uber.js
new file mode 100644
index 0000000..4e740dc
--- /dev/null
+++ b/chrome/browser/resources/uber/uber.js
@@ -0,0 +1,6 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+window.onload = function() {
+}
diff --git a/chrome/browser/ui/webui/chrome_web_ui_factory.cc b/chrome/browser/ui/webui/chrome_web_ui_factory.cc
index 749bd33..ab2a18a 100644
--- a/chrome/browser/ui/webui/chrome_web_ui_factory.cc
+++ b/chrome/browser/ui/webui/chrome_web_ui_factory.cc
@@ -41,6 +41,7 @@
#include "chrome/browser/ui/webui/sync_internals_ui.h"
#include "chrome/browser/ui/webui/test_chrome_web_ui_factory.h"
#include "chrome/browser/ui/webui/tracing_ui.h"
+#include "chrome/browser/ui/webui/uber/uber_ui.h"
#include "chrome/browser/ui/webui/workers_ui.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/extensions/extension_constants.h"
@@ -196,6 +197,8 @@ WebUIFactoryFunction GetWebUIFactoryFunction(TabContents* tab_contents,
#endif
if (url.host() == chrome::kChromeUIPluginsHost)
return &NewWebUI<PluginsUI>;
+ if (url.host() == chrome::kChromeUIProfilerHost)
+ return &NewWebUI<ProfilerUI>;
if (url.host() == chrome::kChromeUIQuotaInternalsHost)
return &NewWebUI<QuotaInternalsUI>;
if (url.host() == chrome::kChromeUISSLClientCertificateSelectorHost)
@@ -210,8 +213,8 @@ WebUIFactoryFunction GetWebUIFactoryFunction(TabContents* tab_contents,
return &NewWebUI<TaskManagerUI>;
if (url.host() == chrome::kChromeUITracingHost)
return &NewWebUI<TracingUI>;
- if (url.host() == chrome::kChromeUIProfilerHost)
- return &NewWebUI<ProfilerUI>;
+ if (url.host() == chrome::kChromeUIUberHost)
+ return &NewWebUI<UberUI>;
if (url.host() == chrome::kChromeUIWorkersHost)
return &NewWebUI<WorkersUI>;
diff --git a/chrome/browser/ui/webui/uber/uber_ui.cc b/chrome/browser/ui/webui/uber/uber_ui.cc
new file mode 100644
index 0000000..8503112
--- /dev/null
+++ b/chrome/browser/ui/webui/uber/uber_ui.cc
@@ -0,0 +1,75 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/ui/webui/uber/uber_ui.h"
+
+#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/ui/webui/chrome_url_data_manager.h"
+#include "chrome/browser/ui/webui/chrome_web_ui_data_source.h"
+#include "chrome/browser/ui/webui/options/options_ui.h"
+#include "chrome/common/url_constants.h"
+#include "content/browser/tab_contents/tab_contents.h"
+#include "grit/browser_resources.h"
+
+namespace {
+
+ChromeWebUIDataSource* CreateUberHTMLSource() {
+ ChromeWebUIDataSource* source =
+ new ChromeWebUIDataSource(chrome::kChromeUIUberHost);
+
+ source->set_json_path("strings.js");
+ source->add_resource_path("uber.js", IDR_UBER_JS);
+ source->set_default_resource(IDR_UBER_HTML);
+ return source;
+}
+
+} // namespace
+
+UberUI::UberUI(TabContents* contents) : ChromeWebUI(contents) {
+ Profile* profile = Profile::FromBrowserContext(contents->browser_context());
+ profile->GetChromeURLDataManager()->AddDataSource(CreateUberHTMLSource());
+
+ ChromeWebUI* options = new OptionsUI(contents);
+ options->set_frame_xpath("//iframe[@id='settings']");
+ sub_uis_.push_back(options);
+}
+
+UberUI::~UberUI() {
+}
+
+void UberUI::RenderViewCreated(RenderViewHost* render_view_host) {
+ for (size_t i = 0; i < sub_uis_.size(); i++) {
+ sub_uis_[i]->RenderViewCreated(render_view_host);
+ }
+
+ ChromeWebUI::RenderViewCreated(render_view_host);
+}
+
+void UberUI::RenderViewReused(RenderViewHost* render_view_host) {
+ for (size_t i = 0; i < sub_uis_.size(); i++) {
+ sub_uis_[i]->RenderViewReused(render_view_host);
+ }
+
+ ChromeWebUI::RenderViewReused(render_view_host);
+}
+
+void UberUI::DidBecomeActiveForReusedRenderView() {
+ for (size_t i = 0; i < sub_uis_.size(); i++) {
+ sub_uis_[i]->DidBecomeActiveForReusedRenderView();
+ }
+
+ ChromeWebUI::DidBecomeActiveForReusedRenderView();
+}
+
+void UberUI::OnWebUISend(const GURL& source_url,
+ const std::string& message,
+ const ListValue& args) {
+ // TODO(estade): This should only send the message to the appropriate
+ // subpage (if any), not all of them.
+ for (size_t i = 0; i < sub_uis_.size(); i++) {
+ sub_uis_[i]->OnWebUISend(source_url, message, args);
+ }
+
+ ChromeWebUI::OnWebUISend(source_url, message, args);
+}
diff --git a/chrome/browser/ui/webui/uber/uber_ui.h b/chrome/browser/ui/webui/uber/uber_ui.h
new file mode 100644
index 0000000..546c608
--- /dev/null
+++ b/chrome/browser/ui/webui/uber/uber_ui.h
@@ -0,0 +1,38 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_UI_WEBUI_UBER_UBER_UI_H_
+#define CHROME_BROWSER_UI_WEBUI_UBER_UBER_UI_H_
+#pragma once
+
+#include <string>
+
+#include "base/memory/scoped_vector.h"
+#include "base/values.h"
+#include "chrome/browser/ui/webui/chrome_web_ui.h"
+
+// The ChromeWebUI class for the uber page (chrome://chrome). It manages the
+// UI for the uber page (navigation bar and so forth) as well as ChromeWebUI
+// objects for pages that appear in the uber page.
+class UberUI : public ChromeWebUI {
+ public:
+ explicit UberUI(TabContents* contents);
+ virtual ~UberUI();
+
+ // ChromeWebUI implementation.
+ virtual void OnWebUISend(const GURL& source_url,
+ const std::string& message,
+ const ListValue& args) OVERRIDE;
+
+ // We forward these to |sub_uis_|.
+ virtual void RenderViewCreated(RenderViewHost* render_view_host) OVERRIDE;
+ virtual void RenderViewReused(RenderViewHost* render_view_host) OVERRIDE;
+ virtual void DidBecomeActiveForReusedRenderView() OVERRIDE;
+
+ private:
+ // Collection of WebUIs for the subpages within uber.
+ ScopedVector<ChromeWebUI> sub_uis_;
+};
+
+#endif // CHROME_BROWSER_UI_WEBUI_UBER_UBER_UI_H_
diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi
index ee1bd38..bc6ec65 100644
--- a/chrome/chrome_browser.gypi
+++ b/chrome/chrome_browser.gypi
@@ -3960,6 +3960,8 @@
'browser/ui/webui/theme_source.h',
'browser/ui/webui/tracing_ui.cc',
'browser/ui/webui/tracing_ui.h',
+ 'browser/ui/webui/uber/uber_ui.cc',
+ 'browser/ui/webui/uber/uber_ui.h',
'browser/ui/webui/user_selectable_sync_type.h',
'browser/ui/webui/web_ui_util.cc',
'browser/ui/webui/web_ui_util.h',
diff --git a/chrome/common/url_constants.cc b/chrome/common/url_constants.cc
index e7b8839..8b176e5 100644
--- a/chrome/common/url_constants.cc
+++ b/chrome/common/url_constants.cc
@@ -180,6 +180,7 @@ const char kChromeUITermsHost[] = "terms";
const char kChromeUIThumbnailHost[] = "thumb";
const char kChromeUITouchIconHost[] = "touch-icon";
const char kChromeUITracingHost[] = "tracing";
+const char kChromeUIUberHost[] = "chrome";
const char kChromeUIVersionHost[] = "version";
const char kChromeUIWorkersHost[] = "workers";
diff --git a/chrome/common/url_constants.h b/chrome/common/url_constants.h
index 5e50741..d7ba083 100644
--- a/chrome/common/url_constants.h
+++ b/chrome/common/url_constants.h
@@ -172,6 +172,7 @@ extern const char kChromeUITermsHost[];
extern const char kChromeUIThumbnailHost[];
extern const char kChromeUITouchIconHost[];
extern const char kChromeUITracingHost[];
+extern const char kChromeUIUberHost[];
extern const char kChromeUIVersionHost[];
extern const char kChromeUIWorkersHost[];
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);