summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorxiyuan@chromium.org <xiyuan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-22 02:27:56 +0000
committerxiyuan@chromium.org <xiyuan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-22 02:27:56 +0000
commit942af4a00aa6dc8bee3c13c0ed0c00df0be32a6e (patch)
tree6e9e58dc332dddec021b6e3867e41e920166efec /chrome
parent565e159ad8f6ff08259e7ee1e5ada11f3aa07d84 (diff)
downloadchromium_src-942af4a00aa6dc8bee3c13c0ed0c00df0be32a6e.zip
chromium_src-942af4a00aa6dc8bee3c13c0ed0c00df0be32a6e.tar.gz
chromium_src-942af4a00aa6dc8bee3c13c0ed0c00df0be32a6e.tar.bz2
[ChromeOS] Split proxy settings into its own webui.
BUG=chromium-os:11234 TEST=Verify proxy settings on OOBE and settings page work as expected. Review URL: http://codereview.chromium.org/6685092 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@78962 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/browser_resources.grd1
-rw-r--r--chrome/browser/chromeos/login/proxy_settings_dialog.cc13
-rw-r--r--chrome/browser/chromeos/webui/core_chromeos_options_handler.h2
-rw-r--r--chrome/browser/chromeos/webui/proxy_settings_ui.cc105
-rw-r--r--chrome/browser/chromeos/webui/proxy_settings_ui.h31
-rw-r--r--chrome/browser/resources/chromeos/proxy_settings.html31
-rw-r--r--chrome/browser/resources/chromeos/proxy_settings.js59
-rw-r--r--chrome/browser/resources/options/chromeos_proxy_options.js19
-rw-r--r--chrome/browser/ui/webui/options/core_options_handler.cc7
-rw-r--r--chrome/browser/ui/webui/options/core_options_handler.h5
-rw-r--r--chrome/browser/ui/webui/options/options_ui.cc28
-rw-r--r--chrome/browser/ui/webui/options/options_ui.h41
-rw-r--r--chrome/chrome_browser.gypi2
-rw-r--r--chrome/common/url_constants.cc2
-rw-r--r--chrome/common/url_constants.h2
15 files changed, 306 insertions, 42 deletions
diff --git a/chrome/browser/browser_resources.grd b/chrome/browser/browser_resources.grd
index 9e95704..d4be682 100644
--- a/chrome/browser/browser_resources.grd
+++ b/chrome/browser/browser_resources.grd
@@ -107,6 +107,7 @@ without changes to the corresponding grd file. etaa -->
<include name="IDR_NOTIFICATION_ICON_LINK_HTML" file="resources\notification_icon_link.html" type="BINDATA" />
<include name="IDR_OFFLINE_LOAD_HTML" file="resources\offline_load.html" flattenhtml="true" type="BINDATA" />
<include name="IDR_OS_CREDITS_HTML" file="resources\about_os_credits.html" flattenhtml="true" type="BINDATA" />
+ <include name="IDR_PROXY_SETTINGS_HTML" file="resources\chromeos\proxy_settings.html" flattenhtml="true" type="BINDATA" />
<include name="IDR_SLIDESHOW_HTML" file="resources\slideshow.html" flattenhtml="true" type="BINDATA" />
<include name="IDR_MENU_HTML" file="resources\menu.html" flattenhtml="true" type="BINDATA" />
<include name="IDR_NETWORK_MENU_CSS" file="resources\network_menu.css" flattenhtml="true" type="BINDATA" />
diff --git a/chrome/browser/chromeos/login/proxy_settings_dialog.cc b/chrome/browser/chromeos/login/proxy_settings_dialog.cc
index 1b9ad8f..b1c2f68 100644
--- a/chrome/browser/chromeos/login/proxy_settings_dialog.cc
+++ b/chrome/browser/chromeos/login/proxy_settings_dialog.cc
@@ -1,10 +1,11 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// 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/chromeos/login/proxy_settings_dialog.h"
#include "chrome/browser/chromeos/login/helper.h"
+#include "chrome/common/url_constants.h"
#include "ui/gfx/rect.h"
#include "ui/gfx/size.h"
@@ -16,9 +17,7 @@ const int kProxySettingsDialogReasonableHeight = 550;
const float kProxySettingsDialogReasonableWidthRatio = 0.4f;
const float kProxySettingsDialogReasonableHeightRatio = 0.4f;
-const char kProxySettingsURL[] = "chrome://settings/proxy?menu=off";
-
-int calculate_size(int screen_size, int min_comfortable, float desired_ratio) {
+int CalculateSize(int screen_size, int min_comfortable, float desired_ratio) {
int desired_size = static_cast<int>(desired_ratio * screen_size);
desired_size = std::max(min_comfortable, desired_size);
return std::min(screen_size, desired_size);
@@ -34,13 +33,13 @@ ProxySettingsDialog::ProxySettingsDialog(LoginHtmlDialog::Delegate* delegate,
delegate,
window,
std::wstring(),
- GURL(kProxySettingsURL),
+ GURL(chrome::kChromeUIProxySettingsURL),
LoginHtmlDialog::STYLE_BUBBLE) {
gfx::Rect screen_bounds(chromeos::CalculateScreenBounds(gfx::Size()));
- SetDialogSize(calculate_size(screen_bounds.width(),
+ SetDialogSize(CalculateSize(screen_bounds.width(),
kProxySettingsDialogReasonableWidth,
kProxySettingsDialogReasonableWidthRatio),
- calculate_size(screen_bounds.height(),
+ CalculateSize(screen_bounds.height(),
kProxySettingsDialogReasonableHeight,
kProxySettingsDialogReasonableHeightRatio));
}
diff --git a/chrome/browser/chromeos/webui/core_chromeos_options_handler.h b/chrome/browser/chromeos/webui/core_chromeos_options_handler.h
index 0b2b826..a87b219 100644
--- a/chrome/browser/chromeos/webui/core_chromeos_options_handler.h
+++ b/chrome/browser/chromeos/webui/core_chromeos_options_handler.h
@@ -11,7 +11,7 @@
namespace chromeos {
// CoreChromeOSOptionsHandler handles ChromeOS settings.
-class CoreChromeOSOptionsHandler : public ::CoreOptionsHandler {
+class CoreChromeOSOptionsHandler : public CoreOptionsHandler {
public:
CoreChromeOSOptionsHandler();
diff --git a/chrome/browser/chromeos/webui/proxy_settings_ui.cc b/chrome/browser/chromeos/webui/proxy_settings_ui.cc
new file mode 100644
index 0000000..a8ccc19
--- /dev/null
+++ b/chrome/browser/chromeos/webui/proxy_settings_ui.cc
@@ -0,0 +1,105 @@
+// 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/chromeos/webui/proxy_settings_ui.h"
+
+#include "base/message_loop.h"
+#include "base/scoped_ptr.h"
+#include "base/values.h"
+#include "chrome/browser/chromeos/webui/core_chromeos_options_handler.h"
+#include "chrome/browser/chromeos/webui/proxy_handler.h"
+#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/ui/webui/chrome_url_data_manager.h"
+#include "chrome/common/jstemplate_builder.h"
+#include "chrome/common/url_constants.h"
+#include "content/browser/tab_contents/tab_contents.h"
+#include "grit/browser_resources.h"
+#include "ui/base/resource/resource_bundle.h"
+
+namespace {
+
+class ProxySettingsHTMLSource : public ChromeURLDataManager::DataSource {
+ public:
+ explicit ProxySettingsHTMLSource(DictionaryValue* localized_strings);
+
+ // Called when the network layer has requested a resource underneath
+ // the path we registered.
+ virtual void StartDataRequest(const std::string& path,
+ bool is_off_the_record,
+ int request_id);
+ virtual std::string GetMimeType(const std::string&) const {
+ return "text/html";
+ }
+
+ private:
+ scoped_ptr<DictionaryValue> localized_strings_;
+
+ DISALLOW_COPY_AND_ASSIGN(ProxySettingsHTMLSource);
+};
+
+ProxySettingsHTMLSource::ProxySettingsHTMLSource(
+ DictionaryValue* localized_strings)
+ : DataSource(chrome::kChromeUIProxySettingsHost, MessageLoop::current()),
+ localized_strings_(localized_strings) {
+}
+
+void ProxySettingsHTMLSource::StartDataRequest(const std::string& path,
+ bool is_off_the_record,
+ int request_id) {
+ SetFontAndTextDirection(localized_strings_.get());
+
+ static const base::StringPiece html(
+ ResourceBundle::GetSharedInstance().GetRawDataResource(
+ IDR_PROXY_SETTINGS_HTML));
+ const std::string full_html = jstemplate_builder::GetI18nTemplateHtml(
+ html, localized_strings_.get());
+
+ scoped_refptr<RefCountedBytes> html_bytes(new RefCountedBytes);
+ html_bytes->data.resize(full_html.size());
+ std::copy(full_html.begin(), full_html.end(), html_bytes->data.begin());
+
+ SendResponse(request_id, html_bytes);
+}
+
+} // namespace
+
+namespace chromeos {
+
+ProxySettingsUI::ProxySettingsUI(TabContents* contents) : WebUI(contents) {
+ // |localized_strings| will be owned by ProxySettingsHTMLSource.
+ DictionaryValue* localized_strings = new DictionaryValue();
+
+ CoreChromeOSOptionsHandler* core_handler = new CoreChromeOSOptionsHandler();
+ core_handler->set_handlers_host(this);
+ core_handler->GetLocalizedValues(localized_strings);
+ AddMessageHandler(core_handler->Attach(this));
+
+ OptionsPageUIHandler* proxy_handler = new ProxyHandler();
+ proxy_handler->GetLocalizedValues(localized_strings);
+ AddMessageHandler(proxy_handler->Attach(this));
+
+ ProxySettingsHTMLSource* source =
+ new ProxySettingsHTMLSource(localized_strings);
+ contents->profile()->GetChromeURLDataManager()->AddDataSource(source);
+}
+
+ProxySettingsUI::~ProxySettingsUI() {
+ // Uninitialize all registered handlers. The base class owns them and it will
+ // eventually delete them. Skip over the generic handler.
+ for (std::vector<WebUIMessageHandler*>::iterator iter = handlers_.begin() + 1;
+ iter != handlers_.end();
+ ++iter) {
+ static_cast<OptionsPageUIHandler*>(*iter)->Uninitialize();
+ }
+}
+
+void ProxySettingsUI::InitializeHandlers() {
+ std::vector<WebUIMessageHandler*>::iterator iter;
+ // Skip over the generic handler.
+ for (iter = handlers_.begin() + 1; iter != handlers_.end(); ++iter) {
+ (static_cast<OptionsPageUIHandler*>(*iter))->Initialize();
+ }
+}
+
+} // namespace chromeos
diff --git a/chrome/browser/chromeos/webui/proxy_settings_ui.h b/chrome/browser/chromeos/webui/proxy_settings_ui.h
new file mode 100644
index 0000000..edfff1e
--- /dev/null
+++ b/chrome/browser/chromeos/webui/proxy_settings_ui.h
@@ -0,0 +1,31 @@
+// 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_CHROMEOS_WEBUI_PROXY_SETTINGS_UI_H_
+#define CHROME_BROWSER_CHROMEOS_WEBUI_PROXY_SETTINGS_UI_H_
+#pragma once
+
+#include "content/browser/webui/web_ui.h"
+#include "chrome/browser/ui/webui/options/options_ui.h"
+
+namespace chromeos {
+
+// A WebUI to host proxy settings splitted from settings page for better
+// performance.
+class ProxySettingsUI : public WebUI,
+ public OptionsPageUIHandlerHost {
+ public:
+ explicit ProxySettingsUI(TabContents* contents);
+ virtual ~ProxySettingsUI();
+
+ private:
+ // Overridden from OptionsPageUIHandlerHost:
+ virtual void InitializeHandlers() OVERRIDE;
+
+ DISALLOW_COPY_AND_ASSIGN(ProxySettingsUI);
+};
+
+} // namespace chromeos
+
+#endif // CHROME_BROWSER_CHROMEOS_WEBUI_PROXY_SETTINGS_UI_H_
diff --git a/chrome/browser/resources/chromeos/proxy_settings.html b/chrome/browser/resources/chromeos/proxy_settings.html
new file mode 100644
index 0000000..5186ede
--- /dev/null
+++ b/chrome/browser/resources/chromeos/proxy_settings.html
@@ -0,0 +1,31 @@
+<!DOCTYPE HTML>
+<html i18n-values="dir:textdirection">
+<head>
+<link rel="stylesheet" href="chrome://resources/css/list.css">
+<link rel="stylesheet" href="../webui.css">
+<link rel="stylesheet" href="../options/options_page.css">
+<link rel="stylesheet" href="../options/chromeos_proxy.css">
+
+<script src="chrome://resources/js/cr.js"></script>
+<script src="chrome://resources/js/cr/event_target.js"></script>
+<script src="chrome://resources/js/cr/ui.js"></script>
+<script src="chrome://resources/js/cr/ui/array_data_model.js"></script>
+<script src="chrome://resources/js/cr/ui/list_selection_model.js"></script>
+<script src="chrome://resources/js/cr/ui/list_selection_controller.js"></script>
+<script src="chrome://resources/js/cr/ui/list_single_selection_model.js"></script>
+<script src="chrome://resources/js/cr/ui/list_item.js"></script>
+<script src="chrome://resources/js/cr/ui/list.js"></script>
+<script src="chrome://resources/js/local_strings.js"></script>
+<script src="chrome://resources/js/util.js"></script>
+<script src="../options/preferences.js"></script>
+<script src="../options/pref_ui.js"></script>
+<script src="../options/options_page.js"></script>
+<script src="../options/chromeos_proxy_options.js"></script>
+<script src="../options/chromeos_proxy_rules_list.js"></script>
+<script src="proxy_settings.js"></script>
+</head>
+
+<body i18n-values=".style.fontFamily:fontfamily;">
+<include src="../options/chromeos_proxy.html">
+</body>
+</html>
diff --git a/chrome/browser/resources/chromeos/proxy_settings.js b/chrome/browser/resources/chromeos/proxy_settings.js
new file mode 100644
index 0000000..902cf7f
--- /dev/null
+++ b/chrome/browser/resources/chromeos/proxy_settings.js
@@ -0,0 +1,59 @@
+// 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.
+
+var OptionsPage = options.OptionsPage;
+var Preferences = options.Preferences;
+var ProxyOptions = options.ProxyOptions;
+
+/**
+ * UI pref change handler.
+ */
+function handlePrefUpdate(e) {
+ ProxyOptions.getInstance().updateControls();
+}
+
+/**
+ * Monitor pref change of given element.
+ */
+function observePrefsUI(el) {
+ Preferences.getInstance().addEventListener(el.pref, handlePrefUpdate);
+}
+
+/**
+ * DOMContentLoaded handler, sets up the page.
+ */
+function load() {
+ localStrings = new LocalStrings();
+
+ if (cr.isChromeOS)
+ document.documentElement.setAttribute('os', 'chromeos');
+
+ // Decorate the existing elements in the document.
+ cr.ui.decorate('input[pref][type=checkbox]', options.PrefCheckbox);
+ cr.ui.decorate('input[pref][type=number]', options.PrefNumber);
+ cr.ui.decorate('input[pref][type=radio]', options.PrefRadio);
+ cr.ui.decorate('input[pref][type=range]', options.PrefRange);
+ cr.ui.decorate('select[pref]', options.PrefSelect);
+ cr.ui.decorate('input[pref][type=text]', options.PrefTextField);
+ cr.ui.decorate('input[pref][type=url]', options.PrefTextField);
+ ProxyOptions.getInstance().initializePage();
+
+ Preferences.getInstance().initialize();
+ chrome.send('coreOptionsInitialize');
+
+ ProxyOptions.getInstance().visible = true;
+
+ // Monitor pref change on the following elements because proxy page updates
+ // UI state on visibility change. This works fine as an overlay in settings
+ // page. But in the splitted webui, the UI becomes visible when the page
+ // loads and the pref values are not fetched at this point. So we need to
+ // monitor and update UI states when the pref values are fetched.
+ observePrefsUI($('directProxy'));
+ observePrefsUI($('manualProxy'));
+ observePrefsUI($('autoProxy'));
+ observePrefsUI($('proxyAllProtocols'));
+}
+
+document.addEventListener('DOMContentLoaded', load);
+
diff --git a/chrome/browser/resources/options/chromeos_proxy_options.js b/chrome/browser/resources/options/chromeos_proxy_options.js
index b1e7f16..bfebaab 100644
--- a/chrome/browser/resources/options/chromeos_proxy_options.js
+++ b/chrome/browser/resources/options/chromeos_proxy_options.js
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// 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.
@@ -51,11 +51,10 @@ cr.define('options', function() {
proxyListInitalized_: false,
/**
- * Handler for OptionsPage's visible property change event.
- * @private
- * @param {Event} e Property change event.
+ * Update controls state.
+ * @public
*/
- handleVisibleChange_: function(e) {
+ updateControls: function() {
this.toggleSingle_();
if ($('manualProxy').checked) {
this.enableManual_();
@@ -69,6 +68,15 @@ cr.define('options', function() {
},
/**
+ * Handler for OptionsPage's visible property change event.
+ * @private
+ * @param {Event} e Property change event.
+ */
+ handleVisibleChange_: function(e) {
+ this.updateControls();
+ },
+
+ /**
* Handler for when the user clicks on the checkbox to allow a
* single proxy usage.
* @private
@@ -130,6 +138,7 @@ cr.define('options', function() {
$('removeHost').disabled = false;
$('addHost').disabled = false;
$('advancedConfig').style.display = '-webkit-box';
+ $('ignoredHostList').redraw();
},
/**
diff --git a/chrome/browser/ui/webui/options/core_options_handler.cc b/chrome/browser/ui/webui/options/core_options_handler.cc
index 49ee92b..74e545a 100644
--- a/chrome/browser/ui/webui/options/core_options_handler.cc
+++ b/chrome/browser/ui/webui/options/core_options_handler.cc
@@ -24,7 +24,9 @@
#include "grit/theme_resources.h"
#include "ui/base/l10n/l10n_util.h"
-CoreOptionsHandler::CoreOptionsHandler() {}
+CoreOptionsHandler::CoreOptionsHandler()
+ : handlers_host_(NULL) {
+}
CoreOptionsHandler::~CoreOptionsHandler() {}
@@ -115,7 +117,8 @@ void CoreOptionsHandler::RegisterMessages() {
}
void CoreOptionsHandler::HandleInitialize(const ListValue* args) {
- static_cast<OptionsUI*>(web_ui_)->InitializeHandlers();
+ DCHECK(handlers_host_);
+ handlers_host_->InitializeHandlers();
}
Value* CoreOptionsHandler::FetchPref(const std::string& pref_name) {
diff --git a/chrome/browser/ui/webui/options/core_options_handler.h b/chrome/browser/ui/webui/options/core_options_handler.h
index 0b9aef0..36a2355 100644
--- a/chrome/browser/ui/webui/options/core_options_handler.h
+++ b/chrome/browser/ui/webui/options/core_options_handler.h
@@ -33,6 +33,10 @@ class CoreOptionsHandler : public OptionsPageUIHandler {
virtual void RegisterMessages();
virtual WebUIMessageHandler* Attach(WebUI* web_ui);
+ void set_handlers_host(OptionsPageUIHandlerHost* handlers_host) {
+ handlers_host_ = handlers_host;
+ }
+
protected:
// Fetches a pref value of given |pref_name|.
// Note that caller owns the returned Value.
@@ -100,6 +104,7 @@ class CoreOptionsHandler : public OptionsPageUIHandler {
void NotifyPrefChanged(const std::string* pref_name);
+ OptionsPageUIHandlerHost* handlers_host_;
PrefChangeRegistrar registrar_;
DISALLOW_COPY_AND_ASSIGN(CoreOptionsHandler);
diff --git a/chrome/browser/ui/webui/options/options_ui.cc b/chrome/browser/ui/webui/options/options_ui.cc
index eae3d63..4b1094c 100644
--- a/chrome/browser/ui/webui/options/options_ui.cc
+++ b/chrome/browser/ui/webui/options/options_ui.cc
@@ -77,6 +77,26 @@
//
////////////////////////////////////////////////////////////////////////////////
+class OptionsUIHTMLSource : public ChromeURLDataManager::DataSource {
+ public:
+ // The constructor takes over ownership of |localized_strings|.
+ explicit OptionsUIHTMLSource(DictionaryValue* localized_strings);
+ virtual ~OptionsUIHTMLSource();
+
+ // Called when the network layer has requested a resource underneath
+ // the path we registered.
+ virtual void StartDataRequest(const std::string& path,
+ bool is_off_the_record,
+ int request_id);
+ virtual std::string GetMimeType(const std::string&) const;
+
+ private:
+ // Localized strings collection.
+ scoped_ptr<DictionaryValue> localized_strings_;
+
+ DISALLOW_COPY_AND_ASSIGN(OptionsUIHTMLSource);
+};
+
OptionsUIHTMLSource::OptionsUIHTMLSource(DictionaryValue* localized_strings)
: DataSource(chrome::kChromeUISettingsHost, MessageLoop::current()) {
DCHECK(localized_strings);
@@ -160,12 +180,14 @@ OptionsUI::OptionsUI(TabContents* contents)
: WebUI(contents), initialized_handlers_(false) {
DictionaryValue* localized_strings = new DictionaryValue();
+ CoreOptionsHandler* core_handler;
#if defined(OS_CHROMEOS)
- AddOptionsPageUIHandler(localized_strings,
- new chromeos::CoreChromeOSOptionsHandler());
+ core_handler = new chromeos::CoreChromeOSOptionsHandler();
#else
- AddOptionsPageUIHandler(localized_strings, new CoreOptionsHandler());
+ core_handler = new CoreOptionsHandler();
#endif
+ core_handler->set_handlers_host(this);
+ AddOptionsPageUIHandler(localized_strings, core_handler);
AddOptionsPageUIHandler(localized_strings, new AdvancedOptionsHandler());
AddOptionsPageUIHandler(localized_strings, new AutofillOptionsHandler());
diff --git a/chrome/browser/ui/webui/options/options_ui.h b/chrome/browser/ui/webui/options/options_ui.h
index 76c0d70..da01c4f 100644
--- a/chrome/browser/ui/webui/options/options_ui.h
+++ b/chrome/browser/ui/webui/options/options_ui.h
@@ -8,6 +8,7 @@
#include <string>
+#include "base/compiler_specific.h"
#include "base/scoped_ptr.h"
#include "chrome/browser/ui/webui/chrome_url_data_manager.h"
#include "content/browser/webui/web_ui.h"
@@ -19,26 +20,6 @@ class GURL;
class PrefService;
struct UserMetricsAction;
-class OptionsUIHTMLSource : public ChromeURLDataManager::DataSource {
- public:
- // The constructor takes over ownership of |localized_strings|.
- explicit OptionsUIHTMLSource(DictionaryValue* localized_strings);
- virtual ~OptionsUIHTMLSource();
-
- // Called when the network layer has requested a resource underneath
- // the path we registered.
- virtual void StartDataRequest(const std::string& path,
- bool is_off_the_record,
- int request_id);
- virtual std::string GetMimeType(const std::string&) const;
-
- private:
- // Localized strings collection.
- scoped_ptr<DictionaryValue> localized_strings_;
-
- DISALLOW_COPY_AND_ASSIGN(OptionsUIHTMLSource);
-};
-
// The base class handler of Javascript messages of options pages.
class OptionsPageUIHandler : public WebUIMessageHandler,
public NotificationObserver {
@@ -92,16 +73,28 @@ class OptionsPageUIHandler : public WebUIMessageHandler,
DISALLOW_COPY_AND_ASSIGN(OptionsPageUIHandler);
};
-class OptionsUI : public WebUI {
+// An interface for common operations that a host of OptionsPageUIHandlers
+// should provide.
+class OptionsPageUIHandlerHost {
+ public:
+ virtual void InitializeHandlers() = 0;
+};
+
+// The WebUI for chrome:settings.
+class OptionsUI : public WebUI,
+ public OptionsPageUIHandlerHost {
public:
explicit OptionsUI(TabContents* contents);
virtual ~OptionsUI();
static RefCountedMemory* GetFaviconResourceBytes();
- virtual void RenderViewCreated(RenderViewHost* render_view_host);
- virtual void DidBecomeActiveForReusedRenderView();
- void InitializeHandlers();
+ // Overridden from WebUI:
+ virtual void RenderViewCreated(RenderViewHost* render_view_host) OVERRIDE;
+ virtual void DidBecomeActiveForReusedRenderView() OVERRIDE;
+
+ // Overridden from OptionsPageUIHandlerHost:
+ virtual void InitializeHandlers() OVERRIDE;
private:
// Adds OptionsPageUiHandler to the handlers list if handler is enabled.
diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi
index 1b7211c..8cf7caa 100644
--- a/chrome/chrome_browser.gypi
+++ b/chrome/chrome_browser.gypi
@@ -714,6 +714,8 @@
'browser/chromeos/webui/mobile_setup_ui.h',
'browser/chromeos/webui/proxy_handler.cc',
'browser/chromeos/webui/proxy_handler.h',
+ 'browser/chromeos/webui/proxy_settings_ui.cc',
+ 'browser/chromeos/webui/proxy_settings_ui.h',
'browser/chromeos/webui/register_page_ui.cc',
'browser/chromeos/webui/register_page_ui.h',
'browser/chromeos/webui/stats_options_handler.cc',
diff --git a/chrome/common/url_constants.cc b/chrome/common/url_constants.cc
index 97498f3..e666a09 100644
--- a/chrome/common/url_constants.cc
+++ b/chrome/common/url_constants.cc
@@ -106,6 +106,7 @@ const char kChromeUIImageBurnerURL[] = "chrome://imageburner/";
const char kChromeUIKeyboardOverlayURL[] = "chrome://keyboardoverlay/";
const char kChromeUIMediaplayerURL[] = "chrome://mediaplayer/";
const char kChromeUIMobileSetupURL[] = "chrome://mobilesetup/";
+const char kChromeUIProxySettingsURL[] = "chrome://proxy-settings/";
const char kChromeUIRegisterPageURL[] = "chrome://register/";
const char kChromeUISlideshowURL[] = "chrome://slideshow/";
const char kChromeUISystemInfoURL[] = "chrome://system/";
@@ -152,6 +153,7 @@ const char kChromeUIImageBurnerHost[] = "imageburner";
const char kChromeUIKeyboardOverlayHost[] = "keyboardoverlay";
const char kChromeUIMediaplayerHost[] = "mediaplayer";
const char kChromeUIMobileSetupHost[] = "mobilesetup";
+const char kChromeUIProxySettingsHost[] = "proxy-settings";
const char kChromeUIRegisterPageHost[] = "register";
const char kChromeUISlideshowHost[] = "slideshow";
const char kChromeUISystemInfoHost[] = "system";
diff --git a/chrome/common/url_constants.h b/chrome/common/url_constants.h
index 4a117d7..6d9720b 100644
--- a/chrome/common/url_constants.h
+++ b/chrome/common/url_constants.h
@@ -98,6 +98,7 @@ extern const char kChromeUIImageBurnerURL[];
extern const char kChromeUIKeyboardOverlayURL[];
extern const char kChromeUIMediaplayerURL[];
extern const char kChromeUIMobileSetupURL[];
+extern const char kChromeUIProxySettingsURL[];
extern const char kChromeUIRegisterPageURL[];
extern const char kChromeUISlideshowURL[];
extern const char kChromeUISystemInfoURL[];
@@ -144,6 +145,7 @@ extern const char kChromeUIImageBurnerHost[];
extern const char kChromeUIKeyboardOverlayHost[];
extern const char kChromeUIMediaplayerHost[];
extern const char kChromeUIMobileSetupHost[];
+extern const char kChromeUIProxySettingsHost[];
extern const char kChromeUIRegisterPageHost[];
extern const char kChromeUISlideshowHost[];
extern const char kChromeUISystemInfoHost[];