summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-12-30 00:53:09 +0000
committerjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-12-30 00:53:09 +0000
commit46adf7ff93ebbbfdaf6f8ad7b7253018f5cff3dc (patch)
tree1c9dc2964223d04d4146d57bf4878642589bcb3c /chrome
parent34f15c3622301880f8cfd3e34b6cf4e1c6452ee3 (diff)
downloadchromium_src-46adf7ff93ebbbfdaf6f8ad7b7253018f5cff3dc.zip
chromium_src-46adf7ff93ebbbfdaf6f8ad7b7253018f5cff3dc.tar.gz
chromium_src-46adf7ff93ebbbfdaf6f8ad7b7253018f5cff3dc.tar.bz2
Simplify WebUIMessageHandler a bit in preparation for moving it into the Content API:
-got rid of the Attach function which could be overridden by subclasses. Apart from not fitting in with the pure virtual function convention of the Content API, it was redundant to have it and RegisterMessages, since any initialization could be done in the latter. -made WebUI::AddMessageHandler automatically set the WebUI object on WebUIMessageHandler and call RegisterMessages. It seemed busy work to require every user of WebUIMessageHandler to both add it to the WebUI object and also tell the WebUIMessageHandler about the WebUI. -removed the usage of the web_ui_ member variable and switched all callers to use web_ui() instead -made the helper functions static to make it clear that they don't depend on the object In followup changes, I'll move WebUIMessageHandler to a separate file in content/public/browser and put it in the content namespace. BUG=98716 Review URL: http://codereview.chromium.org/8968031 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@116011 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/printing/cloud_print/cloud_print_setup_message_handler.cc13
-rw-r--r--chrome/browser/printing/cloud_print/cloud_print_setup_message_handler.h3
-rw-r--r--chrome/browser/printing/print_dialog_cloud.cc40
-rw-r--r--chrome/browser/ui/login/login_prompt_ui.cc8
-rw-r--r--chrome/browser/ui/webui/active_downloads_ui.cc44
-rw-r--r--chrome/browser/ui/webui/aura/app_list_ui.cc10
-rw-r--r--chrome/browser/ui/webui/bug_report_ui.cc30
-rw-r--r--chrome/browser/ui/webui/certificate_viewer_webui.cc12
-rw-r--r--chrome/browser/ui/webui/chromeos/choose_mobile_network_ui.cc12
-rw-r--r--chrome/browser/ui/webui/chromeos/imageburner/imageburner_ui.cc32
-rw-r--r--chrome/browser/ui/webui/chromeos/imageburner/webui_handler.h1
-rw-r--r--chrome/browser/ui/webui/chromeos/keyboard_overlay_ui.cc16
-rw-r--r--chrome/browser/ui/webui/chromeos/login/base_screen_handler.cc4
-rw-r--r--chrome/browser/ui/webui/chromeos/login/core_oobe_handler.cc14
-rw-r--r--chrome/browser/ui/webui/chromeos/login/enterprise_oauth_enrollment_screen_handler.cc34
-rw-r--r--chrome/browser/ui/webui/chromeos/login/eula_screen_handler.cc14
-rw-r--r--chrome/browser/ui/webui/chromeos/login/network_dropdown_handler.cc10
-rw-r--r--chrome/browser/ui/webui/chromeos/login/network_screen_handler.cc30
-rw-r--r--chrome/browser/ui/webui/chromeos/login/oobe_ui.cc2
-rw-r--r--chrome/browser/ui/webui/chromeos/login/signin_screen_handler.cc65
-rw-r--r--chrome/browser/ui/webui/chromeos/login/update_screen_handler.cc17
-rw-r--r--chrome/browser/ui/webui/chromeos/login/user_image_screen_handler.cc30
-rw-r--r--chrome/browser/ui/webui/chromeos/mobile_setup_ui.cc25
-rw-r--r--chrome/browser/ui/webui/chromeos/proxy_settings_ui.cc4
-rw-r--r--chrome/browser/ui/webui/chromeos/register_page_ui.cc24
-rw-r--r--chrome/browser/ui/webui/chromeos/sim_unlock_ui.cc34
-rw-r--r--chrome/browser/ui/webui/chromeos/system_info_ui.cc8
-rw-r--r--chrome/browser/ui/webui/cloud_print_signin_dialog.cc20
-rw-r--r--chrome/browser/ui/webui/collected_cookies_ui_delegate.cc18
-rw-r--r--chrome/browser/ui/webui/conflicts_ui.cc6
-rw-r--r--chrome/browser/ui/webui/constrained_html_ui.cc1
-rw-r--r--chrome/browser/ui/webui/crashes_ui.cc14
-rw-r--r--chrome/browser/ui/webui/downloads_dom_handler.cc30
-rw-r--r--chrome/browser/ui/webui/downloads_ui.cc1
-rw-r--r--chrome/browser/ui/webui/edit_search_engine_dialog_webui.cc12
-rw-r--r--chrome/browser/ui/webui/extensions/extensions_ui.cc2
-rw-r--r--chrome/browser/ui/webui/flags_ui.cc10
-rw-r--r--chrome/browser/ui/webui/flash_ui.cc8
-rw-r--r--chrome/browser/ui/webui/gpu_internals_ui.cc19
-rw-r--r--chrome/browser/ui/webui/history_ui.cc37
-rw-r--r--chrome/browser/ui/webui/history_ui.h1
-rw-r--r--chrome/browser/ui/webui/html_dialog_ui.cc1
-rw-r--r--chrome/browser/ui/webui/hung_renderer_dialog.cc9
-rw-r--r--chrome/browser/ui/webui/input_window_dialog_webui.cc9
-rw-r--r--chrome/browser/ui/webui/media/media_internals_handler.cc12
-rw-r--r--chrome/browser/ui/webui/media/media_internals_handler.h1
-rw-r--r--chrome/browser/ui/webui/media/media_internals_ui.cc2
-rw-r--r--chrome/browser/ui/webui/metrics_handler.cc8
-rw-r--r--chrome/browser/ui/webui/net_internals_ui.cc79
-rw-r--r--chrome/browser/ui/webui/net_internals_ui_browsertest.cc10
-rw-r--r--chrome/browser/ui/webui/ntp/app_launcher_handler.cc72
-rw-r--r--chrome/browser/ui/webui/ntp/app_launcher_handler.h1
-rw-r--r--chrome/browser/ui/webui/ntp/favicon_webui_handler.cc18
-rw-r--r--chrome/browser/ui/webui/ntp/most_visited_handler.cc33
-rw-r--r--chrome/browser/ui/webui/ntp/most_visited_handler.h1
-rw-r--r--chrome/browser/ui/webui/ntp/new_tab_page_handler.cc10
-rw-r--r--chrome/browser/ui/webui/ntp/new_tab_page_handler.h1
-rw-r--r--chrome/browser/ui/webui/ntp/new_tab_page_sync_handler.cc15
-rw-r--r--chrome/browser/ui/webui/ntp/new_tab_page_sync_handler.h1
-rw-r--r--chrome/browser/ui/webui/ntp/new_tab_ui.cc19
-rw-r--r--chrome/browser/ui/webui/ntp/ntp_login_handler.cc32
-rw-r--r--chrome/browser/ui/webui/ntp/ntp_login_handler.h2
-rw-r--r--chrome/browser/ui/webui/ntp/recently_closed_tabs_handler.cc10
-rw-r--r--chrome/browser/ui/webui/options/advanced_options_handler.cc94
-rw-r--r--chrome/browser/ui/webui/options/advanced_options_handler.h1
-rw-r--r--chrome/browser/ui/webui/options/autofill_options_handler.cc31
-rw-r--r--chrome/browser/ui/webui/options/browser_options_handler.cc63
-rw-r--r--chrome/browser/ui/webui/options/certificate_manager_handler.cc96
-rw-r--r--chrome/browser/ui/webui/options/chromeos/about_page_handler.cc32
-rw-r--r--chrome/browser/ui/webui/options/chromeos/accounts_options_handler.cc7
-rw-r--r--chrome/browser/ui/webui/options/chromeos/bluetooth_options_handler.cc20
-rw-r--r--chrome/browser/ui/webui/options/chromeos/change_picture_options_handler.cc33
-rw-r--r--chrome/browser/ui/webui/options/chromeos/core_chromeos_options_handler.cc26
-rw-r--r--chrome/browser/ui/webui/options/chromeos/cros_language_options_handler.cc12
-rw-r--r--chrome/browser/ui/webui/options/chromeos/internet_options_handler.cc55
-rw-r--r--chrome/browser/ui/webui/options/chromeos/proxy_handler.cc4
-rw-r--r--chrome/browser/ui/webui/options/chromeos/stats_options_handler.cc2
-rw-r--r--chrome/browser/ui/webui/options/chromeos/system_options_handler.cc18
-rw-r--r--chrome/browser/ui/webui/options/chromeos/virtual_keyboard_manager_handler.cc21
-rw-r--r--chrome/browser/ui/webui/options/clear_browser_data_handler.cc14
-rw-r--r--chrome/browser/ui/webui/options/content_settings_handler.cc52
-rw-r--r--chrome/browser/ui/webui/options/cookies_view_handler.cc16
-rw-r--r--chrome/browser/ui/webui/options/core_options_handler.cc51
-rw-r--r--chrome/browser/ui/webui/options/core_options_handler.h1
-rw-r--r--chrome/browser/ui/webui/options/extension_settings_handler.cc70
-rw-r--r--chrome/browser/ui/webui/options/extension_settings_handler.h1
-rw-r--r--chrome/browser/ui/webui/options/font_settings_handler.cc35
-rw-r--r--chrome/browser/ui/webui/options/font_settings_handler.h1
-rw-r--r--chrome/browser/ui/webui/options/handler_options_handler.cc22
-rw-r--r--chrome/browser/ui/webui/options/import_data_handler.cc22
-rw-r--r--chrome/browser/ui/webui/options/language_options_handler.cc2
-rw-r--r--chrome/browser/ui/webui/options/language_options_handler_common.cc9
-rw-r--r--chrome/browser/ui/webui/options/manage_profile_handler.cc34
-rw-r--r--chrome/browser/ui/webui/options/options_sync_setup_handler.cc4
-rw-r--r--chrome/browser/ui/webui/options/options_ui.cc2
-rw-r--r--chrome/browser/ui/webui/options/pack_extension_handler.cc6
-rw-r--r--chrome/browser/ui/webui/options/password_manager_handler.cc28
-rw-r--r--chrome/browser/ui/webui/options/personal_options_handler.cc77
-rw-r--r--chrome/browser/ui/webui/options/search_engine_manager_handler.cc26
-rw-r--r--chrome/browser/ui/webui/options/stop_syncing_handler.cc5
-rw-r--r--chrome/browser/ui/webui/options/web_intents_settings_handler.cc8
-rw-r--r--chrome/browser/ui/webui/options2/advanced_options_handler2.cc94
-rw-r--r--chrome/browser/ui/webui/options2/advanced_options_handler2.h1
-rw-r--r--chrome/browser/ui/webui/options2/autofill_options_handler2.cc30
-rw-r--r--chrome/browser/ui/webui/options2/browser_options_handler2.cc63
-rw-r--r--chrome/browser/ui/webui/options2/certificate_manager_handler2.cc96
-rw-r--r--chrome/browser/ui/webui/options2/chromeos/about_page_handler2.cc32
-rw-r--r--chrome/browser/ui/webui/options2/chromeos/accounts_options_handler2.cc7
-rw-r--r--chrome/browser/ui/webui/options2/chromeos/bluetooth_options_handler2.cc20
-rw-r--r--chrome/browser/ui/webui/options2/chromeos/change_picture_options_handler2.cc33
-rw-r--r--chrome/browser/ui/webui/options2/chromeos/core_chromeos_options_handler2.cc26
-rw-r--r--chrome/browser/ui/webui/options2/chromeos/cros_language_options_handler2.cc12
-rw-r--r--chrome/browser/ui/webui/options2/chromeos/internet_options_handler2.cc55
-rw-r--r--chrome/browser/ui/webui/options2/chromeos/proxy_handler2.cc4
-rw-r--r--chrome/browser/ui/webui/options2/chromeos/stats_options_handler2.cc2
-rw-r--r--chrome/browser/ui/webui/options2/chromeos/system_options_handler2.cc18
-rw-r--r--chrome/browser/ui/webui/options2/chromeos/virtual_keyboard_manager_handler2.cc21
-rw-r--r--chrome/browser/ui/webui/options2/clear_browser_data_handler2.cc14
-rw-r--r--chrome/browser/ui/webui/options2/content_settings_handler2.cc52
-rw-r--r--chrome/browser/ui/webui/options2/cookies_view_handler2.cc16
-rw-r--r--chrome/browser/ui/webui/options2/core_options_handler2.cc51
-rw-r--r--chrome/browser/ui/webui/options2/core_options_handler2.h1
-rw-r--r--chrome/browser/ui/webui/options2/font_settings_handler2.cc37
-rw-r--r--chrome/browser/ui/webui/options2/font_settings_handler2.h1
-rw-r--r--chrome/browser/ui/webui/options2/handler_options_handler2.cc22
-rw-r--r--chrome/browser/ui/webui/options2/import_data_handler2.cc22
-rw-r--r--chrome/browser/ui/webui/options2/language_options_handler2.cc2
-rw-r--r--chrome/browser/ui/webui/options2/language_options_handler_common2.cc9
-rw-r--r--chrome/browser/ui/webui/options2/manage_profile_handler2.cc34
-rw-r--r--chrome/browser/ui/webui/options2/options_sync_setup_handler2.cc6
-rw-r--r--chrome/browser/ui/webui/options2/options_ui2.cc2
-rw-r--r--chrome/browser/ui/webui/options2/password_manager_handler2.cc28
-rw-r--r--chrome/browser/ui/webui/options2/personal_options_handler2.cc77
-rw-r--r--chrome/browser/ui/webui/options2/search_engine_manager_handler2.cc26
-rw-r--r--chrome/browser/ui/webui/options2/stop_syncing_handler2.cc5
-rw-r--r--chrome/browser/ui/webui/options2/web_intents_settings_handler2.cc8
-rw-r--r--chrome/browser/ui/webui/plugins_ui.cc27
-rw-r--r--chrome/browser/ui/webui/policy_ui.cc8
-rw-r--r--chrome/browser/ui/webui/print_preview_handler.cc67
-rw-r--r--chrome/browser/ui/webui/print_preview_ui.cc2
-rw-r--r--chrome/browser/ui/webui/profiler_ui.cc15
-rw-r--r--chrome/browser/ui/webui/quota_internals_handler.cc11
-rw-r--r--chrome/browser/ui/webui/quota_internals_ui.cc3
-rw-r--r--chrome/browser/ui/webui/sessions_ui.cc17
-rw-r--r--chrome/browser/ui/webui/ssl_client_certificate_selector_webui.cc6
-rw-r--r--chrome/browser/ui/webui/sync_promo/sync_promo_handler.cc48
-rw-r--r--chrome/browser/ui/webui/sync_promo/sync_promo_handler.h1
-rw-r--r--chrome/browser/ui/webui/sync_promo/sync_promo_ui.cc1
-rw-r--r--chrome/browser/ui/webui/sync_setup_handler.cc55
-rw-r--r--chrome/browser/ui/webui/sync_setup_handler2.cc55
-rw-r--r--chrome/browser/ui/webui/task_manager_handler.cc33
-rw-r--r--chrome/browser/ui/webui/task_manager_handler.h2
-rw-r--r--chrome/browser/ui/webui/task_manager_ui.cc7
-rw-r--r--chrome/browser/ui/webui/tracing_ui.cc49
-rw-r--r--chrome/browser/ui/webui/web_ui_browsertest.cc19
-rw-r--r--chrome/browser/ui/webui/web_ui_test_handler.cc6
-rw-r--r--chrome/browser/ui/webui/web_ui_test_handler.h2
-rw-r--r--chrome/browser/ui/webui/workers_ui.cc10
-rw-r--r--chrome/test/data/webui/async_gen.cc6
-rw-r--r--chrome/test/data/webui/chrome_send_browsertest.cc2
160 files changed, 1580 insertions, 1861 deletions
diff --git a/chrome/browser/printing/cloud_print/cloud_print_setup_message_handler.cc b/chrome/browser/printing/cloud_print/cloud_print_setup_message_handler.cc
index 5426fc6..e9658d3 100644
--- a/chrome/browser/printing/cloud_print/cloud_print_setup_message_handler.cc
+++ b/chrome/browser/printing/cloud_print/cloud_print_setup_message_handler.cc
@@ -11,20 +11,17 @@
#include "base/memory/scoped_ptr.h"
#include "chrome/browser/printing/cloud_print/cloud_print_setup_flow.h"
-WebUIMessageHandler* CloudPrintSetupMessageHandler::Attach(WebUI* web_ui) {
+void CloudPrintSetupMessageHandler::RegisterMessages() {
// Pass the WebUI object to the setup flow.
- flow_->Attach(web_ui);
- return WebUIMessageHandler::Attach(web_ui);
-}
+ flow_->Attach(web_ui());
-void CloudPrintSetupMessageHandler::RegisterMessages() {
- web_ui_->RegisterMessageCallback("SubmitAuth",
+ web_ui()->RegisterMessageCallback("SubmitAuth",
base::Bind(&CloudPrintSetupMessageHandler::HandleSubmitAuth,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("PrintTestPage",
+ web_ui()->RegisterMessageCallback("PrintTestPage",
base::Bind(&CloudPrintSetupMessageHandler::HandlePrintTestPage,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("LearnMore",
+ web_ui()->RegisterMessageCallback("LearnMore",
base::Bind(&CloudPrintSetupMessageHandler::HandleLearnMore,
base::Unretained(this)));
}
diff --git a/chrome/browser/printing/cloud_print/cloud_print_setup_message_handler.h b/chrome/browser/printing/cloud_print/cloud_print_setup_message_handler.h
index 9e18804..377edab 100644
--- a/chrome/browser/printing/cloud_print/cloud_print_setup_message_handler.h
+++ b/chrome/browser/printing/cloud_print/cloud_print_setup_message_handler.h
@@ -19,9 +19,6 @@ class CloudPrintSetupMessageHandler : public WebUIMessageHandler {
: flow_(flow) {}
virtual ~CloudPrintSetupMessageHandler() {}
- // WebUIMessageHandler implementation.
- virtual WebUIMessageHandler* Attach(WebUI* web_ui) OVERRIDE;
-
protected:
// WebUIMessageHandler implementation.
virtual void RegisterMessages() OVERRIDE;
diff --git a/chrome/browser/printing/print_dialog_cloud.cc b/chrome/browser/printing/print_dialog_cloud.cc
index 8815789..6b1c932 100644
--- a/chrome/browser/printing/print_dialog_cloud.cc
+++ b/chrome/browser/printing/print_dialog_cloud.cc
@@ -164,7 +164,8 @@ void CloudPrintDataSenderHelper::CallJavascriptFunction(
const Value& arg1,
const Value& arg2,
const Value& arg3) {
- web_ui_->CallJavascriptFunction(WideToASCII(function_name), arg1, arg2, arg3);
+ web_ui_->CallJavascriptFunction(
+ WideToASCII(function_name), arg1, arg2, arg3);
}
// Clears out the pointer we're using to communicate. Either routine is
@@ -284,28 +285,25 @@ void CloudPrintFlowHandler::CancelAnyRunningTask() {
}
void CloudPrintFlowHandler::RegisterMessages() {
- if (!web_ui_)
- return;
-
// TODO(scottbyer) - This is where we will register messages for the
// UI JS to use. Needed: Call to update page setup parameters.
- web_ui_->RegisterMessageCallback("ShowDebugger",
+ web_ui()->RegisterMessageCallback("ShowDebugger",
base::Bind(&CloudPrintFlowHandler::HandleShowDebugger,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("SendPrintData",
+ web_ui()->RegisterMessageCallback("SendPrintData",
base::Bind(&CloudPrintFlowHandler::HandleSendPrintData,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("SetPageParameters",
+ web_ui()->RegisterMessageCallback("SetPageParameters",
base::Bind(&CloudPrintFlowHandler::HandleSetPageParameters,
base::Unretained(this)));
// Register for appropriate notifications, and re-direct the URL
// to the real server URL, now that we've gotten an HTML dialog
// going.
- NavigationController* controller = &web_ui_->tab_contents()->GetController();
+ NavigationController* controller = &web_ui()->tab_contents()->GetController();
NavigationEntry* pending_entry = controller->GetPendingEntry();
if (pending_entry) {
- Profile* profile = Profile::FromWebUI(web_ui_);
+ Profile* profile = Profile::FromWebUI(web_ui());
pending_entry->SetURL(
CloudPrintURL(profile).GetCloudPrintServiceDialogURL());
}
@@ -320,13 +318,13 @@ void CloudPrintFlowHandler::Observe(
if (type == content::NOTIFICATION_LOAD_STOP) {
// Take the opportunity to set some (minimal) additional
// script permissions required for the web UI.
- GURL url = web_ui_->tab_contents()->GetURL();
+ GURL url = web_ui()->tab_contents()->GetURL();
GURL dialog_url = CloudPrintURL(
- Profile::FromWebUI(web_ui_)).GetCloudPrintServiceDialogURL();
+ Profile::FromWebUI(web_ui())).GetCloudPrintServiceDialogURL();
if (url.host() == dialog_url.host() &&
url.path() == dialog_url.path() &&
url.scheme() == dialog_url.scheme()) {
- RenderViewHost* rvh = web_ui_->tab_contents()->GetRenderViewHost();
+ RenderViewHost* rvh = web_ui()->tab_contents()->GetRenderViewHost();
if (rvh && rvh->delegate()) {
WebPreferences webkit_prefs = rvh->delegate()->GetWebkitPrefs();
webkit_prefs.allow_scripts_to_close_windows = true;
@@ -351,8 +349,8 @@ void CloudPrintFlowHandler::HandleShowDebugger(const ListValue* args) {
}
void CloudPrintFlowHandler::ShowDebugger() {
- if (web_ui_) {
- RenderViewHost* rvh = web_ui_->tab_contents()->GetRenderViewHost();
+ if (web_ui()) {
+ RenderViewHost* rvh = web_ui()->tab_contents()->GetRenderViewHost();
if (rvh)
DevToolsWindow::OpenDevToolsWindow(rvh);
}
@@ -360,8 +358,8 @@ void CloudPrintFlowHandler::ShowDebugger() {
scoped_refptr<CloudPrintDataSender>
CloudPrintFlowHandler::CreateCloudPrintDataSender() {
- DCHECK(web_ui_);
- print_data_helper_.reset(new CloudPrintDataSenderHelper(web_ui_));
+ DCHECK(web_ui());
+ print_data_helper_.reset(new CloudPrintDataSenderHelper(web_ui()));
return new CloudPrintDataSender(print_data_helper_.get(),
print_job_title_,
print_ticket_,
@@ -375,7 +373,7 @@ void CloudPrintFlowHandler::HandleSendPrintData(const ListValue* args) {
// setup parameters becomes asynchronous and may be set while some
// data is in flight). Then we can clear out the print data.
CancelAnyRunningTask();
- if (web_ui_) {
+ if (web_ui()) {
print_data_sender_ = CreateCloudPrintDataSender();
BrowserThread::PostTask(
BrowserThread::FILE, FROM_HERE,
@@ -430,10 +428,10 @@ void CloudPrintFlowHandler::HandleSetPageParameters(const ListValue* args) {
}
void CloudPrintFlowHandler::StoreDialogClientSize() const {
- if (web_ui_ && web_ui_->tab_contents() &&
- web_ui_->tab_contents()->GetView()) {
- gfx::Size size = web_ui_->tab_contents()->GetView()->GetContainerSize();
- Profile* profile = Profile::FromWebUI(web_ui_);
+ if (web_ui() && web_ui()->tab_contents() &&
+ web_ui()->tab_contents()->GetView()) {
+ gfx::Size size = web_ui()->tab_contents()->GetView()->GetContainerSize();
+ Profile* profile = Profile::FromWebUI(web_ui());
profile->GetPrefs()->SetInteger(prefs::kCloudPrintDialogWidth,
size.width());
profile->GetPrefs()->SetInteger(prefs::kCloudPrintDialogHeight,
diff --git a/chrome/browser/ui/login/login_prompt_ui.cc b/chrome/browser/ui/login/login_prompt_ui.cc
index fa209e9..154c869 100644
--- a/chrome/browser/ui/login/login_prompt_ui.cc
+++ b/chrome/browser/ui/login/login_prompt_ui.cc
@@ -125,7 +125,7 @@ class LoginHandlerHtmlDelegate : public HtmlDialogUIDelegate,
// WebUIMessageHandler method:
virtual void RegisterMessages() OVERRIDE {
- web_ui_->RegisterMessageCallback(
+ web_ui()->RegisterMessageCallback(
"GetAutofill",
base::Bind(&LoginHandlerHtmlDelegate::GetAutofill,
base::Unretained(this)));
@@ -231,11 +231,11 @@ void LoginHandlerHtmlDelegate::ShowAutofillData(const string16& username,
}
void LoginHandlerHtmlDelegate::SendAutofillData() {
- if (!closed_ && web_ui_ && has_autofill_ && ready_for_autofill_) {
+ if (!closed_ && web_ui() && has_autofill_ && ready_for_autofill_) {
StringValue username_v(autofill_username_);
StringValue password_v(autofill_password_);
- web_ui_->CallJavascriptFunction("setAutofillCredentials",
- username_v, password_v);
+ web_ui()->CallJavascriptFunction("setAutofillCredentials",
+ username_v, password_v);
}
}
diff --git a/chrome/browser/ui/webui/active_downloads_ui.cc b/chrome/browser/ui/webui/active_downloads_ui.cc
index 460c093..a79b921 100644
--- a/chrome/browser/ui/webui/active_downloads_ui.cc
+++ b/chrome/browser/ui/webui/active_downloads_ui.cc
@@ -121,11 +121,7 @@ class ActiveDownloadsHandler
ActiveDownloadsHandler();
virtual ~ActiveDownloadsHandler();
- // Initialization after Attach.
- void Init();
-
// WebUIMessageHandler implementation.
- virtual WebUIMessageHandler* Attach(WebUI* web_ui) OVERRIDE;
virtual void RegisterMessages() OVERRIDE;
// DownloadItem::Observer interface.
@@ -179,41 +175,36 @@ ActiveDownloadsHandler::~ActiveDownloadsHandler() {
download_manager_->RemoveObserver(this);
}
-WebUIMessageHandler* ActiveDownloadsHandler::Attach(WebUI* web_ui) {
- profile_ = Profile::FromWebUI(web_ui);
+void ActiveDownloadsHandler::RegisterMessages() {
+ profile_ = Profile::FromWebUI(web_ui());
profile_->GetChromeURLDataManager()->AddDataSource(new FileIconSourceCros());
- tab_contents_ = web_ui->tab_contents();
- return WebUIMessageHandler::Attach(web_ui);
-}
+ tab_contents_ = web_ui()->tab_contents();
-void ActiveDownloadsHandler::Init() {
- download_manager_ =
- DownloadServiceFactory::GetForProfile(profile_)->GetDownloadManager();
- download_manager_->AddObserver(this);
-}
-
-void ActiveDownloadsHandler::RegisterMessages() {
- web_ui_->RegisterMessageCallback("getDownloads",
+ web_ui()->RegisterMessageCallback("getDownloads",
base::Bind(&ActiveDownloadsHandler::HandleGetDownloads,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("pauseToggleDownload",
+ web_ui()->RegisterMessageCallback("pauseToggleDownload",
base::Bind(&ActiveDownloadsHandler::HandlePauseToggleDownload,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("allowDownload",
+ web_ui()->RegisterMessageCallback("allowDownload",
base::Bind(&ActiveDownloadsHandler::HandleAllowDownload,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("cancelDownload",
+ web_ui()->RegisterMessageCallback("cancelDownload",
base::Bind(&ActiveDownloadsHandler::HandleCancelDownload,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("showAllFiles",
+ web_ui()->RegisterMessageCallback("showAllFiles",
base::Bind(&ActiveDownloadsHandler::HandleShowAllFiles,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("openNewFullWindow",
+ web_ui()->RegisterMessageCallback("openNewFullWindow",
base::Bind(&ActiveDownloadsHandler::OpenNewFullWindow,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("playMediaFile",
+ web_ui()->RegisterMessageCallback("playMediaFile",
base::Bind(&ActiveDownloadsHandler::PlayMediaFile,
base::Unretained(this)));
+
+ download_manager_ =
+ DownloadServiceFactory::GetForProfile(profile_)->GetDownloadManager();
+ download_manager_->AddObserver(this);
}
void ActiveDownloadsHandler::PlayMediaFile(const ListValue* args) {
@@ -326,7 +317,7 @@ void ActiveDownloadsHandler::SendDownloads() {
results.Append(download_util::CreateDownloadItemValue(downloads_[i], i));
}
- web_ui_->CallJavascriptFunction("downloadsList", results);
+ web_ui()->CallJavascriptFunction("downloadsList", results);
}
void ActiveDownloadsHandler::OnDownloadUpdated(DownloadItem* item) {
@@ -351,7 +342,7 @@ void ActiveDownloadsHandler::OnDownloadUpdated(DownloadItem* item) {
const size_t id = it - downloads_.begin();
scoped_ptr<DictionaryValue> result(
download_util::CreateDownloadItemValue(item, id));
- web_ui_->CallJavascriptFunction("downloadUpdated", *result);
+ web_ui()->CallJavascriptFunction("downloadUpdated", *result);
}
}
@@ -365,8 +356,7 @@ void ActiveDownloadsHandler::OnDownloadUpdated(DownloadItem* item) {
ActiveDownloadsUI::ActiveDownloadsUI(TabContents* contents)
: HtmlDialogUI(contents),
handler_(new ActiveDownloadsHandler()) {
- AddMessageHandler(handler_->Attach(this));
- handler_->Init();
+ AddMessageHandler(handler_);
// Set up the chrome://active-downloads/ source.
Profile* profile = Profile::FromBrowserContext(contents->GetBrowserContext());
diff --git a/chrome/browser/ui/webui/aura/app_list_ui.cc b/chrome/browser/ui/webui/aura/app_list_ui.cc
index e876431..5be1fae 100644
--- a/chrome/browser/ui/webui/aura/app_list_ui.cc
+++ b/chrome/browser/ui/webui/aura/app_list_ui.cc
@@ -87,7 +87,7 @@ class AppListHandler : public WebUIMessageHandler {
private:
AppListUI* app_list_ui() const {
- return static_cast<AppListUI*>(web_ui_);
+ return static_cast<AppListUI*>(web_ui());
}
void HandleClose(const base::ListValue* args);
@@ -97,9 +97,9 @@ class AppListHandler : public WebUIMessageHandler {
};
void AppListHandler::RegisterMessages() {
- web_ui_->RegisterMessageCallback("close",
+ web_ui()->RegisterMessageCallback("close",
base::Bind(&AppListHandler::HandleClose, base::Unretained(this)));
- web_ui_->RegisterMessageCallback("onAppsLoaded",
+ web_ui()->RegisterMessageCallback("onAppsLoaded",
base::Bind(&AppListHandler::HandleAppsLoaded, base::Unretained(this)));
}
@@ -118,11 +118,11 @@ void AppListHandler::HandleAppsLoaded(const base::ListValue* args) {
AppListUI::AppListUI(TabContents* contents)
: ChromeWebUI(contents),
delegate_(NULL) {
- AddMessageHandler((new AppListHandler)->Attach(this));
+ AddMessageHandler(new AppListHandler);
ExtensionService* service = GetProfile()->GetExtensionService();
if (service)
- AddMessageHandler((new AppLauncherHandler(service))->Attach(this));
+ AddMessageHandler(new AppLauncherHandler(service));
// Set up the source.
Profile* profile = Profile::FromBrowserContext(contents->GetBrowserContext());
diff --git a/chrome/browser/ui/webui/bug_report_ui.cc b/chrome/browser/ui/webui/bug_report_ui.cc
index fa09b85..8ec1bcd 100644
--- a/chrome/browser/ui/webui/bug_report_ui.cc
+++ b/chrome/browser/ui/webui/bug_report_ui.cc
@@ -166,7 +166,6 @@ class BugReportHandler : public WebUIMessageHandler,
bool Init();
// WebUIMessageHandler implementation.
- virtual WebUIMessageHandler* Attach(WebUI* web_ui) OVERRIDE;
virtual void RegisterMessages() OVERRIDE;
private:
@@ -350,11 +349,6 @@ void BugReportHandler::SetupScreenshotsSource() {
profile->GetChromeURLDataManager()->AddDataSource(screenshot_source_);
}
-WebUIMessageHandler* BugReportHandler::Attach(WebUI* web_ui) {
- SetupScreenshotsSource();
- return WebUIMessageHandler::Attach(web_ui);
-}
-
bool BugReportHandler::Init() {
std::string page_url;
if (tab_->GetController().GetActiveEntry()) {
@@ -393,24 +387,26 @@ bool BugReportHandler::Init() {
}
void BugReportHandler::RegisterMessages() {
- web_ui_->RegisterMessageCallback("getDialogDefaults",
+ SetupScreenshotsSource();
+
+ web_ui()->RegisterMessageCallback("getDialogDefaults",
base::Bind(&BugReportHandler::HandleGetDialogDefaults,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("refreshCurrentScreenshot",
+ web_ui()->RegisterMessageCallback("refreshCurrentScreenshot",
base::Bind(&BugReportHandler::HandleRefreshCurrentScreenshot,
base::Unretained(this)));
#if defined(OS_CHROMEOS)
- web_ui_->RegisterMessageCallback("refreshSavedScreenshots",
+ web_ui()->RegisterMessageCallback("refreshSavedScreenshots",
base::Bind(&BugReportHandler::HandleRefreshSavedScreenshots,
base::Unretained(this)));
#endif
- web_ui_->RegisterMessageCallback("sendReport",
+ web_ui()->RegisterMessageCallback("sendReport",
base::Bind(&BugReportHandler::HandleSendReport,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("cancel",
+ web_ui()->RegisterMessageCallback("cancel",
base::Bind(&BugReportHandler::HandleCancel,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("openSystemTab",
+ web_ui()->RegisterMessageCallback("openSystemTab",
base::Bind(&BugReportHandler::HandleOpenSystemTab,
base::Unretained(this)));
}
@@ -446,13 +442,13 @@ void BugReportHandler::HandleGetDialogDefaults(const ListValue*) {
dialog_defaults.Append(new StringValue(GetUserEmail()));
#endif
- web_ui_->CallJavascriptFunction("setupDialogDefaults", dialog_defaults);
+ web_ui()->CallJavascriptFunction("setupDialogDefaults", dialog_defaults);
}
void BugReportHandler::HandleRefreshCurrentScreenshot(const ListValue*) {
std::string current_screenshot(kCurrentScreenshotUrl);
StringValue screenshot(current_screenshot);
- web_ui_->CallJavascriptFunction("setupCurrentScreenshot", screenshot);
+ web_ui()->CallJavascriptFunction("setupCurrentScreenshot", screenshot);
}
@@ -464,7 +460,7 @@ void BugReportHandler::HandleRefreshSavedScreenshots(const ListValue*) {
ListValue screenshots_list;
for (size_t i = 0; i < saved_screenshots.size(); ++i)
screenshots_list.Append(new StringValue(saved_screenshots[i]));
- web_ui_->CallJavascriptFunction("setupSavedScreenshots", screenshots_list);
+ web_ui()->CallJavascriptFunction("setupSavedScreenshots", screenshots_list);
}
#endif
@@ -545,7 +541,7 @@ void BugReportHandler::HandleSendReport(const ListValue* list_value) {
#endif
// Update the data in bug_report_data_ so it can be sent
- bug_report_data_->UpdateData(Profile::FromWebUI(web_ui_)
+ bug_report_data_->UpdateData(Profile::FromWebUI(web_ui())
, target_tab_url_
, problem_type
, page_url
@@ -618,7 +614,7 @@ void BugReportHandler::CloseFeedbackTab() {
////////////////////////////////////////////////////////////////////////////////
BugReportUI::BugReportUI(TabContents* tab) : HtmlDialogUI(tab) {
BugReportHandler* handler = new BugReportHandler(tab);
- AddMessageHandler((handler)->Attach(this));
+ AddMessageHandler(handler);
// The handler's init will determine whether we show the error html page.
ChromeWebUIDataSource* html_source =
diff --git a/chrome/browser/ui/webui/certificate_viewer_webui.cc b/chrome/browser/ui/webui/certificate_viewer_webui.cc
index 4a6c150..f040f97 100644
--- a/chrome/browser/ui/webui/certificate_viewer_webui.cc
+++ b/chrome/browser/ui/webui/certificate_viewer_webui.cc
@@ -153,13 +153,13 @@ CertificateViewerDialogHandler::~CertificateViewerDialogHandler() {
}
void CertificateViewerDialogHandler::RegisterMessages() {
- web_ui_->RegisterMessageCallback("exportCertificate",
+ web_ui()->RegisterMessageCallback("exportCertificate",
base::Bind(&CertificateViewerDialogHandler::ExportCertificate,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("requestCertificateInfo",
+ web_ui()->RegisterMessageCallback("requestCertificateInfo",
base::Bind(&CertificateViewerDialogHandler::RequestCertificateInfo,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("requestCertificateFields",
+ web_ui()->RegisterMessageCallback("requestCertificateFields",
base::Bind(&CertificateViewerDialogHandler::RequestCertificateFields,
base::Unretained(this)));
}
@@ -174,7 +174,7 @@ void CertificateViewerDialogHandler::ExportCertificate(
if (cert_index < 0 || cert_index >= (int)cert_chain_.size())
return;
- ShowCertExportDialog(web_ui_->tab_contents(),
+ ShowCertExportDialog(web_ui()->tab_contents(),
window_,
cert_chain_[cert_index]);
}
@@ -271,7 +271,7 @@ void CertificateViewerDialogHandler::RequestCertificateInfo(
cert_info.Set("hierarchy", children);
// Send certificate information to javascript.
- web_ui_->CallJavascriptFunction("cert_viewer.getCertificateInfo", cert_info);
+ web_ui()->CallJavascriptFunction("cert_viewer.getCertificateInfo", cert_info);
}
void CertificateViewerDialogHandler::RequestCertificateFields(
@@ -422,6 +422,6 @@ void CertificateViewerDialogHandler::RequestCertificateFields(
x509_certificate_model::HashCertSHA1(cert));
// Send certificate information to javascript.
- web_ui_->CallJavascriptFunction("cert_viewer.getCertificateFields",
+ web_ui()->CallJavascriptFunction("cert_viewer.getCertificateFields",
root_list);
}
diff --git a/chrome/browser/ui/webui/chromeos/choose_mobile_network_ui.cc b/chrome/browser/ui/webui/chromeos/choose_mobile_network_ui.cc
index 7ff1fb5..006d6a0 100644
--- a/chrome/browser/ui/webui/chromeos/choose_mobile_network_ui.cc
+++ b/chrome/browser/ui/webui/chromeos/choose_mobile_network_ui.cc
@@ -115,15 +115,15 @@ ChooseMobileNetworkHandler::~ChooseMobileNetworkHandler() {
}
void ChooseMobileNetworkHandler::RegisterMessages() {
- web_ui_->RegisterMessageCallback(
+ web_ui()->RegisterMessageCallback(
kJsApiCancel,
base::Bind(&ChooseMobileNetworkHandler::HandleCancel,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback(
+ web_ui()->RegisterMessageCallback(
kJsApiConnect,
base::Bind(&ChooseMobileNetworkHandler::HandleConnect,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback(
+ web_ui()->RegisterMessageCallback(
kJsApiPageReady,
base::Bind(&ChooseMobileNetworkHandler::HandlePageReady,
base::Unretained(this)));
@@ -156,7 +156,7 @@ void ChooseMobileNetworkHandler::OnNetworkDeviceFoundNetworks(
}
}
if (is_page_ready_) {
- web_ui_->CallJavascriptFunction(kJsApiShowNetworks, networks_list_);
+ web_ui()->CallJavascriptFunction(kJsApiShowNetworks, networks_list_);
networks_list_.Clear();
has_pending_results_ = false;
} else {
@@ -197,7 +197,7 @@ void ChooseMobileNetworkHandler::HandlePageReady(const ListValue* args) {
}
if (has_pending_results_) {
- web_ui_->CallJavascriptFunction(kJsApiShowNetworks, networks_list_);
+ web_ui()->CallJavascriptFunction(kJsApiShowNetworks, networks_list_);
networks_list_.Clear();
has_pending_results_ = false;
}
@@ -209,7 +209,7 @@ void ChooseMobileNetworkHandler::HandlePageReady(const ListValue* args) {
ChooseMobileNetworkUI::ChooseMobileNetworkUI(TabContents* contents)
: ChromeWebUI(contents) {
ChooseMobileNetworkHandler* handler = new ChooseMobileNetworkHandler();
- AddMessageHandler((handler)->Attach(this));
+ AddMessageHandler(handler);
// Set up the "chrome://choose-mobile-network" source.
Profile* profile = Profile::FromBrowserContext(contents->GetBrowserContext());
profile->GetChromeURLDataManager()->AddDataSource(
diff --git a/chrome/browser/ui/webui/chromeos/imageburner/imageburner_ui.cc b/chrome/browser/ui/webui/chromeos/imageburner/imageburner_ui.cc
index f746ecf..6151cca 100644
--- a/chrome/browser/ui/webui/chromeos/imageburner/imageburner_ui.cc
+++ b/chrome/browser/ui/webui/chromeos/imageburner/imageburner_ui.cc
@@ -154,18 +154,14 @@ WebUIHandler::~WebUIHandler() {
state_machine_->RemoveObserver(this);
}
-WebUIMessageHandler* WebUIHandler::Attach(WebUI* web_ui) {
- return WebUIMessageHandler::Attach(web_ui);
-}
-
void WebUIHandler::RegisterMessages() {
- web_ui_->RegisterMessageCallback("getDevices",
+ web_ui()->RegisterMessageCallback("getDevices",
base::Bind(&WebUIHandler::HandleGetDevices, base::Unretained(this)));
- web_ui_->RegisterMessageCallback("burnImage",
+ web_ui()->RegisterMessageCallback("burnImage",
base::Bind(&WebUIHandler::HandleBurnImage, base::Unretained(this)));
- web_ui_->RegisterMessageCallback("cancelBurnImage",
+ web_ui()->RegisterMessageCallback("cancelBurnImage",
base::Bind(&WebUIHandler::HandleCancelBurnImage, base::Unretained(this)));
- web_ui_->RegisterMessageCallback("webuiInitialized",
+ web_ui()->RegisterMessageCallback("webuiInitialized",
base::Bind(&WebUIHandler::HandleWebUIInitialized,
base::Unretained(this)));
}
@@ -178,10 +174,10 @@ void WebUIHandler::DiskChanged(
if (event == chromeos::disks::MOUNT_DISK_ADDED) {
DictionaryValue disk_value;
CreateDiskValue(*disk, &disk_value);
- web_ui_->CallJavascriptFunction("browserBridge.deviceAdded", disk_value);
+ web_ui()->CallJavascriptFunction("browserBridge.deviceAdded", disk_value);
} else if (event == chromeos::disks::MOUNT_DISK_REMOVED) {
StringValue device_path_value(disk->device_path());
- web_ui_->CallJavascriptFunction("browserBridge.deviceRemoved",
+ web_ui()->CallJavascriptFunction("browserBridge.deviceRemoved",
device_path_value);
if (burn_manager_->target_device_path().value() ==
disk->device_path()) {
@@ -220,7 +216,7 @@ void WebUIHandler::BurnProgressUpdated(chromeos::BurnLibrary* object,
void WebUIHandler::OnNetworkManagerChanged(chromeos::NetworkLibrary* obj) {
if (state_machine_->state() == StateMachine::INITIAL && CheckNetwork()) {
- web_ui_->CallJavascriptFunction("browserBridge.reportNetworkDetected");
+ web_ui()->CallJavascriptFunction("browserBridge.reportNetworkDetected");
}
if (state_machine_->state() == StateMachine::DOWNLOADING && !CheckNetwork()) {
ProcessError(IDS_IMAGEBURN_NETWORK_ERROR);
@@ -285,7 +281,7 @@ void WebUIHandler::OnBurnStateChanged(StateMachine::State state) {
void WebUIHandler::OnError(int error_message_id) {
StringValue error_message(l10n_util::GetStringUTF16(error_message_id));
- web_ui_->CallJavascriptFunction("browserBridge.reportFail", error_message);
+ web_ui()->CallJavascriptFunction("browserBridge.reportFail", error_message);
working_ = false;
}
@@ -316,7 +312,7 @@ void WebUIHandler::HandleGetDevices(const ListValue* args) {
results_value.Append(disk_value);
}
}
- web_ui_->CallJavascriptFunction("browserBridge.getDevicesCallback",
+ web_ui()->CallJavascriptFunction("browserBridge.getDevicesCallback",
results_value);
}
@@ -339,7 +335,7 @@ void WebUIHandler::HandleCancelBurnImage(const ListValue* args) {
void WebUIHandler::HandleBurnImage(const ListValue* args) {
if (args && state_machine_->new_burn_posible()) {
if (!CheckNetwork()) {
- web_ui_->CallJavascriptFunction("browserBridge.reportNoNetwork");
+ web_ui()->CallJavascriptFunction("browserBridge.reportNoNetwork");
return;
}
FilePath target_device_path;
@@ -458,7 +454,7 @@ void WebUIHandler::FinalizeBurn() {
burn_manager_->ResetTargetPaths();
chromeos::CrosLibrary::Get()->GetBurnLibrary()->RemoveObserver(this);
observing_burn_lib_ = false;
- web_ui_->CallJavascriptFunction("browserBridge.reportSuccess");
+ web_ui()->CallJavascriptFunction("browserBridge.reportSuccess");
working_ = false;
}
@@ -541,7 +537,7 @@ void WebUIHandler::SendDeviceTooSmallSignal(int64 device_size) {
string16 size;
GetDataSizeText(device_size, &size);
StringValue device_size_text(size);
- web_ui_->CallJavascriptFunction("browserBridge.reportDeviceTooSmall",
+ web_ui()->CallJavascriptFunction("browserBridge.reportDeviceTooSmall",
device_size_text);
}
@@ -583,7 +579,7 @@ void WebUIHandler::SendProgressSignal(ProgressType progress_type,
GetProgressTimeLeftText(time_left_message_id, time, &time_left_text);
progress.SetString("timeLeftText", time_left_text);
- web_ui_->CallJavascriptFunction("browserBridge.updateProgress", progress);
+ web_ui()->CallJavascriptFunction("browserBridge.updateProgress", progress);
}
void WebUIHandler::GetProgressTimeLeftText(int message_id,
@@ -649,7 +645,7 @@ bool WebUIHandler::CheckNetwork() {
ImageBurnUI::ImageBurnUI(TabContents* contents) : ChromeWebUI(contents) {
imageburner::WebUIHandler* handler = new imageburner::WebUIHandler(contents);
- AddMessageHandler((handler)->Attach(this));
+ AddMessageHandler(handler);
Profile* profile = Profile::FromBrowserContext(contents->GetBrowserContext());
profile->GetChromeURLDataManager()->AddDataSource(
diff --git a/chrome/browser/ui/webui/chromeos/imageburner/webui_handler.h b/chrome/browser/ui/webui/chromeos/imageburner/webui_handler.h
index b8df573..64c2ad1 100644
--- a/chrome/browser/ui/webui/chromeos/imageburner/webui_handler.h
+++ b/chrome/browser/ui/webui/chromeos/imageburner/webui_handler.h
@@ -84,7 +84,6 @@ class WebUIHandler
virtual ~WebUIHandler();
// WebUIMessageHandler implementation.
- virtual WebUIMessageHandler* Attach(WebUI* web_ui) OVERRIDE;
virtual void RegisterMessages() OVERRIDE;
// chromeos::disks::DiskMountManager::Observer interface.
diff --git a/chrome/browser/ui/webui/chromeos/keyboard_overlay_ui.cc b/chrome/browser/ui/webui/chromeos/keyboard_overlay_ui.cc
index 29c9022..ca9f6c5 100644
--- a/chrome/browser/ui/webui/chromeos/keyboard_overlay_ui.cc
+++ b/chrome/browser/ui/webui/chromeos/keyboard_overlay_ui.cc
@@ -205,7 +205,6 @@ class KeyboardOverlayHandler
virtual ~KeyboardOverlayHandler();
// WebUIMessageHandler implementation.
- virtual WebUIMessageHandler* Attach(WebUI* web_ui) OVERRIDE;
virtual void RegisterMessages() OVERRIDE;
private:
@@ -234,16 +233,11 @@ KeyboardOverlayHandler::KeyboardOverlayHandler(Profile* profile)
KeyboardOverlayHandler::~KeyboardOverlayHandler() {
}
-WebUIMessageHandler* KeyboardOverlayHandler::Attach(WebUI* web_ui) {
- return WebUIMessageHandler::Attach(web_ui);
-}
-
void KeyboardOverlayHandler::RegisterMessages() {
- DCHECK(web_ui_);
- web_ui_->RegisterMessageCallback("getInputMethodId",
+ web_ui()->RegisterMessageCallback("getInputMethodId",
base::Bind(&KeyboardOverlayHandler::GetInputMethodId,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("getLabelMap",
+ web_ui()->RegisterMessageCallback("getLabelMap",
base::Bind(&KeyboardOverlayHandler::GetLabelMap,
base::Unretained(this)));
}
@@ -254,7 +248,7 @@ void KeyboardOverlayHandler::GetInputMethodId(const ListValue* args) {
const chromeos::input_method::InputMethodDescriptor& descriptor =
manager->current_input_method();
StringValue param(descriptor.id());
- web_ui_->CallJavascriptFunction("initKeyboardOverlayId", param);
+ web_ui()->CallJavascriptFunction("initKeyboardOverlayId", param);
}
void KeyboardOverlayHandler::GetLabelMap(const ListValue* args) {
@@ -276,7 +270,7 @@ void KeyboardOverlayHandler::GetLabelMap(const ListValue* args) {
dict.SetString(ModifierKeyToLabel(i->first), ModifierKeyToLabel(i->second));
}
- web_ui_->CallJavascriptFunction("initIdentifierMap", dict);
+ web_ui()->CallJavascriptFunction("initIdentifierMap", dict);
}
////////////////////////////////////////////////////////////////////////////////
@@ -289,7 +283,7 @@ KeyboardOverlayUI::KeyboardOverlayUI(TabContents* contents)
: HtmlDialogUI(contents) {
Profile* profile = Profile::FromBrowserContext(contents->GetBrowserContext());
KeyboardOverlayHandler* handler = new KeyboardOverlayHandler(profile);
- AddMessageHandler((handler)->Attach(this));
+ AddMessageHandler(handler);
// Set up the chrome://keyboardoverlay/ source.
profile->GetChromeURLDataManager()->AddDataSource(
diff --git a/chrome/browser/ui/webui/chromeos/login/base_screen_handler.cc b/chrome/browser/ui/webui/chromeos/login/base_screen_handler.cc
index 3d0bca9..619798c 100644
--- a/chrome/browser/ui/webui/chromeos/login/base_screen_handler.cc
+++ b/chrome/browser/ui/webui/chromeos/login/base_screen_handler.cc
@@ -22,13 +22,13 @@ void BaseScreenHandler::InitializeBase() {
void BaseScreenHandler::ShowScreen(const char* screen_name,
const base::DictionaryValue* data) {
- if (!web_ui_)
+ if (!web_ui())
return;
DictionaryValue screen_params;
screen_params.SetString("id", screen_name);
if (data)
screen_params.SetWithoutPathExpansion("data", data->DeepCopy());
- web_ui_->CallJavascriptFunction("cr.ui.Oobe.showScreen", screen_params);
+ web_ui()->CallJavascriptFunction("cr.ui.Oobe.showScreen", screen_params);
}
diff --git a/chrome/browser/ui/webui/chromeos/login/core_oobe_handler.cc b/chrome/browser/ui/webui/chromeos/login/core_oobe_handler.cc
index c46eeb9..4636bf3 100644
--- a/chrome/browser/ui/webui/chromeos/login/core_oobe_handler.cc
+++ b/chrome/browser/ui/webui/chromeos/login/core_oobe_handler.cc
@@ -53,10 +53,10 @@ void CoreOobeHandler::Initialize() {
}
void CoreOobeHandler::RegisterMessages() {
- web_ui_->RegisterMessageCallback(kJsApiToggleAccessibility,
+ web_ui()->RegisterMessageCallback(kJsApiToggleAccessibility,
base::Bind(&CoreOobeHandler::OnToggleAccessibility,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback(kJsApiScreenStateInitialize,
+ web_ui()->RegisterMessageCallback(kJsApiScreenStateInitialize,
base::Bind(&CoreOobeHandler::OnInitialized,
base::Unretained(this)));
}
@@ -66,7 +66,7 @@ void CoreOobeHandler::OnInitialized(const base::ListValue* args) {
}
void CoreOobeHandler::OnToggleAccessibility(const base::ListValue* args) {
- accessibility::ToggleAccessibility(web_ui_);
+ accessibility::ToggleAccessibility(web_ui());
}
void CoreOobeHandler::ShowOobeUI(bool show) {
@@ -81,7 +81,7 @@ void CoreOobeHandler::ShowOobeUI(bool show) {
void CoreOobeHandler::UpdateOobeUIVisibility() {
base::FundamentalValue showValue(show_oobe_ui_);
- web_ui_->CallJavascriptFunction("cr.ui.Oobe.showOobeUI", showValue);
+ web_ui()->CallJavascriptFunction("cr.ui.Oobe.showOobeUI", showValue);
}
void CoreOobeHandler::OnOSVersionLabelTextUpdated(
@@ -98,9 +98,9 @@ void CoreOobeHandler::UpdateLabel(const std::string& id,
const std::string& text) {
base::StringValue id_value(UTF8ToUTF16(id));
base::StringValue text_value(UTF8ToUTF16(text));
- web_ui_->CallJavascriptFunction("cr.ui.Oobe.setLabelText",
- id_value,
- text_value);
+ web_ui()->CallJavascriptFunction("cr.ui.Oobe.setLabelText",
+ id_value,
+ text_value);
}
} // namespace chromeos
diff --git a/chrome/browser/ui/webui/chromeos/login/enterprise_oauth_enrollment_screen_handler.cc b/chrome/browser/ui/webui/chromeos/login/enterprise_oauth_enrollment_screen_handler.cc
index 35e57e5..9cd829f 100644
--- a/chrome/browser/ui/webui/chromeos/login/enterprise_oauth_enrollment_screen_handler.cc
+++ b/chrome/browser/ui/webui/chromeos/login/enterprise_oauth_enrollment_screen_handler.cc
@@ -95,19 +95,19 @@ EnterpriseOAuthEnrollmentScreenHandler::
// EnterpriseOAuthEnrollmentScreenHandler, WebUIMessageHandler implementation --
void EnterpriseOAuthEnrollmentScreenHandler::RegisterMessages() {
- web_ui_->RegisterMessageCallback(
+ web_ui()->RegisterMessageCallback(
"oauthEnrollClose",
base::Bind(&EnterpriseOAuthEnrollmentScreenHandler::HandleClose,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback(
+ web_ui()->RegisterMessageCallback(
"oauthEnrollCancel",
base::Bind(&EnterpriseOAuthEnrollmentScreenHandler::HandleCancel,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback(
+ web_ui()->RegisterMessageCallback(
"oauthEnrollCompleteLogin",
base::Bind(&EnterpriseOAuthEnrollmentScreenHandler::HandleCompleteLogin,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback(
+ web_ui()->RegisterMessageCallback(
"oauthEnrollRetry",
base::Bind(&EnterpriseOAuthEnrollmentScreenHandler::HandleRetry,
base::Unretained(this)));
@@ -386,8 +386,8 @@ void EnterpriseOAuthEnrollmentScreenHandler::EnrollAfterLogin() {
UMA_HISTOGRAM_ENUMERATION(policy::kMetricEnrollment,
policy::kMetricEnrollmentStarted,
policy::kMetricEnrollmentSize);
- Profile* profile =
- Profile::FromBrowserContext(web_ui_->tab_contents()->GetBrowserContext());
+ Profile* profile = Profile::FromBrowserContext(
+ web_ui()->tab_contents()->GetBrowserContext());
oauth_fetcher_.reset(
new GaiaOAuthFetcher(this,
profile->GetRequestContext(),
@@ -404,8 +404,8 @@ void EnterpriseOAuthEnrollmentScreenHandler::ShowStep(const char* step) {
RevokeTokens();
base::StringValue step_value(step);
- web_ui_->CallJavascriptFunction("oobe.OAuthEnrollmentScreen.showStep",
- step_value);
+ web_ui()->CallJavascriptFunction("oobe.OAuthEnrollmentScreen.showStep",
+ step_value);
}
void EnterpriseOAuthEnrollmentScreenHandler::ShowError(int message_id,
@@ -416,16 +416,16 @@ void EnterpriseOAuthEnrollmentScreenHandler::ShowError(int message_id,
const std::string message(l10n_util::GetStringUTF8(message_id));
base::StringValue message_value(message);
base::FundamentalValue retry_value(retry);
- web_ui_->CallJavascriptFunction("oobe.OAuthEnrollmentScreen.showError",
- message_value,
- retry_value);
+ web_ui()->CallJavascriptFunction("oobe.OAuthEnrollmentScreen.showError",
+ message_value,
+ retry_value);
}
void EnterpriseOAuthEnrollmentScreenHandler::ShowWorking(int message_id) {
const std::string message(l10n_util::GetStringUTF8(message_id));
base::StringValue message_value(message);
- web_ui_->CallJavascriptFunction("oobe.OAuthEnrollmentScreen.showWorking",
- message_value);
+ web_ui()->CallJavascriptFunction("oobe.OAuthEnrollmentScreen.showWorking",
+ message_value);
}
void EnterpriseOAuthEnrollmentScreenHandler::ResetAuth() {
@@ -434,8 +434,8 @@ void EnterpriseOAuthEnrollmentScreenHandler::ResetAuth() {
if (browsing_data_remover_)
return;
- Profile* profile =
- Profile::FromBrowserContext(web_ui_->tab_contents()->GetBrowserContext());
+ Profile* profile = Profile::FromBrowserContext(
+ web_ui()->tab_contents()->GetBrowserContext());
browsing_data_remover_ =
new BrowsingDataRemover(profile,
BrowsingDataRemover::EVERYTHING,
@@ -445,8 +445,8 @@ void EnterpriseOAuthEnrollmentScreenHandler::ResetAuth() {
}
void EnterpriseOAuthEnrollmentScreenHandler::RevokeTokens() {
- Profile* profile =
- Profile::FromBrowserContext(web_ui_->tab_contents()->GetBrowserContext());
+ Profile* profile = Profile::FromBrowserContext(
+ web_ui()->tab_contents()->GetBrowserContext());
if (!access_token_.empty()) {
new TokenRevoker(access_token_, access_token_secret_, profile);
diff --git a/chrome/browser/ui/webui/chromeos/login/eula_screen_handler.cc b/chrome/browser/ui/webui/chromeos/login/eula_screen_handler.cc
index b8fa2d4..a782813 100644
--- a/chrome/browser/ui/webui/chromeos/login/eula_screen_handler.cc
+++ b/chrome/browser/ui/webui/chromeos/login/eula_screen_handler.cc
@@ -86,13 +86,13 @@ void EulaScreenHandler::Initialize() {
return;
base::FundamentalValue checked(delegate_->IsUsageStatsEnabled());
- web_ui_->CallJavascriptFunction("cr.ui.Oobe.setUsageStats", checked);
+ web_ui()->CallJavascriptFunction("cr.ui.Oobe.setUsageStats", checked);
// This OEM EULA is a file:// URL which we're unable to load in iframe.
// Instead if it's defined we use chrome://terms/oem that will load same file.
if (!delegate_->GetOemEulaUrl().is_empty()) {
StringValue oem_eula_url(chrome::kChromeUITermsOemURL);
- web_ui_->CallJavascriptFunction("cr.ui.Oobe.setOemEulaUrl", oem_eula_url);
+ web_ui()->CallJavascriptFunction("cr.ui.Oobe.setOemEulaUrl", oem_eula_url);
}
if (show_on_init_) {
@@ -102,19 +102,19 @@ void EulaScreenHandler::Initialize() {
}
void EulaScreenHandler::RegisterMessages() {
- web_ui_->RegisterMessageCallback("eulaOnExit",
+ web_ui()->RegisterMessageCallback("eulaOnExit",
base::Bind(&EulaScreenHandler::HandleOnExit,base::Unretained(this)));
- web_ui_->RegisterMessageCallback("eulaOnLearnMore",
+ web_ui()->RegisterMessageCallback("eulaOnLearnMore",
base::Bind(&EulaScreenHandler::HandleOnLearnMore,base::Unretained(this)));
- web_ui_->RegisterMessageCallback("eulaOnTpmPopupOpened",
+ web_ui()->RegisterMessageCallback("eulaOnTpmPopupOpened",
base::Bind(&EulaScreenHandler::HandleOnTpmPopupOpened,
base::Unretained(this)));
}
void EulaScreenHandler::OnPasswordFetched(const std::string& tpm_password) {
StringValue tpm_password_value(tpm_password);
- web_ui_->CallJavascriptFunction("cr.ui.Oobe.setTpmPassword",
- tpm_password_value);
+ web_ui()->CallJavascriptFunction("cr.ui.Oobe.setTpmPassword",
+ tpm_password_value);
}
void EulaScreenHandler::HandleOnExit(const base::ListValue* args) {
diff --git a/chrome/browser/ui/webui/chromeos/login/network_dropdown_handler.cc b/chrome/browser/ui/webui/chromeos/login/network_dropdown_handler.cc
index 2151725..9bc58ad 100644
--- a/chrome/browser/ui/webui/chromeos/login/network_dropdown_handler.cc
+++ b/chrome/browser/ui/webui/chromeos/login/network_dropdown_handler.cc
@@ -42,16 +42,16 @@ void NetworkDropdownHandler::Initialize() {
}
void NetworkDropdownHandler::RegisterMessages() {
- web_ui_->RegisterMessageCallback(kJsApiNetworkItemChosen,
+ web_ui()->RegisterMessageCallback(kJsApiNetworkItemChosen,
base::Bind(&NetworkDropdownHandler::HandleNetworkItemChosen,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback(kJsApiNetworkDropdownShow,
+ web_ui()->RegisterMessageCallback(kJsApiNetworkDropdownShow,
base::Bind(&NetworkDropdownHandler::HandleNetworkDropdownShow,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback(kJsApiNetworkDropdownHide,
+ web_ui()->RegisterMessageCallback(kJsApiNetworkDropdownHide,
base::Bind(&NetworkDropdownHandler::HandleNetworkDropdownHide,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback(kJsApiNetworkDropdownRefresh,
+ web_ui()->RegisterMessageCallback(kJsApiNetworkDropdownRefresh,
base::Bind(&NetworkDropdownHandler::HandleNetworkDropdownRefresh,
base::Unretained(this)));
}
@@ -81,7 +81,7 @@ void NetworkDropdownHandler::HandleNetworkDropdownShow(
if (!args->GetDouble(2, &last_network_type))
NOTREACHED();
- dropdown_.reset(new NetworkDropdown(web_ui_, oobe));
+ dropdown_.reset(new NetworkDropdown(web_ui(), oobe));
if (last_network_type >= 0) {
dropdown_->SetLastNetworkType(
diff --git a/chrome/browser/ui/webui/chromeos/login/network_screen_handler.cc b/chrome/browser/ui/webui/chromeos/login/network_screen_handler.cc
index 06325f2..8d968a3 100644
--- a/chrome/browser/ui/webui/chromeos/login/network_screen_handler.cc
+++ b/chrome/browser/ui/webui/chromeos/login/network_screen_handler.cc
@@ -79,12 +79,12 @@ void NetworkScreenHandler::Hide() {
void NetworkScreenHandler::ShowError(const string16& message) {
scoped_ptr<Value> message_value(Value::CreateStringValue(message));
- web_ui_->CallJavascriptFunction("oobe.NetworkScreen.showError",
- *message_value);
+ web_ui()->CallJavascriptFunction("oobe.NetworkScreen.showError",
+ *message_value);
}
void NetworkScreenHandler::ClearErrors() {
- web_ui_->CallJavascriptFunction("oobe.NetworkScreen.clearErrors");
+ web_ui()->CallJavascriptFunction("oobe.NetworkScreen.clearErrors");
}
void NetworkScreenHandler::ShowConnectingStatus(
@@ -97,10 +97,10 @@ void NetworkScreenHandler::ShowConnectingStatus(
// scoped_ptr<Value> network_id_value(Value::CreateStringValue(network_id));
// scoped_ptr<Value> connecting_label_value(
// Value::CreateStringValue(connecting_label));
- // web_ui_->CallJavascriptFunction("cr.ui.Oobe.showConnectingStatus",
- // *connecting_value,
- // *network_id_value,
- // *connecting_label_value);
+ // web_ui()->CallJavascriptFunction("cr.ui.Oobe.showConnectingStatus",
+ // *connecting_value,
+ // *network_id_value,
+ // *connecting_label_value);
}
void NetworkScreenHandler::EnableContinue(bool enabled) {
@@ -109,8 +109,8 @@ void NetworkScreenHandler::EnableContinue(bool enabled) {
return;
scoped_ptr<Value> enabled_value(Value::CreateBooleanValue(enabled));
- web_ui_->CallJavascriptFunction("cr.ui.Oobe.enableContinueButton",
- *enabled_value);
+ web_ui()->CallJavascriptFunction("cr.ui.Oobe.enableContinueButton",
+ *enabled_value);
}
// NetworkScreenHandler, BaseScreenHandler implementation: --------------------
@@ -142,12 +142,12 @@ void NetworkScreenHandler::Initialize() {
// NetworkScreenHandler, WebUIMessageHandler implementation: -------------------
void NetworkScreenHandler::RegisterMessages() {
- web_ui_->RegisterMessageCallback(kJsApiNetworkOnExit,
+ web_ui()->RegisterMessageCallback(kJsApiNetworkOnExit,
base::Bind(&NetworkScreenHandler::HandleOnExit,base::Unretained(this)));
- web_ui_->RegisterMessageCallback(kJsApiNetworkOnLanguageChanged,
+ web_ui()->RegisterMessageCallback(kJsApiNetworkOnLanguageChanged,
base::Bind(&NetworkScreenHandler::HandleOnLanguageChanged,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback(kJsApiNetworkOnInputMethodChanged,
+ web_ui()->RegisterMessageCallback(kJsApiNetworkOnInputMethodChanged,
base::Bind(&NetworkScreenHandler::HandleOnInputMethodChanged,
base::Unretained(this)));
}
@@ -169,9 +169,9 @@ void NetworkScreenHandler::HandleOnLanguageChanged(const ListValue* args) {
LanguageSwitchMenu::SwitchLanguageAndEnableKeyboardLayouts(locale);
DictionaryValue localized_strings;
- static_cast<OobeUI*>(web_ui_)->GetLocalizedStrings(&localized_strings);
- web_ui_->CallJavascriptFunction("cr.ui.Oobe.reloadContent",
- localized_strings);
+ static_cast<OobeUI*>(web_ui())->GetLocalizedStrings(&localized_strings);
+ web_ui()->CallJavascriptFunction("cr.ui.Oobe.reloadContent",
+ localized_strings);
// Buttons are recreated, updated "Continue" button state.
EnableContinue(is_continue_enabled_);
}
diff --git a/chrome/browser/ui/webui/chromeos/login/oobe_ui.cc b/chrome/browser/ui/webui/chromeos/login/oobe_ui.cc
index 160fb42..64b140b 100644
--- a/chrome/browser/ui/webui/chromeos/login/oobe_ui.cc
+++ b/chrome/browser/ui/webui/chromeos/login/oobe_ui.cc
@@ -218,7 +218,7 @@ void OobeUI::GetLocalizedStrings(base::DictionaryValue* localized_strings) {
}
void OobeUI::AddScreenHandler(BaseScreenHandler* handler) {
- AddMessageHandler(handler->Attach(this));
+ AddMessageHandler(handler);
}
void OobeUI::InitializeHandlers() {
diff --git a/chrome/browser/ui/webui/chromeos/login/signin_screen_handler.cc b/chrome/browser/ui/webui/chromeos/login/signin_screen_handler.cc
index 25a6ff8..dfa05e9 100644
--- a/chrome/browser/ui/webui/chromeos/login/signin_screen_handler.cc
+++ b/chrome/browser/ui/webui/chromeos/login/signin_screen_handler.cc
@@ -346,57 +346,57 @@ void SigninScreenHandler::Initialize() {
}
void SigninScreenHandler::RegisterMessages() {
- network_state_informer_.reset(new NetworkStateInformer(web_ui_));
+ network_state_informer_.reset(new NetworkStateInformer(web_ui()));
- web_ui_->RegisterMessageCallback("authenticateUser",
+ web_ui()->RegisterMessageCallback("authenticateUser",
base::Bind(&SigninScreenHandler::HandleAuthenticateUser,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("completeLogin",
+ web_ui()->RegisterMessageCallback("completeLogin",
base::Bind(&SigninScreenHandler::HandleCompleteLogin,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("getUsers",
+ web_ui()->RegisterMessageCallback("getUsers",
base::Bind(&SigninScreenHandler::HandleGetUsers,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("launchIncognito",
+ web_ui()->RegisterMessageCallback("launchIncognito",
base::Bind(&SigninScreenHandler::HandleLaunchIncognito,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("fixCaptivePortal",
+ web_ui()->RegisterMessageCallback("fixCaptivePortal",
base::Bind(&SigninScreenHandler::HandleFixCaptivePortal,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("showAddUser",
+ web_ui()->RegisterMessageCallback("showAddUser",
base::Bind(&SigninScreenHandler::HandleShowAddUser,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("shutdownSystem",
+ web_ui()->RegisterMessageCallback("shutdownSystem",
base::Bind(&SigninScreenHandler::HandleShutdownSystem,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("removeUser",
+ web_ui()->RegisterMessageCallback("removeUser",
base::Bind(&SigninScreenHandler::HandleRemoveUser,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("toggleEnrollmentScreen",
+ web_ui()->RegisterMessageCallback("toggleEnrollmentScreen",
base::Bind(&SigninScreenHandler::HandleToggleEnrollmentScreen,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("launchHelpApp",
+ web_ui()->RegisterMessageCallback("launchHelpApp",
base::Bind(&SigninScreenHandler::HandleLaunchHelpApp,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("createAccount",
+ web_ui()->RegisterMessageCallback("createAccount",
base::Bind(&SigninScreenHandler::HandleCreateAccount,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("accountPickerReady",
+ web_ui()->RegisterMessageCallback("accountPickerReady",
base::Bind(&SigninScreenHandler::HandleAccountPickerReady,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("loginWebuiReady",
+ web_ui()->RegisterMessageCallback("loginWebuiReady",
base::Bind(&SigninScreenHandler::HandleLoginWebuiReady,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("loginRequestNetworkState",
+ web_ui()->RegisterMessageCallback("loginRequestNetworkState",
base::Bind(&SigninScreenHandler::HandleLoginRequestNetworkState,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("loginAddNetworkStateObserver",
+ web_ui()->RegisterMessageCallback("loginAddNetworkStateObserver",
base::Bind(&SigninScreenHandler::HandleLoginAddNetworkStateObserver,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("loginRemoveNetworkStateObserver",
+ web_ui()->RegisterMessageCallback("loginRemoveNetworkStateObserver",
base::Bind(&SigninScreenHandler::HandleLoginRemoveNetworkStateObserver,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("signOutUser",
+ web_ui()->RegisterMessageCallback("signOutUser",
base::Bind(&SigninScreenHandler::HandleSignOutUser,
base::Unretained(this)));
}
@@ -406,12 +406,12 @@ void SigninScreenHandler::HandleGetUsers(const base::ListValue* args) {
}
void SigninScreenHandler::ClearAndEnablePassword() {
- web_ui_->CallJavascriptFunction("cr.ui.Oobe.resetSigninUI");
+ web_ui()->CallJavascriptFunction("cr.ui.Oobe.resetSigninUI");
}
void SigninScreenHandler::OnLoginSuccess(const std::string& username) {
base::StringValue username_value(username);
- web_ui_->CallJavascriptFunction("cr.ui.Oobe.onLoginSuccess", username_value);
+ web_ui()->CallJavascriptFunction("cr.ui.Oobe.onLoginSuccess", username_value);
}
void SigninScreenHandler::OnUserRemoved(const std::string& username) {
@@ -420,7 +420,7 @@ void SigninScreenHandler::OnUserRemoved(const std::string& username) {
void SigninScreenHandler::OnUserImageChanged(const User& user) {
base::StringValue user_email(user.email());
- web_ui_->CallJavascriptFunction(
+ web_ui()->CallJavascriptFunction(
"login.AccountPickerScreen.updateUserImage", user_email);
}
@@ -439,11 +439,11 @@ void SigninScreenHandler::ShowError(int login_attempts,
base::StringValue error_message(error_text);
base::StringValue help_link(help_link_text);
base::FundamentalValue help_id(static_cast<int>(help_topic_id));
- web_ui_->CallJavascriptFunction("cr.ui.Oobe.showSignInError",
- login_attempts_value,
- error_message,
- help_link,
- help_id);
+ web_ui()->CallJavascriptFunction("cr.ui.Oobe.showSignInError",
+ login_attempts_value,
+ error_message,
+ help_link,
+ help_id);
}
void SigninScreenHandler::OnBrowsingDataRemoverDone() {
@@ -456,7 +456,7 @@ void SigninScreenHandler::OnBrowsingDataRemoverDone() {
void SigninScreenHandler::OnCapsLockChange(bool enabled) {
if (page_is_ready()) {
base::FundamentalValue capsLockState(enabled);
- web_ui_->CallJavascriptFunction(
+ web_ui()->CallJavascriptFunction(
"login.AccountPickerScreen.setCapsLockState", capsLockState);
}
}
@@ -518,8 +518,8 @@ void SigninScreenHandler::LoadAuthExtension(bool force, bool silent_load) {
test_pass_.clear();
}
}
- web_ui_->CallJavascriptFunction("login.GaiaSigninScreen.loadAuthExtension",
- params);
+ web_ui()->CallJavascriptFunction("login.GaiaSigninScreen.loadAuthExtension",
+ params);
}
@@ -690,8 +690,8 @@ void SigninScreenHandler::SendUserList(bool animated) {
// Call the Javascript callback
base::FundamentalValue animated_value(animated);
- web_ui_->CallJavascriptFunction("login.AccountPickerScreen.loadUsers",
- users_list, animated_value);
+ web_ui()->CallJavascriptFunction("login.AccountPickerScreen.loadUsers",
+ users_list, animated_value);
}
void SigninScreenHandler::HandleAccountPickerReady(
@@ -782,7 +782,8 @@ void SigninScreenHandler::StartClearingCookies() {
cookie_remover_->RemoveObserver(this);
cookie_remover_ = new BrowsingDataRemover(
- Profile::FromBrowserContext(web_ui_->tab_contents()->GetBrowserContext()),
+ Profile::FromBrowserContext(
+ web_ui()->tab_contents()->GetBrowserContext()),
BrowsingDataRemover::EVERYTHING,
base::Time());
cookie_remover_->AddObserver(this);
diff --git a/chrome/browser/ui/webui/chromeos/login/update_screen_handler.cc b/chrome/browser/ui/webui/chromeos/login/update_screen_handler.cc
index db71515..aba57d5 100644
--- a/chrome/browser/ui/webui/chromeos/login/update_screen_handler.cc
+++ b/chrome/browser/ui/webui/chromeos/login/update_screen_handler.cc
@@ -65,7 +65,7 @@ void UpdateScreenHandler::Show() {
}
ShowScreen(kUpdateScreen, NULL);
#if !defined(OFFICIAL_BUILD)
- web_ui_->CallJavascriptFunction("oobe.UpdateScreen.enableUpdateCancel");
+ web_ui()->CallJavascriptFunction("oobe.UpdateScreen.enableUpdateCancel");
#endif
}
@@ -77,18 +77,19 @@ void UpdateScreenHandler::PrepareToShow() {
void UpdateScreenHandler::ShowManualRebootInfo() {
StringValue message(l10n_util::GetStringUTF16(IDS_UPDATE_COMPLETED));
- web_ui_->CallJavascriptFunction("cr.ui.Oobe.setUpdateMessage", message);
+ web_ui()->CallJavascriptFunction("cr.ui.Oobe.setUpdateMessage", message);
}
void UpdateScreenHandler::SetProgress(int progress) {
base::FundamentalValue progress_value(progress);
- web_ui_->CallJavascriptFunction("cr.ui.Oobe.setUpdateProgress",
- progress_value);
+ web_ui()->CallJavascriptFunction("cr.ui.Oobe.setUpdateProgress",
+ progress_value);
}
void UpdateScreenHandler::ShowCurtain(bool enable) {
base::FundamentalValue enable_value(enable);
- web_ui_->CallJavascriptFunction("cr.ui.Oobe.showUpdateCurtain", enable_value);
+ web_ui()->CallJavascriptFunction(
+ "cr.ui.Oobe.showUpdateCurtain", enable_value);
}
void UpdateScreenHandler::ShowPreparingUpdatesInfo(bool visible) {
@@ -101,13 +102,13 @@ void UpdateScreenHandler::ShowPreparingUpdatesInfo(bool visible) {
l10n_util::GetStringFUTF16(IDS_INSTALLING_UPDATE,
l10n_util::GetStringUTF16(IDS_SHORT_PRODUCT_NAME))));
}
- web_ui_->CallJavascriptFunction("cr.ui.Oobe.setUpdateMessage",
- *info_message);
+ web_ui()->CallJavascriptFunction("cr.ui.Oobe.setUpdateMessage",
+ *info_message);
}
void UpdateScreenHandler::RegisterMessages() {
#if !defined(OFFICIAL_BUILD)
- web_ui_->RegisterMessageCallback("cancelUpdate",
+ web_ui()->RegisterMessageCallback("cancelUpdate",
base::Bind(&UpdateScreenHandler::HandleUpdateCancel,
base::Unretained(this)));
#endif
diff --git a/chrome/browser/ui/webui/chromeos/login/user_image_screen_handler.cc b/chrome/browser/ui/webui/chromeos/login/user_image_screen_handler.cc
index ebea2ae..e460d0b4c 100644
--- a/chrome/browser/ui/webui/chromeos/login/user_image_screen_handler.cc
+++ b/chrome/browser/ui/webui/chromeos/login/user_image_screen_handler.cc
@@ -67,8 +67,8 @@ void UserImageScreenHandler::Initialize() {
for (int i = 0; i < kDefaultImagesCount; ++i) {
image_urls.Append(new StringValue(GetDefaultImageUrl(i)));
}
- web_ui_->CallJavascriptFunction("oobe.UserImageScreen.setUserImages",
- image_urls);
+ web_ui()->CallJavascriptFunction("oobe.UserImageScreen.setUserImages",
+ image_urls);
if (selected_image_ != User::kInvalidImageIndex)
SelectImage(selected_image_);
@@ -111,7 +111,7 @@ void UserImageScreenHandler::SelectImage(int index) {
selected_image_ = index;
if (page_is_ready()) {
base::StringValue image_url(GetDefaultImageUrl(index));
- web_ui_->CallJavascriptFunction(
+ web_ui()->CallJavascriptFunction(
"oobe.UserImageScreen.setSelectedImage",
image_url);
}
@@ -137,16 +137,16 @@ bool UserImageScreenHandler::IsCapturing() const {
}
void UserImageScreenHandler::RegisterMessages() {
- web_ui_->RegisterMessageCallback("takePhoto",
+ web_ui()->RegisterMessageCallback("takePhoto",
base::Bind(&UserImageScreenHandler::HandleTakePhoto,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("selectImage",
+ web_ui()->RegisterMessageCallback("selectImage",
base::Bind(&UserImageScreenHandler::HandleSelectImage,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("onUserImageAccepted",
+ web_ui()->RegisterMessageCallback("onUserImageAccepted",
base::Bind(&UserImageScreenHandler::HandleImageAccepted,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("onUserImageScreenShown",
+ web_ui()->RegisterMessageCallback("onUserImageScreenShown",
base::Bind(&UserImageScreenHandler::HandleScreenShown,
base::Unretained(this)));
}
@@ -159,8 +159,8 @@ void UserImageScreenHandler::AddProfileImage(const SkBitmap& image) {
void UserImageScreenHandler::SendProfileImage(const std::string& data_url) {
if (page_is_ready()) {
base::StringValue data_url_value(data_url);
- web_ui_->CallJavascriptFunction("oobe.UserImageScreen.setProfileImage",
- data_url_value);
+ web_ui()->CallJavascriptFunction("oobe.UserImageScreen.setProfileImage",
+ data_url_value);
}
}
@@ -168,8 +168,8 @@ void UserImageScreenHandler::OnProfileImageAbsent() {
profile_picture_absent_ = true;
if (page_is_ready()) {
scoped_ptr<base::Value> null_value(base::Value::CreateNullValue());
- web_ui_->CallJavascriptFunction("oobe.UserImageScreen.setProfileImage",
- *null_value);
+ web_ui()->CallJavascriptFunction("oobe.UserImageScreen.setProfileImage",
+ *null_value);
}
}
@@ -178,8 +178,8 @@ void UserImageScreenHandler::OnPhotoAccepted(const SkBitmap& photo) {
user_photo_data_url_ = web_ui_util::GetImageDataUrl(user_photo_);
selected_image_ = User::kExternalImageIndex;
base::StringValue data_url(user_photo_data_url_);
- web_ui_->CallJavascriptFunction("oobe.UserImageScreen.setUserPhoto",
- data_url);
+ web_ui()->CallJavascriptFunction("oobe.UserImageScreen.setUserPhoto",
+ data_url);
}
void UserImageScreenHandler::HandleTakePhoto(const base::ListValue* args) {
@@ -245,8 +245,8 @@ void UserImageScreenHandler::HandleScreenShown(const base::ListValue* args) {
void UserImageScreenHandler::OnCameraPresenceCheckDone() {
base::FundamentalValue present_value(
CameraDetector::camera_presence() == CameraDetector::kCameraPresent);
- web_ui_->CallJavascriptFunction("oobe.UserImageScreen.setCameraPresent",
- present_value);
+ web_ui()->CallJavascriptFunction("oobe.UserImageScreen.setCameraPresent",
+ present_value);
}
} // namespace chromeos
diff --git a/chrome/browser/ui/webui/chromeos/mobile_setup_ui.cc b/chrome/browser/ui/webui/chromeos/mobile_setup_ui.cc
index 5e7ffe48..33323c0 100644
--- a/chrome/browser/ui/webui/chromeos/mobile_setup_ui.cc
+++ b/chrome/browser/ui/webui/chromeos/mobile_setup_ui.cc
@@ -219,11 +219,9 @@ class MobileSetupHandler
virtual ~MobileSetupHandler();
// Init work after Attach.
- void Init(TabContents* contents);
void StartActivationOnUIThread();
// WebUIMessageHandler implementation.
- virtual WebUIMessageHandler* Attach(WebUI* web_ui) OVERRIDE;
virtual void RegisterMessages() OVERRIDE;
// NetworkLibrary::NetworkManagerObserver implementation.
@@ -326,7 +324,6 @@ class MobileSetupHandler
static const char* GetStateDescription(PlanActivationState state);
scoped_refptr<CellularConfigDocument> cellular_config_;
- TabContents* tab_contents_;
// Internal handler state.
PlanActivationState state_;
std::string service_path_;
@@ -488,7 +485,6 @@ void MobileSetupUIHTMLSource::StartDataRequest(const std::string& path,
////////////////////////////////////////////////////////////////////////////////
MobileSetupHandler::MobileSetupHandler(const std::string& service_path)
: cellular_config_(new CellularConfigDocument()),
- tab_contents_(NULL),
state_(PLAN_ACTIVATION_PAGE_LOADING),
service_path_(service_path),
reenable_cert_check_(false),
@@ -511,22 +507,14 @@ MobileSetupHandler::~MobileSetupHandler() {
ReEnableCertRevocationChecking();
}
-WebUIMessageHandler* MobileSetupHandler::Attach(WebUI* web_ui) {
- return WebUIMessageHandler::Attach(web_ui);
-}
-
-void MobileSetupHandler::Init(TabContents* contents) {
- tab_contents_ = contents;
-}
-
void MobileSetupHandler::RegisterMessages() {
- web_ui_->RegisterMessageCallback(kJsApiStartActivation,
+ web_ui()->RegisterMessageCallback(kJsApiStartActivation,
base::Bind(&MobileSetupHandler::HandleStartActivation,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback(kJsApiSetTransactionStatus,
+ web_ui()->RegisterMessageCallback(kJsApiSetTransactionStatus,
base::Bind(&MobileSetupHandler::HandleSetTransactionStatus,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback(kJsApiPaymentPortalLoad,
+ web_ui()->RegisterMessageCallback(kJsApiPaymentPortalLoad,
base::Bind(&MobileSetupHandler::HandlePaymentPortalLoad,
base::Unretained(this)));
}
@@ -789,7 +777,7 @@ bool MobileSetupHandler::ConnectionTimeout() {
void MobileSetupHandler::EvaluateCellularNetwork(
chromeos::CellularNetwork* network) {
- if (!web_ui_)
+ if (!web_ui())
return;
PlanActivationState new_state = state_;
@@ -1137,7 +1125,7 @@ void MobileSetupHandler::UpdatePage(
device_dict.SetInteger("state", state_);
if (error_description.length())
device_dict.SetString("error", error_description);
- web_ui_->CallJavascriptFunction(
+ web_ui()->CallJavascriptFunction(
kJsDeviceStatusChangedCallback, device_dict);
}
@@ -1365,8 +1353,7 @@ MobileSetupUI::MobileSetupUI(TabContents* contents) : ChromeWebUI(contents) {
chromeos::CellularNetwork* network = GetCellularNetwork();
std::string service_path = network ? network->service_path() : std::string();
MobileSetupHandler* handler = new MobileSetupHandler(service_path);
- AddMessageHandler((handler)->Attach(this));
- handler->Init(contents);
+ AddMessageHandler(handler);
MobileSetupUIHTMLSource* html_source =
new MobileSetupUIHTMLSource(service_path);
diff --git a/chrome/browser/ui/webui/chromeos/proxy_settings_ui.cc b/chrome/browser/ui/webui/chromeos/proxy_settings_ui.cc
index bbb063e..e46a1ff 100644
--- a/chrome/browser/ui/webui/chromeos/proxy_settings_ui.cc
+++ b/chrome/browser/ui/webui/chromeos/proxy_settings_ui.cc
@@ -73,10 +73,10 @@ ProxySettingsUI::ProxySettingsUI(TabContents* contents)
CoreChromeOSOptionsHandler* core_handler = new CoreChromeOSOptionsHandler();
core_handler->set_handlers_host(this);
core_handler->GetLocalizedValues(localized_strings);
- AddMessageHandler(core_handler->Attach(this));
+ AddMessageHandler(core_handler);
proxy_handler_->GetLocalizedValues(localized_strings);
- AddMessageHandler(proxy_handler_->Attach(this));
+ AddMessageHandler(proxy_handler_);
ProxySettingsHTMLSource* source =
new ProxySettingsHTMLSource(localized_strings);
diff --git a/chrome/browser/ui/webui/chromeos/register_page_ui.cc b/chrome/browser/ui/webui/chromeos/register_page_ui.cc
index e1e582f..1d2d8c1 100644
--- a/chrome/browser/ui/webui/chromeos/register_page_ui.cc
+++ b/chrome/browser/ui/webui/chromeos/register_page_ui.cc
@@ -111,11 +111,7 @@ class RegisterPageHandler : public WebUIMessageHandler,
RegisterPageHandler();
virtual ~RegisterPageHandler();
- // Init work after Attach.
- void Init();
-
// WebUIMessageHandler implementation.
- virtual WebUIMessageHandler* Attach(WebUI* web_ui) OVERRIDE;
virtual void RegisterMessages() OVERRIDE;
private:
@@ -192,19 +188,12 @@ RegisterPageHandler::RegisterPageHandler() {
RegisterPageHandler::~RegisterPageHandler() {
}
-WebUIMessageHandler* RegisterPageHandler::Attach(WebUI* web_ui) {
- return WebUIMessageHandler::Attach(web_ui);
-}
-
-void RegisterPageHandler::Init() {
-}
-
void RegisterPageHandler::RegisterMessages() {
#if defined(OS_CHROMEOS)
- web_ui_->RegisterMessageCallback(kJsCallbackGetRegistrationUrl,
+ web_ui()->RegisterMessageCallback(kJsCallbackGetRegistrationUrl,
base::Bind(&RegisterPageHandler::HandleGetRegistrationUrl,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback(kJsCallbackUserInfo,
+ web_ui()->RegisterMessageCallback(kJsCallbackUserInfo,
base::Bind(&RegisterPageHandler::HandleGetUserInfo,
base::Unretained(this)));
#endif
@@ -224,7 +213,7 @@ void RegisterPageHandler::HandleGetRegistrationUrl(const ListValue* args) {
return;
}
StringValue url_value(url);
- web_ui_->CallJavascriptFunction(kJsApiSetRegistrationUrl, url_value);
+ web_ui()->CallJavascriptFunction(kJsApiSetRegistrationUrl, url_value);
} else {
SkipRegistration("Startup manifest not defined.");
}
@@ -258,7 +247,7 @@ void RegisterPageHandler::SkipRegistration(const std::string& error_msg) {
if (chromeos::WizardController::default_controller())
chromeos::WizardController::default_controller()->SkipRegistration();
else
- web_ui_->CallJavascriptFunction(kJsApiSkipRegistration);
+ web_ui()->CallJavascriptFunction(kJsApiSkipRegistration);
#endif
}
@@ -291,7 +280,7 @@ void RegisterPageHandler::SendUserInfo() {
value.SetString("user_first_name", "");
value.SetString("user_last_name", "");
- web_ui_->CallJavascriptFunction(kJsApiSetUserInfo, value);
+ web_ui()->CallJavascriptFunction(kJsApiSetUserInfo, value);
#endif
}
@@ -303,8 +292,7 @@ void RegisterPageHandler::SendUserInfo() {
RegisterPageUI::RegisterPageUI(TabContents* contents) : ChromeWebUI(contents) {
RegisterPageHandler* handler = new RegisterPageHandler();
- AddMessageHandler((handler)->Attach(this));
- handler->Init();
+ AddMessageHandler(handler);
RegisterPageUIHTMLSource* html_source = new RegisterPageUIHTMLSource();
// Set up the chrome://register/ source.
diff --git a/chrome/browser/ui/webui/chromeos/sim_unlock_ui.cc b/chrome/browser/ui/webui/chromeos/sim_unlock_ui.cc
index 36ef28e..c32c180 100644
--- a/chrome/browser/ui/webui/chromeos/sim_unlock_ui.cc
+++ b/chrome/browser/ui/webui/chromeos/sim_unlock_ui.cc
@@ -94,11 +94,7 @@ class SimUnlockHandler : public WebUIMessageHandler,
SimUnlockHandler();
virtual ~SimUnlockHandler();
- // Init work after Attach.
- void Init(TabContents* contents);
-
// WebUIMessageHandler implementation.
- virtual WebUIMessageHandler* Attach(WebUI* web_ui) OVERRIDE;
virtual void RegisterMessages() OVERRIDE;
// NetworkLibrary::NetworkDeviceObserver implementation.
@@ -217,8 +213,6 @@ class SimUnlockHandler : public WebUIMessageHandler,
void UpdatePage(const chromeos::NetworkDevice* cellular,
const std::string& error_msg);
- TabContents* tab_contents_;
-
// Dialog internal state.
SimUnlockState state_;
@@ -317,8 +311,7 @@ void SimUnlockUIHTMLSource::StartDataRequest(const std::string& path,
// SimUnlockHandler ------------------------------------------------------------
SimUnlockHandler::SimUnlockHandler()
- : tab_contents_(NULL),
- state_(SIM_UNLOCK_LOADING),
+ : state_(SIM_UNLOCK_LOADING),
dialog_mode_(SimDialogDelegate::SIM_DIALOG_UNLOCK),
pending_pin_operation_(false) {
const chromeos::NetworkDevice* cellular = GetCellularDevice();
@@ -339,31 +332,23 @@ SimUnlockHandler::~SimUnlockHandler() {
}
}
-WebUIMessageHandler* SimUnlockHandler::Attach(WebUI* web_ui) {
- return WebUIMessageHandler::Attach(web_ui);
-}
-
-void SimUnlockHandler::Init(TabContents* contents) {
- tab_contents_ = contents;
-}
-
void SimUnlockHandler::RegisterMessages() {
- web_ui_->RegisterMessageCallback(kJsApiCancel,
+ web_ui()->RegisterMessageCallback(kJsApiCancel,
base::Bind(&SimUnlockHandler::HandleCancel,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback(kJsApiChangePinCode,
+ web_ui()->RegisterMessageCallback(kJsApiChangePinCode,
base::Bind(&SimUnlockHandler::HandleChangePinCode,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback(kJsApiEnterPinCode,
+ web_ui()->RegisterMessageCallback(kJsApiEnterPinCode,
base::Bind(&SimUnlockHandler::HandleEnterPinCode,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback(kJsApiEnterPukCode,
+ web_ui()->RegisterMessageCallback(kJsApiEnterPukCode,
base::Bind(&SimUnlockHandler::HandleEnterPukCode,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback(kJsApiProceedToPukInput,
+ web_ui()->RegisterMessageCallback(kJsApiProceedToPukInput,
base::Bind(&SimUnlockHandler::HandleProceedToPukInput,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback(kJsApiSimStatusInitialize,
+ web_ui()->RegisterMessageCallback(kJsApiSimStatusInitialize,
base::Bind(&SimUnlockHandler::HandleSimStatusInitialize,
base::Unretained(this)));
}
@@ -669,15 +654,14 @@ void SimUnlockHandler::UpdatePage(const chromeos::NetworkDevice* cellular,
sim_dict.SetString(kError, error_msg);
else
sim_dict.SetString(kError, kErrorOk);
- web_ui_->CallJavascriptFunction(kJsApiSimStatusChanged, sim_dict);
+ web_ui()->CallJavascriptFunction(kJsApiSimStatusChanged, sim_dict);
}
// SimUnlockUI -----------------------------------------------------------------
SimUnlockUI::SimUnlockUI(TabContents* contents) : ChromeWebUI(contents) {
SimUnlockHandler* handler = new SimUnlockHandler();
- AddMessageHandler((handler)->Attach(this));
- handler->Init(contents);
+ AddMessageHandler(handler);
SimUnlockUIHTMLSource* html_source = new SimUnlockUIHTMLSource();
// Set up the chrome://sim-unlock/ source.
diff --git a/chrome/browser/ui/webui/chromeos/system_info_ui.cc b/chrome/browser/ui/webui/chromeos/system_info_ui.cc
index edaf793..89052f5 100644
--- a/chrome/browser/ui/webui/chromeos/system_info_ui.cc
+++ b/chrome/browser/ui/webui/chromeos/system_info_ui.cc
@@ -69,7 +69,6 @@ class SystemInfoHandler : public WebUIMessageHandler,
virtual ~SystemInfoHandler();
// WebUIMessageHandler implementation.
- virtual WebUIMessageHandler* Attach(WebUI* web_ui) OVERRIDE;
virtual void RegisterMessages() OVERRIDE;
private:
@@ -159,11 +158,6 @@ SystemInfoHandler::SystemInfoHandler() {
SystemInfoHandler::~SystemInfoHandler() {
}
-WebUIMessageHandler* SystemInfoHandler::Attach(WebUI* web_ui) {
- // TODO(stevenjb): customize handler attach if needed...
- return WebUIMessageHandler::Attach(web_ui);
-}
-
void SystemInfoHandler::RegisterMessages() {
// TODO(stevenjb): add message registration, callbacks...
}
@@ -176,7 +170,7 @@ void SystemInfoHandler::RegisterMessages() {
SystemInfoUI::SystemInfoUI(TabContents* contents) : ChromeWebUI(contents) {
SystemInfoHandler* handler = new SystemInfoHandler();
- AddMessageHandler((handler)->Attach(this));
+ AddMessageHandler(handler);
SystemInfoUIHTMLSource* html_source = new SystemInfoUIHTMLSource();
// Set up the chrome://system/ source.
diff --git a/chrome/browser/ui/webui/cloud_print_signin_dialog.cc b/chrome/browser/ui/webui/cloud_print_signin_dialog.cc
index 679b013..1bc641b 100644
--- a/chrome/browser/ui/webui/cloud_print_signin_dialog.cc
+++ b/chrome/browser/ui/webui/cloud_print_signin_dialog.cc
@@ -62,13 +62,13 @@ CloudPrintSigninFlowHandler::CloudPrintSigninFlowHandler(
}
void CloudPrintSigninFlowHandler::RegisterMessages() {
- if (web_ui_ && web_ui_->tab_contents()) {
+ if (web_ui() && web_ui()->tab_contents()) {
NavigationController* controller =
- &web_ui_->tab_contents()->GetController();
+ &web_ui()->tab_contents()->GetController();
NavigationEntry* pending_entry = controller->GetPendingEntry();
if (pending_entry)
pending_entry->SetURL(CloudPrintURL(
- Profile::FromWebUI(web_ui_)).GetCloudPrintSigninURL());
+ Profile::FromWebUI(web_ui())).GetCloudPrintSigninURL());
registrar_.Add(this, content::NOTIFICATION_NAV_ENTRY_COMMITTED,
content::Source<NavigationController>(controller));
}
@@ -79,14 +79,14 @@ void CloudPrintSigninFlowHandler::Observe(
const content::NotificationSource& source,
const content::NotificationDetails& details) {
if (type == content::NOTIFICATION_NAV_ENTRY_COMMITTED) {
- GURL url = web_ui_->tab_contents()->GetURL();
+ GURL url = web_ui()->tab_contents()->GetURL();
GURL dialog_url = CloudPrintURL(
- Profile::FromWebUI(web_ui_)).GetCloudPrintServiceURL();
+ Profile::FromWebUI(web_ui())).GetCloudPrintServiceURL();
if (url.host() == dialog_url.host() &&
url.path() == dialog_url.path() &&
url.scheme() == dialog_url.scheme()) {
StoreDialogSize();
- web_ui_->tab_contents()->GetRenderViewHost()->ClosePage();
+ web_ui()->tab_contents()->GetRenderViewHost()->ClosePage();
static_cast<PrintPreviewUI*>(
parent_tab_->GetWebUI())->OnReloadPrintersList();
}
@@ -94,9 +94,11 @@ void CloudPrintSigninFlowHandler::Observe(
}
void CloudPrintSigninFlowHandler::StoreDialogSize() {
- if (web_ui_ && web_ui_->tab_contents() && web_ui_->tab_contents()->GetView()) {
- gfx::Size size = web_ui_->tab_contents()->GetView()->GetContainerSize();
- Profile* profile = Profile::FromWebUI(web_ui_);
+ if (web_ui() &&
+ web_ui()->tab_contents() &&
+ web_ui()->tab_contents()->GetView()) {
+ gfx::Size size = web_ui()->tab_contents()->GetView()->GetContainerSize();
+ Profile* profile = Profile::FromWebUI(web_ui());
profile->GetPrefs()->SetInteger(prefs::kCloudPrintSigninDialogWidth,
size.width());
profile->GetPrefs()->SetInteger(
diff --git a/chrome/browser/ui/webui/collected_cookies_ui_delegate.cc b/chrome/browser/ui/webui/collected_cookies_ui_delegate.cc
index b7a21a0..affcb87 100644
--- a/chrome/browser/ui/webui/collected_cookies_ui_delegate.cc
+++ b/chrome/browser/ui/webui/collected_cookies_ui_delegate.cc
@@ -213,31 +213,31 @@ bool CollectedCookiesUIDelegate::ShouldShowDialogTitle() const {
}
void CollectedCookiesUIDelegate::RegisterMessages() {
- web_ui_->RegisterMessageCallback("BindCookiesTreeModel",
+ web_ui()->RegisterMessageCallback("BindCookiesTreeModel",
base::Bind(&CollectedCookiesUIDelegate::BindCookiesTreeModel,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("Block",
+ web_ui()->RegisterMessageCallback("Block",
base::Bind(&CollectedCookiesUIDelegate::Block,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("Allow",
+ web_ui()->RegisterMessageCallback("Allow",
base::Bind(&CollectedCookiesUIDelegate::Allow,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("AllowThisSession",
+ web_ui()->RegisterMessageCallback("AllowThisSession",
base::Bind(&CollectedCookiesUIDelegate::AllowThisSession,
base::Unretained(this)));
- allowed_cookies_adapter_.Init(web_ui_);
- blocked_cookies_adapter_.Init(web_ui_);
+ allowed_cookies_adapter_.Init(web_ui());
+ blocked_cookies_adapter_.Init(web_ui());
}
void CollectedCookiesUIDelegate::CloseDialog() {
- if (!closed_ && web_ui_)
- web_ui_->CallJavascriptFunction("closeDialog");
+ if (!closed_ && web_ui())
+ web_ui()->CallJavascriptFunction("closeDialog");
}
void CollectedCookiesUIDelegate::SetInfobarLabel(const std::string& text) {
StringValue string(text);
- web_ui_->CallJavascriptFunction("setInfobarLabel", string);
+ web_ui()->CallJavascriptFunction("setInfobarLabel", string);
}
void CollectedCookiesUIDelegate::AddContentException(
diff --git a/chrome/browser/ui/webui/conflicts_ui.cc b/chrome/browser/ui/webui/conflicts_ui.cc
index d410bc5..1647e5a 100644
--- a/chrome/browser/ui/webui/conflicts_ui.cc
+++ b/chrome/browser/ui/webui/conflicts_ui.cc
@@ -96,7 +96,7 @@ class ConflictsDOMHandler : public WebUIMessageHandler,
};
void ConflictsDOMHandler::RegisterMessages() {
- web_ui_->RegisterMessageCallback("requestModuleList",
+ web_ui()->RegisterMessageCallback("requestModuleList",
base::Bind(&ConflictsDOMHandler::HandleRequestModuleList,
base::Unretained(this)));
}
@@ -131,7 +131,7 @@ void ConflictsDOMHandler::SendModuleList() {
}
results.SetString("modulesTableTitle", table_title);
- web_ui_->CallJavascriptFunction("returnModuleList", results);
+ web_ui()->CallJavascriptFunction("returnModuleList", results);
}
void ConflictsDOMHandler::Observe(int type,
@@ -158,7 +158,7 @@ void ConflictsDOMHandler::Observe(int type,
ConflictsUI::ConflictsUI(TabContents* contents) : ChromeWebUI(contents) {
content::RecordAction(UserMetricsAction("ViewAboutConflicts"));
- AddMessageHandler((new ConflictsDOMHandler())->Attach(this));
+ AddMessageHandler(new ConflictsDOMHandler());
// Set up the about:conflicts source.
Profile* profile = Profile::FromBrowserContext(contents->GetBrowserContext());
diff --git a/chrome/browser/ui/webui/constrained_html_ui.cc b/chrome/browser/ui/webui/constrained_html_ui.cc
index 1c6515d..8b89607 100644
--- a/chrome/browser/ui/webui/constrained_html_ui.cc
+++ b/chrome/browser/ui/webui/constrained_html_ui.cc
@@ -42,7 +42,6 @@ void ConstrainedHtmlUI::RenderViewCreated(RenderViewHost* render_view_host) {
dialog_delegate->GetDialogArgs());
for (std::vector<WebUIMessageHandler*>::iterator it = handlers.begin();
it != handlers.end(); ++it) {
- (*it)->Attach(this);
AddMessageHandler(*it);
}
diff --git a/chrome/browser/ui/webui/crashes_ui.cc b/chrome/browser/ui/webui/crashes_ui.cc
index d0cf130..42c184b 100644
--- a/chrome/browser/ui/webui/crashes_ui.cc
+++ b/chrome/browser/ui/webui/crashes_ui.cc
@@ -71,7 +71,6 @@ class CrashesDOMHandler : public WebUIMessageHandler,
virtual ~CrashesDOMHandler();
// WebUIMessageHandler implementation.
- virtual WebUIMessageHandler* Attach(WebUI* web_ui) OVERRIDE;
virtual void RegisterMessages() OVERRIDE;
// CrashUploadList::Delegate implemenation.
@@ -100,13 +99,10 @@ CrashesDOMHandler::~CrashesDOMHandler() {
upload_list_->ClearDelegate();
}
-WebUIMessageHandler* CrashesDOMHandler::Attach(WebUI* web_ui) {
+void CrashesDOMHandler::RegisterMessages() {
upload_list_->LoadCrashListAsynchronously();
- return WebUIMessageHandler::Attach(web_ui);
-}
-void CrashesDOMHandler::RegisterMessages() {
- web_ui_->RegisterMessageCallback("requestCrashList",
+ web_ui()->RegisterMessageCallback("requestCrashList",
base::Bind(&CrashesDOMHandler::HandleRequestCrashes,
base::Unretained(this)));
}
@@ -147,8 +143,8 @@ void CrashesDOMHandler::UpdateUI() {
const chrome::VersionInfo version_info;
base::StringValue version(version_info.Version());
- web_ui_->CallJavascriptFunction("updateCrashList", enabled, crash_list,
- version);
+ web_ui()->CallJavascriptFunction("updateCrashList", enabled, crash_list,
+ version);
}
} // namespace
@@ -160,7 +156,7 @@ void CrashesDOMHandler::UpdateUI() {
///////////////////////////////////////////////////////////////////////////////
CrashesUI::CrashesUI(TabContents* contents) : ChromeWebUI(contents) {
- AddMessageHandler((new CrashesDOMHandler())->Attach(this));
+ AddMessageHandler(new CrashesDOMHandler());
// Set up the chrome://crashes/ source.
Profile* profile = Profile::FromBrowserContext(contents->GetBrowserContext());
diff --git a/chrome/browser/ui/webui/downloads_dom_handler.cc b/chrome/browser/ui/webui/downloads_dom_handler.cc
index 3b6e091..415b98c 100644
--- a/chrome/browser/ui/webui/downloads_dom_handler.cc
+++ b/chrome/browser/ui/webui/downloads_dom_handler.cc
@@ -155,40 +155,40 @@ void DownloadsDOMHandler::Init() {
}
void DownloadsDOMHandler::RegisterMessages() {
- web_ui_->RegisterMessageCallback("getDownloads",
+ web_ui()->RegisterMessageCallback("getDownloads",
base::Bind(&DownloadsDOMHandler::HandleGetDownloads,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("openFile",
+ web_ui()->RegisterMessageCallback("openFile",
base::Bind(&DownloadsDOMHandler::HandleOpenFile,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("drag",
+ web_ui()->RegisterMessageCallback("drag",
base::Bind(&DownloadsDOMHandler::HandleDrag,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("saveDangerous",
+ web_ui()->RegisterMessageCallback("saveDangerous",
base::Bind(&DownloadsDOMHandler::HandleSaveDangerous,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("discardDangerous",
+ web_ui()->RegisterMessageCallback("discardDangerous",
base::Bind(&DownloadsDOMHandler::HandleDiscardDangerous,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("show",
+ web_ui()->RegisterMessageCallback("show",
base::Bind(&DownloadsDOMHandler::HandleShow,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("togglepause",
+ web_ui()->RegisterMessageCallback("togglepause",
base::Bind(&DownloadsDOMHandler::HandlePause,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("resume",
+ web_ui()->RegisterMessageCallback("resume",
base::Bind(&DownloadsDOMHandler::HandlePause,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("remove",
+ web_ui()->RegisterMessageCallback("remove",
base::Bind(&DownloadsDOMHandler::HandleRemove,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("cancel",
+ web_ui()->RegisterMessageCallback("cancel",
base::Bind(&DownloadsDOMHandler::HandleCancel,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("clearAll",
+ web_ui()->RegisterMessageCallback("clearAll",
base::Bind(&DownloadsDOMHandler::HandleClearAll,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("openDownloadsFolder",
+ web_ui()->RegisterMessageCallback("openDownloadsFolder",
base::Bind(&DownloadsDOMHandler::HandleOpenDownloadsFolder,
base::Unretained(this)));
}
@@ -216,7 +216,7 @@ void DownloadsDOMHandler::OnDownloadUpdated(content::DownloadItem* download) {
ListValue results_value;
results_value.Append(download_util::CreateDownloadItemValue(download, id));
- web_ui_->CallJavascriptFunction("downloadUpdated", results_value);
+ web_ui()->CallJavascriptFunction("downloadUpdated", results_value);
}
// A download has started or been deleted. Query our DownloadManager for the
@@ -289,7 +289,7 @@ void DownloadsDOMHandler::HandleDrag(const ListValue* args) {
IconManager* im = g_browser_process->icon_manager();
gfx::Image* icon = im->LookupIcon(file->GetUserVerifiedFilePath(),
IconLoader::NORMAL);
- gfx::NativeView view = web_ui_->tab_contents()->GetNativeView();
+ gfx::NativeView view = web_ui()->tab_contents()->GetNativeView();
{
// Enable nested tasks during DnD, while |DragDownload()| blocks.
MessageLoop::ScopedNestableTaskAllower allower(MessageLoop::current());
@@ -377,7 +377,7 @@ void DownloadsDOMHandler::SendCurrentDownloads() {
results_value.Append(download_util::CreateDownloadItemValue(*it, index));
}
- web_ui_->CallJavascriptFunction("downloadsList", results_value);
+ web_ui()->CallJavascriptFunction("downloadsList", results_value);
}
void DownloadsDOMHandler::ClearDownloadItems() {
diff --git a/chrome/browser/ui/webui/downloads_ui.cc b/chrome/browser/ui/webui/downloads_ui.cc
index 9c2edbe..d2a4376 100644
--- a/chrome/browser/ui/webui/downloads_ui.cc
+++ b/chrome/browser/ui/webui/downloads_ui.cc
@@ -89,7 +89,6 @@ DownloadsUI::DownloadsUI(TabContents* contents) : ChromeWebUI(contents) {
DownloadsDOMHandler* handler = new DownloadsDOMHandler(dlm);
AddMessageHandler(handler);
- handler->Attach(this);
handler->Init();
// Set up the chrome://downloads/ source.
diff --git a/chrome/browser/ui/webui/edit_search_engine_dialog_webui.cc b/chrome/browser/ui/webui/edit_search_engine_dialog_webui.cc
index a0e41b7..d608b5a 100644
--- a/chrome/browser/ui/webui/edit_search_engine_dialog_webui.cc
+++ b/chrome/browser/ui/webui/edit_search_engine_dialog_webui.cc
@@ -125,10 +125,10 @@ EditSearchEngineDialogHandlerWebUI::~EditSearchEngineDialogHandlerWebUI() {
// Overridden from WebUIMessageHandler
void EditSearchEngineDialogHandlerWebUI::RegisterMessages() {
- web_ui_->RegisterMessageCallback("requestDetails",
+ web_ui()->RegisterMessageCallback("requestDetails",
base::Bind(&EditSearchEngineDialogHandlerWebUI::RequestDetails,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("requestValidation",
+ web_ui()->RegisterMessageCallback("requestValidation",
base::Bind(&EditSearchEngineDialogHandlerWebUI::RequestValidation,
base::Unretained(this)));
}
@@ -141,8 +141,8 @@ void EditSearchEngineDialogHandlerWebUI::RequestDetails(
dict.SetString("url", controller_->template_url()->url()->DisplayURL());
// Send list of tab contents details to javascript.
- web_ui_->CallJavascriptFunction("editSearchEngineDialog.setDetails",
- dict);
+ web_ui()->CallJavascriptFunction("editSearchEngineDialog.setDetails",
+ dict);
}
void EditSearchEngineDialogHandlerWebUI::RequestValidation(
@@ -162,8 +162,8 @@ void EditSearchEngineDialogHandlerWebUI::RequestValidation(
validation.SetBoolean("url", isUrlValid);
validation.SetBoolean("ok", isDescriptionValid && isKeywordValid &&
isUrlValid);
- web_ui_->CallJavascriptFunction("editSearchEngineDialog.setValidation",
- validation);
+ web_ui()->CallJavascriptFunction("editSearchEngineDialog.setValidation",
+ validation);
}
}
diff --git a/chrome/browser/ui/webui/extensions/extensions_ui.cc b/chrome/browser/ui/webui/extensions/extensions_ui.cc
index 1340c3e..d646179 100644
--- a/chrome/browser/ui/webui/extensions/extensions_ui.cc
+++ b/chrome/browser/ui/webui/extensions/extensions_ui.cc
@@ -37,7 +37,7 @@ ExtensionsUI::ExtensionsUI(TabContents* contents) : ChromeWebUI(contents) {
ExtensionSettingsHandler* handler = new ExtensionSettingsHandler();
handler->GetLocalizedValues(source->localized_strings());
- AddMessageHandler(handler->Attach(this));
+ AddMessageHandler(handler);
}
ExtensionsUI::~ExtensionsUI() {
diff --git a/chrome/browser/ui/webui/flags_ui.cc b/chrome/browser/ui/webui/flags_ui.cc
index c952feb..818378b 100644
--- a/chrome/browser/ui/webui/flags_ui.cc
+++ b/chrome/browser/ui/webui/flags_ui.cc
@@ -104,13 +104,13 @@ class FlagsDOMHandler : public WebUIMessageHandler {
};
void FlagsDOMHandler::RegisterMessages() {
- web_ui_->RegisterMessageCallback("requestFlagsExperiments",
+ web_ui()->RegisterMessageCallback("requestFlagsExperiments",
base::Bind(&FlagsDOMHandler::HandleRequestFlagsExperiments,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("enableFlagsExperiment",
+ web_ui()->RegisterMessageCallback("enableFlagsExperiment",
base::Bind(&FlagsDOMHandler::HandleEnableFlagsExperimentMessage,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("restartBrowser",
+ web_ui()->RegisterMessageCallback("restartBrowser",
base::Bind(&FlagsDOMHandler::HandleRestartBrowser,
base::Unretained(this)));
}
@@ -122,7 +122,7 @@ void FlagsDOMHandler::HandleRequestFlagsExperiments(const ListValue* args) {
g_browser_process->local_state()));
results.SetBoolean("needsRestart",
about_flags::IsRestartNeededToCommitChanges());
- web_ui_->CallJavascriptFunction("returnFlagsExperiments", results);
+ web_ui()->CallJavascriptFunction("returnFlagsExperiments", results);
}
void FlagsDOMHandler::HandleEnableFlagsExperimentMessage(
@@ -156,7 +156,7 @@ void FlagsDOMHandler::HandleRestartBrowser(const ListValue* args) {
///////////////////////////////////////////////////////////////////////////////
FlagsUI::FlagsUI(TabContents* contents) : ChromeWebUI(contents) {
- AddMessageHandler((new FlagsDOMHandler())->Attach(this));
+ AddMessageHandler(new FlagsDOMHandler());
// Set up the about:flags source.
Profile* profile = Profile::FromBrowserContext(contents->GetBrowserContext());
diff --git a/chrome/browser/ui/webui/flash_ui.cc b/chrome/browser/ui/webui/flash_ui.cc
index d836b90..43639a9 100644
--- a/chrome/browser/ui/webui/flash_ui.cc
+++ b/chrome/browser/ui/webui/flash_ui.cc
@@ -163,7 +163,7 @@ FlashDOMHandler::~FlashDOMHandler() {
}
void FlashDOMHandler::RegisterMessages() {
- web_ui_->RegisterMessageCallback("requestFlashInfo",
+ web_ui()->RegisterMessageCallback("requestFlashInfo",
base::Bind(&FlashDOMHandler::HandleRequestFlashInfo,
base::Unretained(this)));
}
@@ -267,7 +267,7 @@ void FlashDOMHandler::MaybeRespondToPage() {
AddPair(list, ASCIIToUTF16("Flash plugin"), "Disabled");
} else {
PluginPrefs* plugin_prefs =
- PluginPrefs::GetForProfile(Profile::FromWebUI(web_ui_));
+ PluginPrefs::GetForProfile(Profile::FromWebUI(web_ui()));
for (size_t i = 0; i < info_array.size(); ++i) {
if (plugin_prefs->IsPluginEnabled(info_array[i])) {
flash_version = info_array[i].version + ASCIIToUTF16(" ") +
@@ -353,7 +353,7 @@ void FlashDOMHandler::MaybeRespondToPage() {
DictionaryValue flashInfo;
flashInfo.Set("flashInfo", list);
- web_ui_->CallJavascriptFunction("returnFlashInfo", flashInfo);
+ web_ui()->CallJavascriptFunction("returnFlashInfo", flashInfo);
}
} // namespace
@@ -368,7 +368,7 @@ FlashUI::FlashUI(TabContents* contents) : ChromeWebUI(contents) {
content::RecordAction(
UserMetricsAction("ViewAboutFlash"));
- AddMessageHandler((new FlashDOMHandler())->Attach(this));
+ AddMessageHandler(new FlashDOMHandler());
// Set up the about:flash source.
Profile* profile = Profile::FromBrowserContext(contents->GetBrowserContext());
diff --git a/chrome/browser/ui/webui/gpu_internals_ui.cc b/chrome/browser/ui/webui/gpu_internals_ui.cc
index 4aed34117..1e261d3 100644
--- a/chrome/browser/ui/webui/gpu_internals_ui.cc
+++ b/chrome/browser/ui/webui/gpu_internals_ui.cc
@@ -52,7 +52,6 @@ class GpuMessageHandler
virtual ~GpuMessageHandler();
// WebUIMessageHandler implementation.
- virtual WebUIMessageHandler* Attach(WebUI* web_ui) OVERRIDE;
virtual void RegisterMessages() OVERRIDE;
// GpuDataManager::Observer implementation.
@@ -93,20 +92,14 @@ GpuMessageHandler::~GpuMessageHandler() {
gpu_data_manager_->RemoveObserver(this);
}
-WebUIMessageHandler* GpuMessageHandler::Attach(WebUI* web_ui) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
- WebUIMessageHandler* result = WebUIMessageHandler::Attach(web_ui);
- return result;
-}
-
/* BrowserBridge.callAsync prepends a requestID to these messages. */
void GpuMessageHandler::RegisterMessages() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
- web_ui_->RegisterMessageCallback("browserBridgeInitialized",
+ web_ui()->RegisterMessageCallback("browserBridgeInitialized",
base::Bind(&GpuMessageHandler::OnBrowserBridgeInitialized,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("callAsync",
+ web_ui()->RegisterMessageCallback("callAsync",
base::Bind(&GpuMessageHandler::OnCallAsync,
base::Unretained(this)));
}
@@ -148,12 +141,12 @@ void GpuMessageHandler::OnCallAsync(const ListValue* args) {
// call BrowserBridge.onCallAsyncReply with result
if (ret) {
- web_ui_->CallJavascriptFunction("browserBridge.onCallAsyncReply",
+ web_ui()->CallJavascriptFunction("browserBridge.onCallAsyncReply",
*requestId,
*ret);
delete ret;
} else {
- web_ui_->CallJavascriptFunction("browserBridge.onCallAsyncReply",
+ web_ui()->CallJavascriptFunction("browserBridge.onCallAsyncReply",
*requestId);
}
}
@@ -230,7 +223,7 @@ void GpuMessageHandler::OnGpuInfoUpdate() {
gpu_info_val->Set("featureStatus", feature_status);
// Send GPU Info to javascript.
- web_ui_->CallJavascriptFunction("browserBridge.onGpuInfoUpdate",
+ web_ui()->CallJavascriptFunction("browserBridge.onGpuInfoUpdate",
*(gpu_info_val.get()));
}
@@ -244,7 +237,7 @@ void GpuMessageHandler::OnGpuInfoUpdate() {
////////////////////////////////////////////////////////////////////////////////
GpuInternalsUI::GpuInternalsUI(TabContents* contents) : ChromeWebUI(contents) {
- AddMessageHandler((new GpuMessageHandler())->Attach(this));
+ AddMessageHandler(new GpuMessageHandler());
// Set up the chrome://gpu-internals/ source.
Profile* profile = Profile::FromBrowserContext(contents->GetBrowserContext());
diff --git a/chrome/browser/ui/webui/history_ui.cc b/chrome/browser/ui/webui/history_ui.cc
index b4ade06..61e28c4 100644
--- a/chrome/browser/ui/webui/history_ui.cc
+++ b/chrome/browser/ui/webui/history_ui.cc
@@ -137,29 +137,26 @@ BrowsingHistoryHandler::~BrowsingHistoryHandler() {
cancelable_delete_consumer_.CancelAllRequests();
}
-WebUIMessageHandler* BrowsingHistoryHandler::Attach(WebUI* web_ui) {
+void BrowsingHistoryHandler::RegisterMessages() {
// Create our favicon data source.
- Profile* profile = Profile::FromWebUI(web_ui);
+ Profile* profile = Profile::FromWebUI(web_ui());
profile->GetChromeURLDataManager()->AddDataSource(
new FaviconSource(profile, FaviconSource::FAVICON));
// Get notifications when history is cleared.
registrar_.Add(this, chrome::NOTIFICATION_HISTORY_URLS_DELETED,
content::Source<Profile>(profile->GetOriginalProfile()));
- return WebUIMessageHandler::Attach(web_ui);
-}
-void BrowsingHistoryHandler::RegisterMessages() {
- web_ui_->RegisterMessageCallback("getHistory",
+ web_ui()->RegisterMessageCallback("getHistory",
base::Bind(&BrowsingHistoryHandler::HandleGetHistory,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("searchHistory",
+ web_ui()->RegisterMessageCallback("searchHistory",
base::Bind(&BrowsingHistoryHandler::HandleSearchHistory,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("removeURLsOnOneDay",
+ web_ui()->RegisterMessageCallback("removeURLsOnOneDay",
base::Bind(&BrowsingHistoryHandler::HandleRemoveURLsOnOneDay,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("clearBrowsingData",
+ web_ui()->RegisterMessageCallback("clearBrowsingData",
base::Bind(&BrowsingHistoryHandler::HandleClearBrowsingData,
base::Unretained(this)));
}
@@ -184,7 +181,7 @@ void BrowsingHistoryHandler::HandleGetHistory(const ListValue* args) {
search_text_ = string16();
HistoryService* hs =
- Profile::FromWebUI(web_ui_)->GetHistoryService(Profile::EXPLICIT_ACCESS);
+ Profile::FromWebUI(web_ui())->GetHistoryService(Profile::EXPLICIT_ACCESS);
hs->QueryHistory(search_text_,
options,
&cancelable_search_consumer_,
@@ -210,7 +207,7 @@ void BrowsingHistoryHandler::HandleSearchHistory(const ListValue* args) {
// Need to remember the query string for our results.
search_text_ = query;
HistoryService* hs =
- Profile::FromWebUI(web_ui_)->GetHistoryService(Profile::EXPLICIT_ACCESS);
+ Profile::FromWebUI(web_ui())->GetHistoryService(Profile::EXPLICIT_ACCESS);
hs->QueryHistory(search_text_,
options,
&cancelable_search_consumer_,
@@ -220,7 +217,7 @@ void BrowsingHistoryHandler::HandleSearchHistory(const ListValue* args) {
void BrowsingHistoryHandler::HandleRemoveURLsOnOneDay(const ListValue* args) {
if (cancelable_delete_consumer_.HasPendingRequests()) {
- web_ui_->CallJavascriptFunction("deleteFailed");
+ web_ui()->CallJavascriptFunction("deleteFailed");
return;
}
@@ -228,7 +225,7 @@ void BrowsingHistoryHandler::HandleRemoveURLsOnOneDay(const ListValue* args) {
int visit_time = 0;
if (!ExtractIntegerValue(args, &visit_time)) {
LOG(ERROR) << "Unable to extract integer argument.";
- web_ui_->CallJavascriptFunction("deleteFailed");
+ web_ui()->CallJavascriptFunction("deleteFailed");
return;
}
base::Time::Exploded exploded;
@@ -253,7 +250,7 @@ void BrowsingHistoryHandler::HandleRemoveURLsOnOneDay(const ListValue* args) {
}
HistoryService* hs =
- Profile::FromWebUI(web_ui_)->GetHistoryService(Profile::EXPLICIT_ACCESS);
+ Profile::FromWebUI(web_ui())->GetHistoryService(Profile::EXPLICIT_ACCESS);
hs->ExpireHistoryBetween(
urls_to_be_deleted_, begin_time, end_time, &cancelable_delete_consumer_,
base::Bind(&BrowsingHistoryHandler::RemoveComplete,
@@ -263,7 +260,7 @@ void BrowsingHistoryHandler::HandleRemoveURLsOnOneDay(const ListValue* args) {
void BrowsingHistoryHandler::HandleClearBrowsingData(const ListValue* args) {
// TODO(beng): This is an improper direct dependency on Browser. Route this
// through some sort of delegate.
- Profile* profile = Profile::FromWebUI(web_ui_);
+ Profile* profile = Profile::FromWebUI(web_ui());
Browser* browser = BrowserList::FindBrowserWithProfile(profile);
if (browser)
browser->OpenClearBrowsingDataDialog();
@@ -311,7 +308,7 @@ void BrowsingHistoryHandler::QueryComplete(
base::TimeFormatShortDate(page.visit_time()));
page_value->SetString("snippet", page.snippet().text());
}
- Profile* profile = Profile::FromWebUI(web_ui_);
+ Profile* profile = Profile::FromWebUI(web_ui());
page_value->SetBoolean("starred",
profile->GetBookmarkModel()->IsBookmarked(page.url()));
results_value.Append(page_value);
@@ -321,14 +318,14 @@ void BrowsingHistoryHandler::QueryComplete(
info_value.SetString("term", search_text_);
info_value.SetBoolean("finished", results->reached_beginning());
- web_ui_->CallJavascriptFunction("historyResult", info_value, results_value);
+ web_ui()->CallJavascriptFunction("historyResult", info_value, results_value);
}
void BrowsingHistoryHandler::RemoveComplete() {
urls_to_be_deleted_.clear();
// Notify the page that the deletion request succeeded.
- web_ui_->CallJavascriptFunction("deleteComplete");
+ web_ui()->CallJavascriptFunction("deleteComplete");
}
void BrowsingHistoryHandler::ExtractSearchHistoryArguments(
@@ -415,7 +412,7 @@ void BrowsingHistoryHandler::Observe(
if (deletedDetails->urls != urls_to_be_deleted_ ||
deletedDetails->all_history) {
// Notify the page that someone else deleted from the history.
- web_ui_->CallJavascriptFunction("historyDeleted");
+ web_ui()->CallJavascriptFunction("historyDeleted");
}
}
@@ -426,7 +423,7 @@ void BrowsingHistoryHandler::Observe(
////////////////////////////////////////////////////////////////////////////////
HistoryUI::HistoryUI(TabContents* contents) : ChromeWebUI(contents) {
- AddMessageHandler((new BrowsingHistoryHandler())->Attach(this));
+ AddMessageHandler(new BrowsingHistoryHandler());
HistoryUIHTMLSource* html_source = new HistoryUIHTMLSource();
diff --git a/chrome/browser/ui/webui/history_ui.h b/chrome/browser/ui/webui/history_ui.h
index 3c5d638..fe3e963 100644
--- a/chrome/browser/ui/webui/history_ui.h
+++ b/chrome/browser/ui/webui/history_ui.h
@@ -25,7 +25,6 @@ class BrowsingHistoryHandler : public WebUIMessageHandler,
virtual ~BrowsingHistoryHandler();
// WebUIMessageHandler implementation.
- virtual WebUIMessageHandler* Attach(WebUI* web_ui) OVERRIDE;
virtual void RegisterMessages() OVERRIDE;
// Callback for the "getHistory" message.
diff --git a/chrome/browser/ui/webui/html_dialog_ui.cc b/chrome/browser/ui/webui/html_dialog_ui.cc
index dce3f95..8eac496 100644
--- a/chrome/browser/ui/webui/html_dialog_ui.cc
+++ b/chrome/browser/ui/webui/html_dialog_ui.cc
@@ -66,7 +66,6 @@ void HtmlDialogUI::RenderViewCreated(RenderViewHost* render_view_host) {
render_view_host->SetWebUIProperty("dialogArguments", dialog_args);
for (std::vector<WebUIMessageHandler*>::iterator it = handlers.begin();
it != handlers.end(); ++it) {
- (*it)->Attach(this);
AddMessageHandler(*it);
}
diff --git a/chrome/browser/ui/webui/hung_renderer_dialog.cc b/chrome/browser/ui/webui/hung_renderer_dialog.cc
index b210356..224d7c3 100644
--- a/chrome/browser/ui/webui/hung_renderer_dialog.cc
+++ b/chrome/browser/ui/webui/hung_renderer_dialog.cc
@@ -213,12 +213,11 @@ HungRendererDialogHandler::HungRendererDialogHandler(
}
void HungRendererDialogHandler::CloseDialog() {
- DCHECK(web_ui_);
- static_cast<HtmlDialogUI*>(web_ui_)->CloseDialog(NULL);
+ static_cast<HtmlDialogUI*>(web_ui())->CloseDialog(NULL);
}
void HungRendererDialogHandler::RegisterMessages() {
- web_ui_->RegisterMessageCallback("requestTabContentsList",
+ web_ui()->RegisterMessageCallback("requestTabContentsList",
base::Bind(&HungRendererDialogHandler::RequestTabContentsList,
base::Unretained(this)));
}
@@ -240,6 +239,6 @@ void HungRendererDialogHandler::RequestTabContentsList(
}
}
// Send list of tab contents details to javascript.
- web_ui_->CallJavascriptFunction("hungRendererDialog.setTabContentsList",
- tab_contents_list);
+ web_ui()->CallJavascriptFunction("hungRendererDialog.setTabContentsList",
+ tab_contents_list);
}
diff --git a/chrome/browser/ui/webui/input_window_dialog_webui.cc b/chrome/browser/ui/webui/input_window_dialog_webui.cc
index 55ac8fe..9cd7c8c 100644
--- a/chrome/browser/ui/webui/input_window_dialog_webui.cc
+++ b/chrome/browser/ui/webui/input_window_dialog_webui.cc
@@ -150,12 +150,11 @@ InputWindowDialogHandler::InputWindowDialogHandler(
}
void InputWindowDialogHandler::CloseDialog() {
- DCHECK(web_ui_);
- static_cast<HtmlDialogUI*>(web_ui_)->CloseDialog(NULL);
+ static_cast<HtmlDialogUI*>(web_ui())->CloseDialog(NULL);
}
void InputWindowDialogHandler::RegisterMessages() {
- web_ui_->RegisterMessageCallback("validate",
+ web_ui()->RegisterMessageCallback("validate",
base::Bind(&InputWindowDialogHandler::Validate,
base::Unretained(this)));
}
@@ -173,6 +172,6 @@ void InputWindowDialogHandler::Validate(const base::ListValue* args) {
}
const bool valid = delegate_->IsValid(texts);
scoped_ptr<Value> result(Value::CreateBooleanValue(valid));
- web_ui_->CallJavascriptFunction("inputWindowDialog.ackValidation",
- *result);
+ web_ui()->CallJavascriptFunction("inputWindowDialog.ackValidation",
+ *result);
}
diff --git a/chrome/browser/ui/webui/media/media_internals_handler.cc b/chrome/browser/ui/webui/media/media_internals_handler.cc
index fc9a6be..392a0fd 100644
--- a/chrome/browser/ui/webui/media/media_internals_handler.cc
+++ b/chrome/browser/ui/webui/media/media_internals_handler.cc
@@ -22,17 +22,11 @@ MediaInternalsMessageHandler::~MediaInternalsMessageHandler() {
proxy_->Detach();
}
-WebUIMessageHandler* MediaInternalsMessageHandler::Attach(WebUI* web_ui) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
- WebUIMessageHandler* result = WebUIMessageHandler::Attach(web_ui);
- proxy_->Attach(this);
- return result;
-}
-
void MediaInternalsMessageHandler::RegisterMessages() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+ proxy_->Attach(this);
- web_ui_->RegisterMessageCallback("getEverything",
+ web_ui()->RegisterMessageCallback("getEverything",
base::Bind(&MediaInternalsMessageHandler::OnGetEverything,
base::Unretained(this)));
}
@@ -43,7 +37,7 @@ void MediaInternalsMessageHandler::OnGetEverything(const ListValue* list) {
void MediaInternalsMessageHandler::OnUpdate(const string16& update) {
// Don't try to execute JavaScript in a RenderView that no longer exists.
- RenderViewHost* host = web_ui_->tab_contents()->GetRenderViewHost();
+ RenderViewHost* host = web_ui()->tab_contents()->GetRenderViewHost();
if (host)
host->ExecuteJavascriptInWebFrame(string16(), update);
}
diff --git a/chrome/browser/ui/webui/media/media_internals_handler.h b/chrome/browser/ui/webui/media/media_internals_handler.h
index e9bdb00..1f0e9b9 100644
--- a/chrome/browser/ui/webui/media/media_internals_handler.h
+++ b/chrome/browser/ui/webui/media/media_internals_handler.h
@@ -22,7 +22,6 @@ class MediaInternalsMessageHandler : public WebUIMessageHandler {
virtual ~MediaInternalsMessageHandler();
// WebUIMessageHandler implementation.
- virtual WebUIMessageHandler* Attach(WebUI* web_ui) OVERRIDE;
virtual void RegisterMessages() OVERRIDE;
// Javascript message handlers.
diff --git a/chrome/browser/ui/webui/media/media_internals_ui.cc b/chrome/browser/ui/webui/media/media_internals_ui.cc
index 7ca2848..be68ef6 100644
--- a/chrome/browser/ui/webui/media/media_internals_ui.cc
+++ b/chrome/browser/ui/webui/media/media_internals_ui.cc
@@ -38,7 +38,7 @@ ChromeWebUIDataSource* CreateMediaInternalsHTMLSource() {
MediaInternalsUI::MediaInternalsUI(TabContents* contents)
: ChromeWebUI(contents) {
- AddMessageHandler((new MediaInternalsMessageHandler())->Attach(this));
+ AddMessageHandler(new MediaInternalsMessageHandler());
Profile* profile = Profile::FromBrowserContext(contents->GetBrowserContext());
profile->GetChromeURLDataManager()->AddDataSource(
diff --git a/chrome/browser/ui/webui/metrics_handler.cc b/chrome/browser/ui/webui/metrics_handler.cc
index da25979..52b1be1 100644
--- a/chrome/browser/ui/webui/metrics_handler.cc
+++ b/chrome/browser/ui/webui/metrics_handler.cc
@@ -24,14 +24,14 @@ MetricsHandler::MetricsHandler() {}
MetricsHandler::~MetricsHandler() {}
void MetricsHandler::RegisterMessages() {
- web_ui_->RegisterMessageCallback(
+ web_ui()->RegisterMessageCallback(
"metricsHandler:recordAction",
base::Bind(&MetricsHandler::HandleRecordAction, base::Unretained(this)));
- web_ui_->RegisterMessageCallback(
+ web_ui()->RegisterMessageCallback(
"metricsHandler:recordInHistogram",
base::Bind(&MetricsHandler::HandleRecordInHistogram,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback(
+ web_ui()->RegisterMessageCallback(
"metricsHandler:logEventTime",
base::Bind(&MetricsHandler::HandleLogEventTime, base::Unretained(this)));
}
@@ -77,7 +77,7 @@ void MetricsHandler::HandleRecordInHistogram(const ListValue* args) {
void MetricsHandler::HandleLogEventTime(const ListValue* args) {
std::string event_name = UTF16ToUTF8(ExtractStringValue(args));
- TabContents* tab = web_ui_->tab_contents();
+ TabContents* tab = web_ui()->tab_contents();
// Not all new tab pages get timed. In those cases, we don't have a
// new_tab_start_time_.
diff --git a/chrome/browser/ui/webui/net_internals_ui.cc b/chrome/browser/ui/webui/net_internals_ui.cc
index 581e32e..be5bae8 100644
--- a/chrome/browser/ui/webui/net_internals_ui.cc
+++ b/chrome/browser/ui/webui/net_internals_ui.cc
@@ -160,7 +160,6 @@ class NetInternalsMessageHandler
virtual ~NetInternalsMessageHandler();
// WebUIMessageHandler implementation.
- virtual WebUIMessageHandler* Attach(WebUI* web_ui) OVERRIDE;
virtual void RegisterMessages() OVERRIDE;
// Calls g_browser.receive in the renderer, passing in |command| and |arg|.
@@ -424,10 +423,10 @@ NetInternalsMessageHandler::~NetInternalsMessageHandler() {
}
}
-WebUIMessageHandler* NetInternalsMessageHandler::Attach(WebUI* web_ui) {
+void NetInternalsMessageHandler::RegisterMessages() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
- Profile* profile = Profile::FromWebUI(web_ui);
+ Profile* profile = Profile::FromWebUI(web_ui());
PrefService* pref_service = profile->GetPrefs();
http_throttling_enabled_.Init(
prefs::kHttpThrottlingEnabled, pref_service, this);
@@ -449,125 +448,119 @@ WebUIMessageHandler* NetInternalsMessageHandler::Attach(WebUI* web_ui) {
prerender_manager_ = base::WeakPtr<prerender::PrerenderManager>();
}
- WebUIMessageHandler* result = WebUIMessageHandler::Attach(web_ui);
- return result;
-}
-
-void NetInternalsMessageHandler::RegisterMessages() {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
- web_ui_->RegisterMessageCallback(
+ web_ui()->RegisterMessageCallback(
"notifyReady",
base::Bind(&NetInternalsMessageHandler::OnRendererReady,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback(
+ web_ui()->RegisterMessageCallback(
"getProxySettings",
base::Bind(&IOThreadImpl::CallbackHelper,
&IOThreadImpl::OnGetProxySettings, proxy_));
- web_ui_->RegisterMessageCallback(
+ web_ui()->RegisterMessageCallback(
"reloadProxySettings",
base::Bind(&IOThreadImpl::CallbackHelper,
&IOThreadImpl::OnReloadProxySettings, proxy_));
- web_ui_->RegisterMessageCallback(
+ web_ui()->RegisterMessageCallback(
"getBadProxies",
base::Bind(&IOThreadImpl::CallbackHelper,
&IOThreadImpl::OnGetBadProxies, proxy_));
- web_ui_->RegisterMessageCallback(
+ web_ui()->RegisterMessageCallback(
"clearBadProxies",
base::Bind(&IOThreadImpl::CallbackHelper,
&IOThreadImpl::OnClearBadProxies, proxy_));
- web_ui_->RegisterMessageCallback(
+ web_ui()->RegisterMessageCallback(
"getHostResolverInfo",
base::Bind(&IOThreadImpl::CallbackHelper,
&IOThreadImpl::OnGetHostResolverInfo, proxy_));
- web_ui_->RegisterMessageCallback(
+ web_ui()->RegisterMessageCallback(
"clearHostResolverCache",
base::Bind(&IOThreadImpl::CallbackHelper,
&IOThreadImpl::OnClearHostResolverCache, proxy_));
- web_ui_->RegisterMessageCallback(
+ web_ui()->RegisterMessageCallback(
"enableIPv6",
base::Bind(&IOThreadImpl::CallbackHelper,
&IOThreadImpl::OnEnableIPv6, proxy_));
- web_ui_->RegisterMessageCallback(
+ web_ui()->RegisterMessageCallback(
"startConnectionTests",
base::Bind(&IOThreadImpl::CallbackHelper,
&IOThreadImpl::OnStartConnectionTests, proxy_));
- web_ui_->RegisterMessageCallback(
+ web_ui()->RegisterMessageCallback(
"hstsQuery",
base::Bind(&IOThreadImpl::CallbackHelper,
&IOThreadImpl::OnHSTSQuery, proxy_));
- web_ui_->RegisterMessageCallback(
+ web_ui()->RegisterMessageCallback(
"hstsAdd",
base::Bind(&IOThreadImpl::CallbackHelper,
&IOThreadImpl::OnHSTSAdd, proxy_));
- web_ui_->RegisterMessageCallback(
+ web_ui()->RegisterMessageCallback(
"hstsDelete",
base::Bind(&IOThreadImpl::CallbackHelper,
&IOThreadImpl::OnHSTSDelete, proxy_));
- web_ui_->RegisterMessageCallback(
+ web_ui()->RegisterMessageCallback(
"getHttpCacheInfo",
base::Bind(&IOThreadImpl::CallbackHelper,
&IOThreadImpl::OnGetHttpCacheInfo, proxy_));
- web_ui_->RegisterMessageCallback(
+ web_ui()->RegisterMessageCallback(
"getSocketPoolInfo",
base::Bind(&IOThreadImpl::CallbackHelper,
&IOThreadImpl::OnGetSocketPoolInfo, proxy_));
- web_ui_->RegisterMessageCallback(
+ web_ui()->RegisterMessageCallback(
"closeIdleSockets",
base::Bind(&IOThreadImpl::CallbackHelper,
&IOThreadImpl::OnCloseIdleSockets, proxy_));
- web_ui_->RegisterMessageCallback(
+ web_ui()->RegisterMessageCallback(
"flushSocketPools",
base::Bind(&IOThreadImpl::CallbackHelper,
&IOThreadImpl::OnFlushSocketPools, proxy_));
- web_ui_->RegisterMessageCallback(
+ web_ui()->RegisterMessageCallback(
"getSpdySessionInfo",
base::Bind(&IOThreadImpl::CallbackHelper,
&IOThreadImpl::OnGetSpdySessionInfo, proxy_));
- web_ui_->RegisterMessageCallback(
+ web_ui()->RegisterMessageCallback(
"getSpdyStatus",
base::Bind(&IOThreadImpl::CallbackHelper,
&IOThreadImpl::OnGetSpdyStatus, proxy_));
- web_ui_->RegisterMessageCallback(
+ web_ui()->RegisterMessageCallback(
"getSpdyAlternateProtocolMappings",
base::Bind(&IOThreadImpl::CallbackHelper,
&IOThreadImpl::OnGetSpdyAlternateProtocolMappings, proxy_));
#ifdef OS_WIN
- web_ui_->RegisterMessageCallback(
+ web_ui()->RegisterMessageCallback(
"getServiceProviders",
base::Bind(&IOThreadImpl::CallbackHelper,
&IOThreadImpl::OnGetServiceProviders, proxy_));
#endif
- web_ui_->RegisterMessageCallback(
+ web_ui()->RegisterMessageCallback(
"getHttpPipeliningStatus",
base::Bind(&IOThreadImpl::CallbackHelper,
&IOThreadImpl::OnGetHttpPipeliningStatus, proxy_));
- web_ui_->RegisterMessageCallback(
+ web_ui()->RegisterMessageCallback(
"setLogLevel",
base::Bind(&IOThreadImpl::CallbackHelper,
&IOThreadImpl::OnSetLogLevel, proxy_));
- web_ui_->RegisterMessageCallback(
+ web_ui()->RegisterMessageCallback(
"enableHttpThrottling",
base::Bind(&NetInternalsMessageHandler::OnEnableHttpThrottling,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback(
+ web_ui()->RegisterMessageCallback(
"clearBrowserCache",
base::Bind(&NetInternalsMessageHandler::OnClearBrowserCache,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback(
+ web_ui()->RegisterMessageCallback(
"getPrerenderInfo",
base::Bind(&NetInternalsMessageHandler::OnGetPrerenderInfo,
base::Unretained(this)));
#ifdef OS_CHROMEOS
- web_ui_->RegisterMessageCallback(
+ web_ui()->RegisterMessageCallback(
"refreshSystemLogs",
base::Bind(&NetInternalsMessageHandler::OnRefreshSystemLogs,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback(
+ web_ui()->RegisterMessageCallback(
"getSystemLog",
base::Bind(&NetInternalsMessageHandler::OnGetSystemLog,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback(
+ web_ui()->RegisterMessageCallback(
"importONCFile",
base::Bind(&NetInternalsMessageHandler::OnImportONCFile,
base::Unretained(this)));
@@ -581,12 +574,12 @@ void NetInternalsMessageHandler::SendJavascriptCommand(
scoped_ptr<Value> value(arg);
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
if (value.get()) {
- web_ui_->CallJavascriptFunction("g_browser.receive",
- *command_value.get(),
- *value.get());
+ web_ui()->CallJavascriptFunction("g_browser.receive",
+ *command_value.get(),
+ *value.get());
} else {
- web_ui_->CallJavascriptFunction("g_browser.receive",
- *command_value.get());
+ web_ui()->CallJavascriptFunction("g_browser.receive",
+ *command_value.get());
}
}
@@ -1634,7 +1627,7 @@ Value* NetInternalsUI::GetConstants() {
}
NetInternalsUI::NetInternalsUI(TabContents* contents) : ChromeWebUI(contents) {
- AddMessageHandler((new NetInternalsMessageHandler())->Attach(this));
+ AddMessageHandler(new NetInternalsMessageHandler());
// Set up the chrome://net-internals/ source.
GetProfile()->GetChromeURLDataManager()->AddDataSource(
diff --git a/chrome/browser/ui/webui/net_internals_ui_browsertest.cc b/chrome/browser/ui/webui/net_internals_ui_browsertest.cc
index 4ae132e..d1af10f 100644
--- a/chrome/browser/ui/webui/net_internals_ui_browsertest.cc
+++ b/chrome/browser/ui/webui/net_internals_ui_browsertest.cc
@@ -203,21 +203,21 @@ NetInternalsTest::MessageHandler::MessageHandler(
}
void NetInternalsTest::MessageHandler::RegisterMessages() {
- web_ui_->RegisterMessageCallback(
+ web_ui()->RegisterMessageCallback(
"openNewTab",
base::Bind(&NetInternalsTest::MessageHandler::OpenNewTab,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback(
+ web_ui()->RegisterMessageCallback(
"addCacheEntry",
base::Bind(&NetInternalsTest::MessageHandler::AddCacheEntry,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("navigateToPrerender",
+ web_ui()->RegisterMessageCallback("navigateToPrerender",
base::Bind(&NetInternalsTest::MessageHandler::NavigateToPrerender,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("createIncognitoBrowser",
+ web_ui()->RegisterMessageCallback("createIncognitoBrowser",
base::Bind(&NetInternalsTest::MessageHandler::CreateIncognitoBrowser,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("closeIncognitoBrowser",
+ web_ui()->RegisterMessageCallback("closeIncognitoBrowser",
base::Bind(&NetInternalsTest::MessageHandler::CloseIncognitoBrowser,
base::Unretained(this)));
}
diff --git a/chrome/browser/ui/webui/ntp/app_launcher_handler.cc b/chrome/browser/ui/webui/ntp/app_launcher_handler.cc
index 893fb0b..835b480 100644
--- a/chrome/browser/ui/webui/ntp/app_launcher_handler.cc
+++ b/chrome/browser/ui/webui/ntp/app_launcher_handler.cc
@@ -190,53 +190,50 @@ void AppLauncherHandler::CreateAppInfo(const Extension* extension,
value->SetString("app_launch_ordinal", app_launch_ordinal.ToString());
}
-WebUIMessageHandler* AppLauncherHandler::Attach(WebUI* web_ui) {
+void AppLauncherHandler::RegisterMessages() {
registrar_.Add(this, chrome::NOTIFICATION_APP_INSTALLED_TO_NTP,
- content::Source<TabContents>(web_ui->tab_contents()));
- return WebUIMessageHandler::Attach(web_ui);
-}
+ content::Source<TabContents>(web_ui()->tab_contents()));
-void AppLauncherHandler::RegisterMessages() {
- web_ui_->RegisterMessageCallback("getApps",
+ web_ui()->RegisterMessageCallback("getApps",
base::Bind(&AppLauncherHandler::HandleGetApps,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("launchApp",
+ web_ui()->RegisterMessageCallback("launchApp",
base::Bind(&AppLauncherHandler::HandleLaunchApp,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("setLaunchType",
+ web_ui()->RegisterMessageCallback("setLaunchType",
base::Bind(&AppLauncherHandler::HandleSetLaunchType,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("uninstallApp",
+ web_ui()->RegisterMessageCallback("uninstallApp",
base::Bind(&AppLauncherHandler::HandleUninstallApp,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("hideAppsPromo",
+ web_ui()->RegisterMessageCallback("hideAppsPromo",
base::Bind(&AppLauncherHandler::HandleHideAppsPromo,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("createAppShortcut",
+ web_ui()->RegisterMessageCallback("createAppShortcut",
base::Bind(&AppLauncherHandler::HandleCreateAppShortcut,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("reorderApps",
+ web_ui()->RegisterMessageCallback("reorderApps",
base::Bind(&AppLauncherHandler::HandleReorderApps,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("setPageIndex",
+ web_ui()->RegisterMessageCallback("setPageIndex",
base::Bind(&AppLauncherHandler::HandleSetPageIndex,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("promoSeen",
+ web_ui()->RegisterMessageCallback("promoSeen",
base::Bind(&AppLauncherHandler::HandlePromoSeen,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("saveAppPageName",
+ web_ui()->RegisterMessageCallback("saveAppPageName",
base::Bind(&AppLauncherHandler::HandleSaveAppPageName,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("generateAppForLink",
+ web_ui()->RegisterMessageCallback("generateAppForLink",
base::Bind(&AppLauncherHandler::HandleGenerateAppForLink,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("recordAppLaunchByURL",
+ web_ui()->RegisterMessageCallback("recordAppLaunchByURL",
base::Bind(&AppLauncherHandler::HandleRecordAppLaunchByURL,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("closeNotification",
+ web_ui()->RegisterMessageCallback("closeNotification",
base::Bind(&AppLauncherHandler::HandleNotificationClose,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("setNotificationsDisabled",
+ web_ui()->RegisterMessageCallback("setNotificationsDisabled",
base::Bind(&AppLauncherHandler::HandleSetNotificationsDisabled,
base::Unretained(this)));
}
@@ -264,10 +261,10 @@ void AppLauncherHandler::Observe(int type,
if (notification) {
scoped_ptr<DictionaryValue> notification_value(
SerializeNotification(*notification));
- web_ui_->CallJavascriptFunction("appNotificationChanged",
+ web_ui()->CallJavascriptFunction("appNotificationChanged",
id_value, *notification_value.get());
} else {
- web_ui_->CallJavascriptFunction("appNotificationChanged", id_value);
+ web_ui()->CallJavascriptFunction("appNotificationChanged", id_value);
}
break;
}
@@ -285,7 +282,8 @@ void AppLauncherHandler::Observe(int type,
prefs->IsFromBookmark(extension->id()) &&
attempted_bookmark_app_install_));
attempted_bookmark_app_install_ = false;
- web_ui_->CallJavascriptFunction("ntp4.appAdded", *app_info, *highlight);
+ web_ui()->CallJavascriptFunction(
+ "ntp4.appAdded", *app_info, *highlight);
}
break;
@@ -302,7 +300,7 @@ void AppLauncherHandler::Observe(int type,
content::Details<UnloadedExtensionInfo>(details)->reason ==
extension_misc::UNLOAD_REASON_UNINSTALL));
if (app_info.get()) {
- web_ui_->CallJavascriptFunction(
+ web_ui()->CallJavascriptFunction(
"ntp4.appRemoved", *app_info, *uninstall_value);
}
break;
@@ -317,13 +315,15 @@ void AppLauncherHandler::Observe(int type,
case chrome::NOTIFICATION_PREF_CHANGED: {
DictionaryValue dictionary;
FillAppDictionary(&dictionary);
- web_ui_->CallJavascriptFunction("appsPrefChangeCallback", dictionary);
+ web_ui()->CallJavascriptFunction("appsPrefChangeCallback", dictionary);
break;
}
case chrome::NOTIFICATION_EXTENSION_INSTALL_ERROR: {
CrxInstaller* crx_installer = content::Source<CrxInstaller>(source).ptr();
- if (!Profile::FromWebUI(web_ui_)->IsSameProfile(crx_installer->profile()))
+ if (!Profile::FromWebUI(web_ui())->IsSameProfile(
+ crx_installer->profile())) {
return;
+ }
// Fall Through.
}
case chrome::NOTIFICATION_EXTENSION_LOAD_ERROR: {
@@ -403,7 +403,7 @@ void AppLauncherHandler::FillAppDictionary(DictionaryValue* dictionary) {
extension_service_->apps_promo()->ShouldShowAppLauncher(
extension_service_->GetAppIds()));
- PrefService* prefs = Profile::FromWebUI(web_ui_)->GetPrefs();
+ PrefService* prefs = Profile::FromWebUI(web_ui())->GetPrefs();
const ListValue* app_page_names = prefs->GetList(prefs::kNTPAppPageNames);
if (!app_page_names || !app_page_names->GetSize()) {
ListPrefUpdate update(prefs, prefs::kNTPAppPageNames);
@@ -452,7 +452,7 @@ void AppLauncherHandler::HandleGetApps(const ListValue* args) {
// b) Conceptually, it doesn't really make sense to count a
// prefchange-triggered refresh as a promo 'view'.
AppsPromo* apps_promo = extension_service_->apps_promo();
- Profile* profile = Profile::FromWebUI(web_ui_);
+ Profile* profile = Profile::FromWebUI(web_ui());
bool apps_promo_just_expired = false;
if (apps_promo->ShouldShowPromo(extension_service_->GetAppIds(),
&apps_promo_just_expired)) {
@@ -472,7 +472,7 @@ void AppLauncherHandler::HandleGetApps(const ListValue* args) {
SetAppToBeHighlighted();
FillAppDictionary(&dictionary);
- web_ui_->CallJavascriptFunction("getAppsCallback", dictionary);
+ web_ui()->CallJavascriptFunction("getAppsCallback", dictionary);
// First time we get here we set up the observer so that we can tell update
// the apps as they change.
@@ -702,7 +702,7 @@ void AppLauncherHandler::HandleSaveAppPageName(const ListValue* args) {
CHECK(args->GetDouble(1, &page_index));
AutoReset<bool> auto_reset(&ignore_changes_, true);
- PrefService* prefs = Profile::FromWebUI(web_ui_)->GetPrefs();
+ PrefService* prefs = Profile::FromWebUI(web_ui())->GetPrefs();
ListPrefUpdate update(prefs, prefs::kNTPAppPageNames);
ListValue* list = update.Get();
list->Set(static_cast<size_t>(page_index), Value::CreateStringValue(name));
@@ -722,7 +722,7 @@ void AppLauncherHandler::HandleGenerateAppForLink(const ListValue* args) {
extension_service_->extension_prefs()->PageIntegerAsStringOrdinal(
static_cast<size_t>(page_index));
- Profile* profile = Profile::FromWebUI(web_ui_);
+ Profile* profile = Profile::FromWebUI(web_ui());
FaviconService* favicon_service =
profile->GetFaviconService(Profile::EXPLICIT_ACCESS);
if (!favicon_service) {
@@ -753,7 +753,7 @@ void AppLauncherHandler::HandleRecordAppLaunchByURL(
static_cast<extension_misc::AppLaunchBucket>(static_cast<int>(source));
CHECK(source < extension_misc::APP_LAUNCH_BUCKET_BOUNDARY);
- RecordAppLaunchByURL(Profile::FromWebUI(web_ui_), url, bucket);
+ RecordAppLaunchByURL(Profile::FromWebUI(web_ui()), url, bucket);
}
void AppLauncherHandler::HandleNotificationClose(const ListValue* args) {
@@ -820,7 +820,7 @@ void AppLauncherHandler::SetAppToBeHighlighted() {
return;
StringValue app_id(highlight_app_id_);
- web_ui_->CallJavascriptFunction("ntp4.setAppToBeHighlighted", app_id);
+ web_ui()->CallJavascriptFunction("ntp4.setAppToBeHighlighted", app_id);
highlight_app_id_.clear();
}
@@ -892,7 +892,7 @@ void AppLauncherHandler::PromptToEnableApp(const std::string& extension_id) {
// Launch app asynchronously so the image will update.
StringValue app_id(extension_id);
- web_ui_->CallJavascriptFunction("launchAppAfterEnable", app_id);
+ web_ui()->CallJavascriptFunction("launchAppAfterEnable", app_id);
return;
}
@@ -942,7 +942,7 @@ void AppLauncherHandler::InstallUIProceed() {
// icon disappears but isn't replaced by the enabled icon, making a poor
// visual experience.
StringValue app_id(extension->id());
- web_ui_->CallJavascriptFunction("launchAppAfterEnable", app_id);
+ web_ui()->CallJavascriptFunction("launchAppAfterEnable", app_id);
extension_id_prompting_ = "";
}
@@ -964,7 +964,7 @@ void AppLauncherHandler::InstallUIAbort(bool user_initiated) {
ExtensionUninstallDialog* AppLauncherHandler::GetExtensionUninstallDialog() {
if (!extension_uninstall_dialog_.get()) {
extension_uninstall_dialog_.reset(
- ExtensionUninstallDialog::Create(Profile::FromWebUI(web_ui_), this));
+ ExtensionUninstallDialog::Create(Profile::FromWebUI(web_ui()), this));
}
return extension_uninstall_dialog_.get();
}
@@ -972,7 +972,7 @@ ExtensionUninstallDialog* AppLauncherHandler::GetExtensionUninstallDialog() {
ExtensionInstallUI* AppLauncherHandler::GetExtensionInstallUI() {
if (!extension_install_ui_.get()) {
extension_install_ui_.reset(
- new ExtensionInstallUI(Profile::FromWebUI(web_ui_)));
+ new ExtensionInstallUI(Profile::FromWebUI(web_ui())));
}
return extension_install_ui_.get();
}
diff --git a/chrome/browser/ui/webui/ntp/app_launcher_handler.h b/chrome/browser/ui/webui/ntp/app_launcher_handler.h
index 6f34bd4..6bee678 100644
--- a/chrome/browser/ui/webui/ntp/app_launcher_handler.h
+++ b/chrome/browser/ui/webui/ntp/app_launcher_handler.h
@@ -47,7 +47,6 @@ class AppLauncherHandler : public WebUIMessageHandler,
base::DictionaryValue* value);
// WebUIMessageHandler implementation.
- virtual WebUIMessageHandler* Attach(WebUI* web_ui) OVERRIDE;
virtual void RegisterMessages() OVERRIDE;
// content::NotificationObserver
diff --git a/chrome/browser/ui/webui/ntp/favicon_webui_handler.cc b/chrome/browser/ui/webui/ntp/favicon_webui_handler.cc
index 6e3ce03..de33951 100644
--- a/chrome/browser/ui/webui/ntp/favicon_webui_handler.cc
+++ b/chrome/browser/ui/webui/ntp/favicon_webui_handler.cc
@@ -69,10 +69,10 @@ FaviconWebUIHandler::~FaviconWebUIHandler() {
}
void FaviconWebUIHandler::RegisterMessages() {
- web_ui_->RegisterMessageCallback("getFaviconDominantColor",
+ web_ui()->RegisterMessageCallback("getFaviconDominantColor",
base::Bind(&FaviconWebUIHandler::HandleGetFaviconDominantColor,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("getAppIconDominantColor",
+ web_ui()->RegisterMessageCallback("getAppIconDominantColor",
base::Bind(&FaviconWebUIHandler::HandleGetAppIconDominantColor,
base::Unretained(this)));
}
@@ -88,7 +88,7 @@ void FaviconWebUIHandler::HandleGetFaviconDominantColor(const ListValue* args) {
CHECK(args->GetString(1, &dom_id));
FaviconService* favicon_service =
- Profile::FromWebUI(web_ui_)->GetFaviconService(Profile::EXPLICIT_ACCESS);
+ Profile::FromWebUI(web_ui())->GetFaviconService(Profile::EXPLICIT_ACCESS);
if (!favicon_service || path.empty())
return;
@@ -100,8 +100,8 @@ void FaviconWebUIHandler::HandleGetFaviconDominantColor(const ListValue* args) {
StringValue dom_id_value(dom_id);
scoped_ptr<StringValue> color(
SkColorToCss(history::kPrepopulatedPages[i].color));
- web_ui_->CallJavascriptFunction("ntp4.setStripeColor",
- dom_id_value, *color);
+ web_ui()->CallJavascriptFunction("ntp4.setStripeColor",
+ dom_id_value, *color);
return;
}
}
@@ -120,7 +120,7 @@ void FaviconWebUIHandler::OnFaviconDataAvailable(
FaviconService::Handle request_handle,
history::FaviconData favicon) {
FaviconService* favicon_service =
- Profile::FromWebUI(web_ui_)->GetFaviconService(Profile::EXPLICIT_ACCESS);
+ Profile::FromWebUI(web_ui())->GetFaviconService(Profile::EXPLICIT_ACCESS);
int id = consumer_.GetClientData(favicon_service, request_handle);
scoped_ptr<StringValue> color_value;
@@ -130,7 +130,7 @@ void FaviconWebUIHandler::OnFaviconDataAvailable(
color_value.reset(new StringValue("#919191"));
StringValue dom_id(dom_id_map_[id]);
- web_ui_->CallJavascriptFunction("ntp4.setStripeColor", dom_id, *color_value);
+ web_ui()->CallJavascriptFunction("ntp4.setStripeColor", dom_id, *color_value);
dom_id_map_.erase(id);
}
@@ -140,7 +140,7 @@ void FaviconWebUIHandler::HandleGetAppIconDominantColor(
CHECK(args->GetString(0, &extension_id));
ExtensionService* extension_service =
- Profile::FromWebUI(web_ui_)->GetExtensionService();
+ Profile::FromWebUI(web_ui())->GetExtensionService();
const Extension* extension = extension_service->GetExtensionById(
extension_id, false);
if (!extension)
@@ -158,6 +158,6 @@ void FaviconWebUIHandler::NotifyAppIconReady(const std::string& extension_id) {
new RefCountedStaticMemory(&bits.front(), bits.size()));
scoped_ptr<StringValue> color_value(GetDominantColorCssString(bits_mem));
StringValue id(extension_id);
- web_ui_->CallJavascriptFunction(
+ web_ui()->CallJavascriptFunction(
"ntp4.setStripeColor", id, *color_value);
}
diff --git a/chrome/browser/ui/webui/ntp/most_visited_handler.cc b/chrome/browser/ui/webui/ntp/most_visited_handler.cc
index aaa30ee..40aef5f 100644
--- a/chrome/browser/ui/webui/ntp/most_visited_handler.cc
+++ b/chrome/browser/ui/webui/ntp/most_visited_handler.cc
@@ -48,8 +48,8 @@ MostVisitedHandler::MostVisitedHandler()
MostVisitedHandler::~MostVisitedHandler() {
}
-WebUIMessageHandler* MostVisitedHandler::Attach(WebUI* web_ui) {
- Profile* profile = Profile::FromWebUI(web_ui);
+void MostVisitedHandler::RegisterMessages() {
+ Profile* profile = Profile::FromWebUI(web_ui());
// Set up our sources for thumbnail and favicon data.
ThumbnailSource* thumbnail_src = new ThumbnailSource(profile);
profile->GetChromeURLDataManager()->AddDataSource(thumbnail_src);
@@ -57,8 +57,6 @@ WebUIMessageHandler* MostVisitedHandler::Attach(WebUI* web_ui) {
profile->GetChromeURLDataManager()->AddDataSource(
new FaviconSource(profile, FaviconSource::FAVICON));
- WebUIMessageHandler* result = WebUIMessageHandler::Attach(web_ui);
-
history::TopSites* ts = profile->GetTopSites();
if (ts) {
// TopSites updates itself after a delay. This is especially noticable when
@@ -75,22 +73,19 @@ WebUIMessageHandler* MostVisitedHandler::Attach(WebUI* web_ui) {
// We pre-emptively make a fetch for the most visited pages so we have the
// results sooner.
StartQueryForMostVisited();
- return result;
-}
-void MostVisitedHandler::RegisterMessages() {
- web_ui_->RegisterMessageCallback("getMostVisited",
+ web_ui()->RegisterMessageCallback("getMostVisited",
base::Bind(&MostVisitedHandler::HandleGetMostVisited,
base::Unretained(this)));
// Register ourselves for any most-visited item blacklisting.
- web_ui_->RegisterMessageCallback("blacklistURLFromMostVisited",
+ web_ui()->RegisterMessageCallback("blacklistURLFromMostVisited",
base::Bind(&MostVisitedHandler::HandleBlacklistURL,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("removeURLsFromMostVisitedBlacklist",
+ web_ui()->RegisterMessageCallback("removeURLsFromMostVisitedBlacklist",
base::Bind(&MostVisitedHandler::HandleRemoveURLsFromBlacklist,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("clearMostVisitedURLsBlacklist",
+ web_ui()->RegisterMessageCallback("clearMostVisitedURLsBlacklist",
base::Bind(&MostVisitedHandler::HandleClearBlacklist,
base::Unretained(this)));
}
@@ -107,7 +102,7 @@ void MostVisitedHandler::HandleGetMostVisited(const ListValue* args) {
void MostVisitedHandler::SendPagesValue() {
if (pages_value_.get()) {
- Profile* profile = Profile::FromWebUI(web_ui_);
+ Profile* profile = Profile::FromWebUI(web_ui());
const DictionaryValue* url_blacklist =
profile->GetPrefs()->GetDictionary(prefs::kNTPMostVisitedURLsBlacklist);
bool has_blacklisted_urls = !url_blacklist->empty();
@@ -115,15 +110,15 @@ void MostVisitedHandler::SendPagesValue() {
if (ts)
has_blacklisted_urls = ts->HasBlacklistedItems();
base::FundamentalValue has_blacklisted_urls_value(has_blacklisted_urls);
- web_ui_->CallJavascriptFunction("setMostVisitedPages",
- *(pages_value_.get()),
- has_blacklisted_urls_value);
+ web_ui()->CallJavascriptFunction("setMostVisitedPages",
+ *(pages_value_.get()),
+ has_blacklisted_urls_value);
pages_value_.reset();
}
}
void MostVisitedHandler::StartQueryForMostVisited() {
- history::TopSites* ts = Profile::FromWebUI(web_ui_)->GetTopSites();
+ history::TopSites* ts = Profile::FromWebUI(web_ui())->GetTopSites();
if (ts) {
ts->GetMostVisitedURLs(
&topsites_consumer_,
@@ -149,7 +144,7 @@ void MostVisitedHandler::HandleRemoveURLsFromBlacklist(const ListValue* args) {
return;
}
content::RecordAction(UserMetricsAction("MostVisited_UrlRemoved"));
- history::TopSites* ts = Profile::FromWebUI(web_ui_)->GetTopSites();
+ history::TopSites* ts = Profile::FromWebUI(web_ui())->GetTopSites();
if (ts)
ts->RemoveBlacklistedURL(GURL(url));
}
@@ -158,7 +153,7 @@ void MostVisitedHandler::HandleRemoveURLsFromBlacklist(const ListValue* args) {
void MostVisitedHandler::HandleClearBlacklist(const ListValue* args) {
content::RecordAction(UserMetricsAction("MostVisited_BlacklistCleared"));
- history::TopSites* ts = Profile::FromWebUI(web_ui_)->GetTopSites();
+ history::TopSites* ts = Profile::FromWebUI(web_ui())->GetTopSites();
if (ts)
ts->ClearBlacklistedURLs();
}
@@ -200,7 +195,7 @@ void MostVisitedHandler::Observe(int type,
}
void MostVisitedHandler::BlacklistURL(const GURL& url) {
- history::TopSites* ts = Profile::FromWebUI(web_ui_)->GetTopSites();
+ history::TopSites* ts = Profile::FromWebUI(web_ui())->GetTopSites();
if (ts)
ts->AddBlacklistedURL(url);
content::RecordAction(UserMetricsAction("MostVisited_UrlBlacklisted"));
diff --git a/chrome/browser/ui/webui/ntp/most_visited_handler.h b/chrome/browser/ui/webui/ntp/most_visited_handler.h
index 7f7c9f5..03699e6 100644
--- a/chrome/browser/ui/webui/ntp/most_visited_handler.h
+++ b/chrome/browser/ui/webui/ntp/most_visited_handler.h
@@ -38,7 +38,6 @@ class MostVisitedHandler : public WebUIMessageHandler,
virtual ~MostVisitedHandler();
// WebUIMessageHandler override and implementation.
- virtual WebUIMessageHandler* Attach(WebUI* web_ui) OVERRIDE;
virtual void RegisterMessages() OVERRIDE;
// Callback for the "getMostVisited" message.
diff --git a/chrome/browser/ui/webui/ntp/new_tab_page_handler.cc b/chrome/browser/ui/webui/ntp/new_tab_page_handler.cc
index 78543b6..0a12131 100644
--- a/chrome/browser/ui/webui/ntp/new_tab_page_handler.cc
+++ b/chrome/browser/ui/webui/ntp/new_tab_page_handler.cc
@@ -36,9 +36,9 @@ NewTabPageHandler::~NewTabPageHandler() {
page_switch_count_);
}
-WebUIMessageHandler* NewTabPageHandler::Attach(WebUI* web_ui) {
+void NewTabPageHandler::RegisterMessages() {
// Record an open of the NTP with its default page type.
- PrefService* prefs = Profile::FromWebUI(web_ui)->GetPrefs();
+ PrefService* prefs = Profile::FromWebUI(web_ui())->GetPrefs();
int shown_page_type = prefs->GetInteger(prefs::kNTPShownPage) >>
kPageIdOffset;
UMA_HISTOGRAM_ENUMERATION("NewTabPage.DefaultPageType",
@@ -53,10 +53,6 @@ WebUIMessageHandler* NewTabPageHandler::Attach(WebUI* web_ui) {
shown_page_type, kHistogramEnumerationMax);
}
- return WebUIMessageHandler::Attach(web_ui);
-}
-
-void NewTabPageHandler::RegisterMessages() {
web_ui()->RegisterMessageCallback("closeNotificationPromo",
base::Bind(&NewTabPageHandler::HandleCloseNotificationPromo,
base::Unretained(this)));
@@ -83,7 +79,7 @@ void NewTabPageHandler::HandleCloseNotificationPromo(const ListValue* args) {
void NewTabPageHandler::HandleNotificationPromoViewed(const ListValue* args) {
scoped_refptr<NotificationPromo> notification_promo =
- NotificationPromo::Create(Profile::FromWebUI(web_ui_), NULL);
+ NotificationPromo::Create(Profile::FromWebUI(web_ui()), NULL);
if (notification_promo->HandleViewed())
Notify(chrome::NOTIFICATION_PROMO_RESOURCE_STATE_CHANGED);
}
diff --git a/chrome/browser/ui/webui/ntp/new_tab_page_handler.h b/chrome/browser/ui/webui/ntp/new_tab_page_handler.h
index bfbbbf4..c61c820 100644
--- a/chrome/browser/ui/webui/ntp/new_tab_page_handler.h
+++ b/chrome/browser/ui/webui/ntp/new_tab_page_handler.h
@@ -20,7 +20,6 @@ class NewTabPageHandler : public WebUIMessageHandler {
virtual ~NewTabPageHandler();
// WebUIMessageHandler implementation.
- virtual WebUIMessageHandler* Attach(WebUI* web_ui) OVERRIDE;
virtual void RegisterMessages() OVERRIDE;
// Callback for "closeNotificationPromo".
diff --git a/chrome/browser/ui/webui/ntp/new_tab_page_sync_handler.cc b/chrome/browser/ui/webui/ntp/new_tab_page_sync_handler.cc
index 39c1db8..5b29e0a 100644
--- a/chrome/browser/ui/webui/ntp/new_tab_page_sync_handler.cc
+++ b/chrome/browser/ui/webui/ntp/new_tab_page_sync_handler.cc
@@ -54,19 +54,16 @@ NewTabPageSyncHandler::MessageType
}
}
-WebUIMessageHandler* NewTabPageSyncHandler::Attach(WebUI* web_ui) {
- sync_service_ = Profile::FromWebUI(web_ui)->GetProfileSyncService();
+void NewTabPageSyncHandler::RegisterMessages() {
+ sync_service_ = Profile::FromWebUI(web_ui())->GetProfileSyncService();
DCHECK(sync_service_); // This shouldn't get called by an incognito NTP.
DCHECK(!sync_service_->IsManaged()); // And neither if sync is managed.
sync_service_->AddObserver(this);
- return WebUIMessageHandler::Attach(web_ui);
-}
-void NewTabPageSyncHandler::RegisterMessages() {
- web_ui_->RegisterMessageCallback("GetSyncMessage",
+ web_ui()->RegisterMessageCallback("GetSyncMessage",
base::Bind(&NewTabPageSyncHandler::HandleGetSyncMessage,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("SyncLinkClicked",
+ web_ui()->RegisterMessageCallback("SyncLinkClicked",
base::Bind(&NewTabPageSyncHandler::HandleSyncLinkClicked,
base::Unretained(this)));
}
@@ -123,7 +120,7 @@ void NewTabPageSyncHandler::HandleSyncLinkClicked(const ListValue* args) {
value.SetString("syncEnabledMessage",
l10n_util::GetStringFUTF16(IDS_SYNC_NTP_SYNCED_TO,
user));
- web_ui_->CallJavascriptFunction("syncAlreadyEnabled", value);
+ web_ui()->CallJavascriptFunction("syncAlreadyEnabled", value);
} else {
// User clicked the 'Start now' link to begin syncing.
ProfileSyncService::SyncEvent(ProfileSyncService::START_FROM_NTP);
@@ -178,5 +175,5 @@ void NewTabPageSyncHandler::SendSyncMessageToPage(
}
}
}
- web_ui_->CallJavascriptFunction("syncMessageChanged", value);
+ web_ui()->CallJavascriptFunction("syncMessageChanged", value);
}
diff --git a/chrome/browser/ui/webui/ntp/new_tab_page_sync_handler.h b/chrome/browser/ui/webui/ntp/new_tab_page_sync_handler.h
index fcd9f7e..84864a0 100644
--- a/chrome/browser/ui/webui/ntp/new_tab_page_sync_handler.h
+++ b/chrome/browser/ui/webui/ntp/new_tab_page_sync_handler.h
@@ -25,7 +25,6 @@ class NewTabPageSyncHandler : public WebUIMessageHandler,
virtual ~NewTabPageSyncHandler();
// WebUIMessageHandler implementation.
- virtual WebUIMessageHandler* Attach(WebUI* web_ui) OVERRIDE;
virtual void RegisterMessages() OVERRIDE;
// Callback for "GetSyncMessage".
diff --git a/chrome/browser/ui/webui/ntp/new_tab_ui.cc b/chrome/browser/ui/webui/ntp/new_tab_ui.cc
index a4e6907..798a8d9 100644
--- a/chrome/browser/ui/webui/ntp/new_tab_ui.cc
+++ b/chrome/browser/ui/webui/ntp/new_tab_ui.cc
@@ -83,25 +83,24 @@ NewTabUI::NewTabUI(TabContents* contents)
link_transition_type_ = content::PAGE_TRANSITION_AUTO_BOOKMARK;
if (!GetProfile()->IsOffTheRecord()) {
- AddMessageHandler((new browser_sync::ForeignSessionHandler())->
- Attach(this));
- AddMessageHandler((new MostVisitedHandler())->Attach(this));
- AddMessageHandler((new RecentlyClosedTabsHandler())->Attach(this));
- AddMessageHandler((new MetricsHandler())->Attach(this));
+ AddMessageHandler(new browser_sync::ForeignSessionHandler());
+ AddMessageHandler(new MostVisitedHandler());
+ AddMessageHandler(new RecentlyClosedTabsHandler());
+ AddMessageHandler(new MetricsHandler());
if (GetProfile()->IsSyncAccessible())
- AddMessageHandler((new NewTabPageSyncHandler())->Attach(this));
+ AddMessageHandler(new NewTabPageSyncHandler());
ExtensionService* service = GetProfile()->GetExtensionService();
// We might not have an ExtensionService (on ChromeOS when not logged in
// for example).
if (service)
- AddMessageHandler((new AppLauncherHandler(service))->Attach(this));
+ AddMessageHandler(new AppLauncherHandler(service));
- AddMessageHandler((new NewTabPageHandler())->Attach(this));
- AddMessageHandler((new FaviconWebUIHandler())->Attach(this));
+ AddMessageHandler(new NewTabPageHandler());
+ AddMessageHandler(new FaviconWebUIHandler());
}
if (NTPLoginHandler::ShouldShow(GetProfile()))
- AddMessageHandler((new NTPLoginHandler())->Attach(this));
+ AddMessageHandler(new NTPLoginHandler());
// Initializing the CSS and HTML can require some CPU, so do it after
// we've hooked up the most visited handler. This allows the DB query
diff --git a/chrome/browser/ui/webui/ntp/ntp_login_handler.cc b/chrome/browser/ui/webui/ntp/ntp_login_handler.cc
index 380a396..10d3d7c 100644
--- a/chrome/browser/ui/webui/ntp/ntp_login_handler.cc
+++ b/chrome/browser/ui/webui/ntp/ntp_login_handler.cc
@@ -79,27 +79,23 @@ NTPLoginHandler::NTPLoginHandler() {
NTPLoginHandler::~NTPLoginHandler() {
}
-WebUIMessageHandler* NTPLoginHandler::Attach(WebUI* web_ui) {
- PrefService* pref_service = Profile::FromWebUI(web_ui)->GetPrefs();
+void NTPLoginHandler::RegisterMessages() {
+ PrefService* pref_service = Profile::FromWebUI(web_ui())->GetPrefs();
username_pref_.Init(prefs::kGoogleServicesUsername, pref_service, this);
registrar_.Add(this, chrome::NOTIFICATION_PROFILE_CACHED_INFO_CHANGED,
content::NotificationService::AllSources());
- return WebUIMessageHandler::Attach(web_ui);
-}
-
-void NTPLoginHandler::RegisterMessages() {
- web_ui_->RegisterMessageCallback("initializeSyncLogin",
+ web_ui()->RegisterMessageCallback("initializeSyncLogin",
base::Bind(&NTPLoginHandler::HandleInitializeSyncLogin,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("showSyncLoginUI",
+ web_ui()->RegisterMessageCallback("showSyncLoginUI",
base::Bind(&NTPLoginHandler::HandleShowSyncLoginUI,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("loginMessageSeen",
+ web_ui()->RegisterMessageCallback("loginMessageSeen",
base::Bind(&NTPLoginHandler::HandleLoginMessageSeen,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("showAdvancedLoginUI",
+ web_ui()->RegisterMessageCallback("showAdvancedLoginUI",
base::Bind(&NTPLoginHandler::HandleShowAdvancedLoginUI,
base::Unretained(this)));
}
@@ -123,7 +119,7 @@ void NTPLoginHandler::HandleInitializeSyncLogin(const ListValue* args) {
}
void NTPLoginHandler::HandleShowSyncLoginUI(const ListValue* args) {
- Profile* profile = Profile::FromWebUI(web_ui_);
+ Profile* profile = Profile::FromWebUI(web_ui());
std::string username = profile->GetPrefs()->GetString(
prefs::kGoogleServicesUsername);
@@ -133,13 +129,13 @@ void NTPLoginHandler::HandleShowSyncLoginUI(const ListValue* args) {
OpenURLParams params(
GURL(chrome::kChromeUISyncPromoURL), Referrer(), CURRENT_TAB,
content::PAGE_TRANSITION_LINK, false);
- web_ui_->tab_contents()->OpenURL(params);
+ web_ui()->tab_contents()->OpenURL(params);
RecordInHistogram(NTP_SIGN_IN_PROMO_CLICKED);
}
} else if (args->GetSize() == 4) {
// The user is signed in, show the profiles menu.
Browser* browser =
- BrowserList::FindBrowserWithTabContents(web_ui_->tab_contents());
+ BrowserList::FindBrowserWithTabContents(web_ui()->tab_contents());
if (!browser)
return;
double x = 0;
@@ -155,7 +151,7 @@ void NTPLoginHandler::HandleShowSyncLoginUI(const ListValue* args) {
success = args->GetDouble(3, &height);
DCHECK(success);
gfx::Rect rect(x, y, width, height);
- browser->window()->ShowAvatarBubble(web_ui_->tab_contents(), rect);
+ browser->window()->ShowAvatarBubble(web_ui()->tab_contents(), rect);
ProfileMetrics::LogProfileOpenMethod(ProfileMetrics::NTP_AVATAR_BUBBLE);
}
}
@@ -172,16 +168,16 @@ void NTPLoginHandler::RecordInHistogram(int type) {
}
void NTPLoginHandler::HandleLoginMessageSeen(const ListValue* args) {
- Profile::FromWebUI(web_ui_)->GetPrefs()->SetBoolean(
+ Profile::FromWebUI(web_ui())->GetPrefs()->SetBoolean(
prefs::kSyncPromoShowNTPBubble, false);
}
void NTPLoginHandler::HandleShowAdvancedLoginUI(const ListValue* args) {
- Profile::FromWebUI(web_ui_)->GetProfileSyncService()->ShowConfigure(false);
+ Profile::FromWebUI(web_ui())->GetProfileSyncService()->ShowConfigure(false);
}
void NTPLoginHandler::UpdateLogin() {
- Profile* profile = Profile::FromWebUI(web_ui_);
+ Profile* profile = Profile::FromWebUI(web_ui());
std::string username = profile->GetPrefs()->GetString(
prefs::kGoogleServicesUsername);
@@ -224,7 +220,7 @@ void NTPLoginHandler::UpdateLogin() {
StringValue header_value(header);
StringValue sub_header_value(sub_header);
StringValue icon_url_value(icon_url);
- web_ui_->CallJavascriptFunction(
+ web_ui()->CallJavascriptFunction(
"updateLogin", header_value, sub_header_value, icon_url_value);
}
diff --git a/chrome/browser/ui/webui/ntp/ntp_login_handler.h b/chrome/browser/ui/webui/ntp/ntp_login_handler.h
index ea60d35..4cb6d42 100644
--- a/chrome/browser/ui/webui/ntp/ntp_login_handler.h
+++ b/chrome/browser/ui/webui/ntp/ntp_login_handler.h
@@ -22,8 +22,6 @@ class NTPLoginHandler : public WebUIMessageHandler,
NTPLoginHandler();
virtual ~NTPLoginHandler();
- virtual WebUIMessageHandler* Attach(WebUI* web_ui) OVERRIDE;
-
// WebUIMessageHandler interface
virtual void RegisterMessages() OVERRIDE;
diff --git a/chrome/browser/ui/webui/ntp/recently_closed_tabs_handler.cc b/chrome/browser/ui/webui/ntp/recently_closed_tabs_handler.cc
index 24cea89..dbb5019 100644
--- a/chrome/browser/ui/webui/ntp/recently_closed_tabs_handler.cc
+++ b/chrome/browser/ui/webui/ntp/recently_closed_tabs_handler.cc
@@ -46,10 +46,10 @@ void WindowToValue(const TabRestoreService::Window& window,
} // namespace
void RecentlyClosedTabsHandler::RegisterMessages() {
- web_ui_->RegisterMessageCallback("getRecentlyClosedTabs",
+ web_ui()->RegisterMessageCallback("getRecentlyClosedTabs",
base::Bind(&RecentlyClosedTabsHandler::HandleGetRecentlyClosedTabs,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("reopenTab",
+ web_ui()->RegisterMessageCallback("reopenTab",
base::Bind(&RecentlyClosedTabsHandler::HandleReopenTab,
base::Unretained(this)));
}
@@ -62,7 +62,7 @@ RecentlyClosedTabsHandler::~RecentlyClosedTabsHandler() {
void RecentlyClosedTabsHandler::HandleReopenTab(const ListValue* args) {
TabRestoreServiceDelegate* delegate =
TabRestoreServiceDelegate::FindDelegateForController(
- &web_ui_->tab_contents()->GetController(), NULL);
+ &web_ui()->tab_contents()->GetController(), NULL);
if (!delegate || !tab_restore_service_)
return;
@@ -89,7 +89,7 @@ void RecentlyClosedTabsHandler::HandleGetRecentlyClosedTabs(
const ListValue* args) {
if (!tab_restore_service_) {
tab_restore_service_ =
- TabRestoreServiceFactory::GetForProfile(Profile::FromWebUI(web_ui_));
+ TabRestoreServiceFactory::GetForProfile(Profile::FromWebUI(web_ui()));
// TabRestoreServiceFactory::GetForProfile() can return NULL (i.e., when in
// Off the Record mode)
@@ -112,7 +112,7 @@ void RecentlyClosedTabsHandler::TabRestoreServiceChanged(
TabRestoreService::Entries entries = service->entries();
CreateRecentlyClosedValues(entries, &list_value);
- web_ui_->CallJavascriptFunction("recentlyClosedTabs", list_value);
+ web_ui()->CallJavascriptFunction("recentlyClosedTabs", list_value);
}
void RecentlyClosedTabsHandler::TabRestoreServiceDestroyed(
diff --git a/chrome/browser/ui/webui/options/advanced_options_handler.cc b/chrome/browser/ui/webui/options/advanced_options_handler.cc
index c443a18..538d856 100644
--- a/chrome/browser/ui/webui/options/advanced_options_handler.cc
+++ b/chrome/browser/ui/webui/options/advanced_options_handler.cc
@@ -221,7 +221,7 @@ void AdvancedOptionsHandler::RegisterCloudPrintStrings(
}
void AdvancedOptionsHandler::Initialize() {
- DCHECK(web_ui_);
+ DCHECK(web_ui());
SetupMetricsReportingCheckbox();
SetupMetricsReportingSettingVisibility();
SetupFontSizeSelector();
@@ -243,14 +243,10 @@ void AdvancedOptionsHandler::Initialize() {
}
-WebUIMessageHandler* AdvancedOptionsHandler::Attach(WebUI* web_ui) {
- // Call through to superclass.
- WebUIMessageHandler* handler = OptionsPageUIHandler::Attach(web_ui);
-
+void AdvancedOptionsHandler::RegisterMessages() {
// Register for preferences that we need to observe manually. These have
// special behaviors that aren't handled by the standard prefs UI.
- DCHECK(web_ui_);
- PrefService* prefs = Profile::FromWebUI(web_ui_)->GetPrefs();
+ PrefService* prefs = Profile::FromWebUI(web_ui())->GetPrefs();
#if !defined(OS_CHROMEOS)
enable_metrics_recording_.Init(prefs::kMetricsReportingEnabled,
g_browser_process->local_state(), this);
@@ -277,56 +273,50 @@ WebUIMessageHandler* AdvancedOptionsHandler::Attach(WebUI* web_ui) {
PrefSetObserver::CreateProxyPrefSetObserver(prefs, this));
#endif // !defined(OS_CHROMEOS)
- // Return result from the superclass.
- return handler;
-}
-
-void AdvancedOptionsHandler::RegisterMessages() {
// Setup handlers specific to this panel.
- DCHECK(web_ui_);
- web_ui_->RegisterMessageCallback("selectDownloadLocation",
+ web_ui()->RegisterMessageCallback("selectDownloadLocation",
base::Bind(&AdvancedOptionsHandler::HandleSelectDownloadLocation,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("autoOpenFileTypesAction",
+ web_ui()->RegisterMessageCallback("autoOpenFileTypesAction",
base::Bind(&AdvancedOptionsHandler::HandleAutoOpenButton,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("defaultFontSizeAction",
+ web_ui()->RegisterMessageCallback("defaultFontSizeAction",
base::Bind(&AdvancedOptionsHandler::HandleDefaultFontSize,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("defaultZoomFactorAction",
+ web_ui()->RegisterMessageCallback("defaultZoomFactorAction",
base::Bind(&AdvancedOptionsHandler::HandleDefaultZoomFactor,
base::Unretained(this)));
#if !defined(OS_CHROMEOS)
- web_ui_->RegisterMessageCallback("metricsReportingCheckboxAction",
+ web_ui()->RegisterMessageCallback("metricsReportingCheckboxAction",
base::Bind(&AdvancedOptionsHandler::HandleMetricsReportingCheckbox,
base::Unretained(this)));
#endif
#if !defined(USE_NSS) && !defined(USE_OPENSSL)
- web_ui_->RegisterMessageCallback("showManageSSLCertificates",
+ web_ui()->RegisterMessageCallback("showManageSSLCertificates",
base::Bind(&AdvancedOptionsHandler::ShowManageSSLCertificates,
base::Unretained(this)));
#endif
- web_ui_->RegisterMessageCallback("showCloudPrintManagePage",
+ web_ui()->RegisterMessageCallback("showCloudPrintManagePage",
base::Bind(&AdvancedOptionsHandler::ShowCloudPrintManagePage,
base::Unretained(this)));
#if !defined(OS_CHROMEOS)
if (cloud_print_connector_ui_enabled_) {
- web_ui_->RegisterMessageCallback("showCloudPrintSetupDialog",
+ web_ui()->RegisterMessageCallback("showCloudPrintSetupDialog",
base::Bind(&AdvancedOptionsHandler::ShowCloudPrintSetupDialog,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("disableCloudPrintConnector",
+ web_ui()->RegisterMessageCallback("disableCloudPrintConnector",
base::Bind(&AdvancedOptionsHandler::HandleDisableCloudPrintConnector,
base::Unretained(this)));
}
- web_ui_->RegisterMessageCallback("showNetworkProxySettings",
+ web_ui()->RegisterMessageCallback("showNetworkProxySettings",
base::Bind(&AdvancedOptionsHandler::ShowNetworkProxySettings,
base::Unretained(this)));
#endif
- web_ui_->RegisterMessageCallback("checkRevocationCheckboxAction",
+ web_ui()->RegisterMessageCallback("checkRevocationCheckboxAction",
base::Bind(&AdvancedOptionsHandler::HandleCheckRevocationCheckbox,
base::Unretained(this)));
#if !defined(OS_MACOSX) && !defined(OS_CHROMEOS)
- web_ui_->RegisterMessageCallback("backgroundModeAction",
+ web_ui()->RegisterMessageCallback("backgroundModeAction",
base::Bind(&AdvancedOptionsHandler::HandleBackgroundModeCheckbox,
base::Unretained(this)));
#endif
@@ -364,20 +354,20 @@ void AdvancedOptionsHandler::Observe(
void AdvancedOptionsHandler::HandleSelectDownloadLocation(
const ListValue* args) {
- PrefService* pref_service = Profile::FromWebUI(web_ui_)->GetPrefs();
+ PrefService* pref_service = Profile::FromWebUI(web_ui())->GetPrefs();
select_folder_dialog_ = SelectFileDialog::Create(this);
select_folder_dialog_->SelectFile(
SelectFileDialog::SELECT_FOLDER,
l10n_util::GetStringUTF16(IDS_OPTIONS_DOWNLOADLOCATION_BROWSE_TITLE),
pref_service->GetFilePath(prefs::kDownloadDefaultDirectory),
- NULL, 0, FILE_PATH_LITERAL(""), web_ui_->tab_contents(),
- web_ui_->tab_contents()->GetView()->GetTopLevelNativeWindow(), NULL);
+ NULL, 0, FILE_PATH_LITERAL(""), web_ui()->tab_contents(),
+ web_ui()->tab_contents()->GetView()->GetTopLevelNativeWindow(), NULL);
}
void AdvancedOptionsHandler::FileSelected(const FilePath& path, int index,
void* params) {
content::RecordAction(UserMetricsAction("Options_SetDownloadDirectory"));
- PrefService* pref_service = Profile::FromWebUI(web_ui_)->GetPrefs();
+ PrefService* pref_service = Profile::FromWebUI(web_ui())->GetPrefs();
pref_service->SetFilePath(prefs::kDownloadDefaultDirectory, path);
}
@@ -391,7 +381,7 @@ void AdvancedOptionsHandler::OnCloudPrintSetupClosed() {
void AdvancedOptionsHandler::HandleAutoOpenButton(const ListValue* args) {
content::RecordAction(UserMetricsAction("Options_ResetAutoOpenFiles"));
DownloadManager* manager =
- web_ui_->tab_contents()->GetBrowserContext()->GetDownloadManager();
+ web_ui()->tab_contents()->GetBrowserContext()->GetDownloadManager();
if (manager)
DownloadPrefs::FromDownloadManager(manager)->ResetAutoOpen();
}
@@ -453,7 +443,7 @@ void AdvancedOptionsHandler::HandleBackgroundModeCheckbox(
void AdvancedOptionsHandler::SetupBackgroundModeSettings() {
base::FundamentalValue checked(background_mode_enabled_.GetValue());
- web_ui_->CallJavascriptFunction(
+ web_ui()->CallJavascriptFunction(
"options.AdvancedOptions.SetBackgroundModeCheckboxState", checked);
}
#endif
@@ -461,55 +451,55 @@ void AdvancedOptionsHandler::SetupBackgroundModeSettings() {
#if !defined(OS_CHROMEOS)
void AdvancedOptionsHandler::ShowNetworkProxySettings(const ListValue* args) {
content::RecordAction(UserMetricsAction("Options_ShowProxySettings"));
- AdvancedOptionsUtilities::ShowNetworkProxySettings(web_ui_->tab_contents());
+ AdvancedOptionsUtilities::ShowNetworkProxySettings(web_ui()->tab_contents());
}
#endif
#if !defined(USE_NSS) && !defined(USE_OPENSSL)
void AdvancedOptionsHandler::ShowManageSSLCertificates(const ListValue* args) {
content::RecordAction(UserMetricsAction("Options_ManageSSLCertificates"));
- AdvancedOptionsUtilities::ShowManageSSLCertificates(web_ui_->tab_contents());
+ AdvancedOptionsUtilities::ShowManageSSLCertificates(web_ui()->tab_contents());
}
#endif
void AdvancedOptionsHandler::ShowCloudPrintManagePage(const ListValue* args) {
content::RecordAction(UserMetricsAction("Options_ManageCloudPrinters"));
// Open a new tab in the current window for the management page.
- Profile* profile = Profile::FromWebUI(web_ui_);
+ Profile* profile = Profile::FromWebUI(web_ui());
OpenURLParams params(
CloudPrintURL(profile).GetCloudPrintServiceManageURL(), Referrer(),
NEW_FOREGROUND_TAB, content::PAGE_TRANSITION_LINK, false);
- web_ui_->tab_contents()->OpenURL(params);
+ web_ui()->tab_contents()->OpenURL(params);
}
#if !defined(OS_CHROMEOS)
void AdvancedOptionsHandler::ShowCloudPrintSetupDialog(const ListValue* args) {
content::RecordAction(UserMetricsAction("Options_EnableCloudPrintProxy"));
// Open the connector enable page in the current tab.
- Profile* profile = Profile::FromWebUI(web_ui_);
+ Profile* profile = Profile::FromWebUI(web_ui());
OpenURLParams params(
CloudPrintURL(profile).GetCloudPrintServiceEnableURL(
CloudPrintProxyServiceFactory::GetForProfile(profile)->proxy_id()),
Referrer(), CURRENT_TAB, content::PAGE_TRANSITION_LINK, false);
- web_ui_->tab_contents()->OpenURL(params);
+ web_ui()->tab_contents()->OpenURL(params);
}
void AdvancedOptionsHandler::HandleDisableCloudPrintConnector(
const ListValue* args) {
content::RecordAction(
UserMetricsAction("Options_DisableCloudPrintProxy"));
- CloudPrintProxyServiceFactory::GetForProfile(Profile::FromWebUI(web_ui_))->
+ CloudPrintProxyServiceFactory::GetForProfile(Profile::FromWebUI(web_ui()))->
DisableForUser();
}
void AdvancedOptionsHandler::RefreshCloudPrintStatusFromService() {
if (cloud_print_connector_ui_enabled_)
- CloudPrintProxyServiceFactory::GetForProfile(Profile::FromWebUI(web_ui_))->
+ CloudPrintProxyServiceFactory::GetForProfile(Profile::FromWebUI(web_ui()))->
RefreshStatusFromService();
}
void AdvancedOptionsHandler::SetupCloudPrintConnectorSection() {
- Profile* profile = Profile::FromWebUI(web_ui_);
+ Profile* profile = Profile::FromWebUI(web_ui());
if (!CloudPrintProxyServiceFactory::GetForProfile(profile)) {
cloud_print_connector_ui_enabled_ = false;
RemoveCloudPrintConnectorSection();
@@ -541,13 +531,13 @@ void AdvancedOptionsHandler::SetupCloudPrintConnectorSection() {
}
StringValue label(label_str);
- web_ui_->CallJavascriptFunction(
+ web_ui()->CallJavascriptFunction(
"options.AdvancedOptions.SetupCloudPrintConnectorSection",
disabled, label, allowed);
}
void AdvancedOptionsHandler::RemoveCloudPrintConnectorSection() {
- web_ui_->CallJavascriptFunction(
+ web_ui()->CallJavascriptFunction(
"options.AdvancedOptions.RemoveCloudPrintConnectorSection");
}
@@ -557,7 +547,7 @@ void AdvancedOptionsHandler::SetupMetricsReportingCheckbox() {
#if defined(GOOGLE_CHROME_BUILD) && !defined(OS_CHROMEOS)
base::FundamentalValue checked(enable_metrics_recording_.GetValue());
base::FundamentalValue disabled(enable_metrics_recording_.IsManaged());
- web_ui_->CallJavascriptFunction(
+ web_ui()->CallJavascriptFunction(
"options.AdvancedOptions.SetMetricsReportingCheckboxState", checked,
disabled);
#endif
@@ -568,7 +558,7 @@ void AdvancedOptionsHandler::SetupMetricsReportingSettingVisibility() {
// Don't show the reporting setting if we are in the guest mode.
if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kGuestSession)) {
base::FundamentalValue visible(false);
- web_ui_->CallJavascriptFunction(
+ web_ui()->CallJavascriptFunction(
"options.AdvancedOptions.SetMetricsReportingSettingVisibility",
visible);
}
@@ -578,12 +568,12 @@ void AdvancedOptionsHandler::SetupMetricsReportingSettingVisibility() {
void AdvancedOptionsHandler::SetupFontSizeSelector() {
// We're only interested in integer values, so convert to int.
base::FundamentalValue font_size(default_font_size_.GetValue());
- web_ui_->CallJavascriptFunction(
+ web_ui()->CallJavascriptFunction(
"options.AdvancedOptions.SetFontSize", font_size);
}
void AdvancedOptionsHandler::SetupPageZoomSelector() {
- PrefService* pref_service = Profile::FromWebUI(web_ui_)->GetPrefs();
+ PrefService* pref_service = Profile::FromWebUI(web_ui())->GetPrefs();
double default_zoom_level = pref_service->GetDouble(prefs::kDefaultZoomLevel);
double default_zoom_factor =
WebKit::WebView::zoomLevelToZoomFactor(default_zoom_level);
@@ -613,7 +603,7 @@ void AdvancedOptionsHandler::SetupPageZoomSelector() {
zoom_factors_value.Append(option);
}
- web_ui_->CallJavascriptFunction(
+ web_ui()->CallJavascriptFunction(
"options.AdvancedOptions.SetupPageZoomSelector", zoom_factors_value);
}
@@ -621,11 +611,11 @@ void AdvancedOptionsHandler::SetupAutoOpenFileTypesDisabledAttribute() {
// Set the enabled state for the AutoOpenFileTypesResetToDefault button.
// We enable the button if the user has any auto-open file types registered.
DownloadManager* manager =
- web_ui_->tab_contents()->GetBrowserContext()->GetDownloadManager();
+ web_ui()->tab_contents()->GetBrowserContext()->GetDownloadManager();
bool disabled = !(manager &&
DownloadPrefs::FromDownloadManager(manager)->IsAutoOpenUsed());
base::FundamentalValue value(disabled);
- web_ui_->CallJavascriptFunction(
+ web_ui()->CallJavascriptFunction(
"options.AdvancedOptions.SetAutoOpenFileTypesDisabledAttribute", value);
}
@@ -633,7 +623,7 @@ void AdvancedOptionsHandler::SetupProxySettingsSection() {
#if !defined(OS_CHROMEOS)
// Disable the button if proxy settings are managed by a sysadmin or
// overridden by an extension.
- PrefService* pref_service = Profile::FromWebUI(web_ui_)->GetPrefs();
+ PrefService* pref_service = Profile::FromWebUI(web_ui())->GetPrefs();
const PrefService::Preference* proxy_config =
pref_service->FindPreference(prefs::kProxy);
bool is_extension_controlled = (proxy_config &&
@@ -652,7 +642,7 @@ void AdvancedOptionsHandler::SetupProxySettingsSection() {
}
StringValue label(label_str);
- web_ui_->CallJavascriptFunction(
+ web_ui()->CallJavascriptFunction(
"options.AdvancedOptions.SetupProxySettingsSection", disabled, label);
#endif // !defined(OS_CHROMEOS)
}
@@ -661,7 +651,7 @@ void AdvancedOptionsHandler::SetupSSLConfigSettings() {
{
base::FundamentalValue checked(rev_checking_enabled_.GetValue());
base::FundamentalValue disabled(rev_checking_enabled_.IsManaged());
- web_ui_->CallJavascriptFunction(
+ web_ui()->CallJavascriptFunction(
"options.AdvancedOptions.SetCheckRevocationCheckboxState", checked,
disabled);
}
diff --git a/chrome/browser/ui/webui/options/advanced_options_handler.h b/chrome/browser/ui/webui/options/advanced_options_handler.h
index 014e747..5bfe517 100644
--- a/chrome/browser/ui/webui/options/advanced_options_handler.h
+++ b/chrome/browser/ui/webui/options/advanced_options_handler.h
@@ -31,7 +31,6 @@ class AdvancedOptionsHandler
virtual void Initialize() OVERRIDE;
// WebUIMessageHandler implementation.
- virtual WebUIMessageHandler* Attach(WebUI* web_ui) OVERRIDE;
virtual void RegisterMessages() OVERRIDE;
// content::NotificationObserver implementation.
diff --git a/chrome/browser/ui/webui/options/autofill_options_handler.cc b/chrome/browser/ui/webui/options/autofill_options_handler.cc
index 9072702..9da36c0 100644
--- a/chrome/browser/ui/webui/options/autofill_options_handler.cc
+++ b/chrome/browser/ui/webui/options/autofill_options_handler.cc
@@ -298,7 +298,7 @@ void AutofillOptionsHandler::GetLocalizedValues(
void AutofillOptionsHandler::Initialize() {
personal_data_ = PersonalDataManagerFactory::GetForProfile(
- Profile::FromWebUI(web_ui_));
+ Profile::FromWebUI(web_ui()));
// personal_data_ is NULL in guest mode on Chrome OS.
if (personal_data_) {
personal_data_->SetObserver(this);
@@ -307,30 +307,30 @@ void AutofillOptionsHandler::Initialize() {
}
void AutofillOptionsHandler::RegisterMessages() {
- web_ui_->RegisterMessageCallback(
+ web_ui()->RegisterMessageCallback(
"removeAddress",
base::Bind(&AutofillOptionsHandler::RemoveAddress,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback(
+ web_ui()->RegisterMessageCallback(
"removeCreditCard",
base::Bind(&AutofillOptionsHandler::RemoveCreditCard,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback(
+ web_ui()->RegisterMessageCallback(
"loadAddressEditor",
base::Bind(&AutofillOptionsHandler::LoadAddressEditor,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback(
+ web_ui()->RegisterMessageCallback(
"loadCreditCardEditor",
base::Bind(&AutofillOptionsHandler::LoadCreditCardEditor,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback(
+ web_ui()->RegisterMessageCallback(
"setAddress",
base::Bind(&AutofillOptionsHandler::SetAddress, base::Unretained(this)));
- web_ui_->RegisterMessageCallback(
+ web_ui()->RegisterMessageCallback(
"setCreditCard",
base::Bind(&AutofillOptionsHandler::SetCreditCard,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback(
+ web_ui()->RegisterMessageCallback(
"validatePhoneNumbers",
base::Bind(&AutofillOptionsHandler::ValidatePhoneNumbers,
base::Unretained(this)));
@@ -410,7 +410,8 @@ void AutofillOptionsHandler::LoadAutofillData() {
addresses.Append(entry);
}
- web_ui_->CallJavascriptFunction("AutofillOptions.setAddressList", addresses);
+ web_ui()->CallJavascriptFunction("AutofillOptions.setAddressList",
+ addresses);
ListValue credit_cards;
for (std::vector<CreditCard*>::const_iterator i =
@@ -426,8 +427,8 @@ void AutofillOptionsHandler::LoadAutofillData() {
credit_cards.Append(entry);
}
- web_ui_->CallJavascriptFunction("AutofillOptions.setCreditCardList",
- credit_cards);
+ web_ui()->CallJavascriptFunction("AutofillOptions.setCreditCardList",
+ credit_cards);
}
void AutofillOptionsHandler::RemoveAddress(const ListValue* args) {
@@ -490,7 +491,7 @@ void AutofillOptionsHandler::LoadAddressEditor(const ListValue* args) {
GetValueList(*profile, EMAIL_ADDRESS, &list);
address.Set("email", list.release());
- web_ui_->CallJavascriptFunction("AutofillOptions.editAddress", address);
+ web_ui()->CallJavascriptFunction("AutofillOptions.editAddress", address);
}
void AutofillOptionsHandler::LoadCreditCardEditor(const ListValue* args) {
@@ -524,8 +525,8 @@ void AutofillOptionsHandler::LoadCreditCardEditor(const ListValue* args) {
"expirationYear",
credit_card->GetInfo(CREDIT_CARD_EXP_4_DIGIT_YEAR));
- web_ui_->CallJavascriptFunction("AutofillOptions.editCreditCard",
- credit_card_data);
+ web_ui()->CallJavascriptFunction("AutofillOptions.editCreditCard",
+ credit_card_data);
}
void AutofillOptionsHandler::SetAddress(const ListValue* args) {
@@ -609,6 +610,6 @@ void AutofillOptionsHandler::ValidatePhoneNumbers(const ListValue* args) {
ListValue* list_value = NULL;
ValidatePhoneArguments(args, &list_value);
- web_ui_->CallJavascriptFunction(
+ web_ui()->CallJavascriptFunction(
"AutofillEditAddressOverlay.setValidatedPhoneNumbers", *list_value);
}
diff --git a/chrome/browser/ui/webui/options/browser_options_handler.cc b/chrome/browser/ui/webui/options/browser_options_handler.cc
index 653efbd..6e84891 100644
--- a/chrome/browser/ui/webui/options/browser_options_handler.cc
+++ b/chrome/browser/ui/webui/options/browser_options_handler.cc
@@ -108,43 +108,43 @@ void BrowserOptionsHandler::GetLocalizedValues(
}
void BrowserOptionsHandler::RegisterMessages() {
- web_ui_->RegisterMessageCallback("becomeDefaultBrowser",
+ web_ui()->RegisterMessageCallback("becomeDefaultBrowser",
base::Bind(&BrowserOptionsHandler::BecomeDefaultBrowser,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("setDefaultSearchEngine",
+ web_ui()->RegisterMessageCallback("setDefaultSearchEngine",
base::Bind(&BrowserOptionsHandler::SetDefaultSearchEngine,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("removeStartupPages",
+ web_ui()->RegisterMessageCallback("removeStartupPages",
base::Bind(&BrowserOptionsHandler::RemoveStartupPages,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("addStartupPage",
+ web_ui()->RegisterMessageCallback("addStartupPage",
base::Bind(&BrowserOptionsHandler::AddStartupPage,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("editStartupPage",
+ web_ui()->RegisterMessageCallback("editStartupPage",
base::Bind(&BrowserOptionsHandler::EditStartupPage,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("setStartupPagesToCurrentPages",
+ web_ui()->RegisterMessageCallback("setStartupPagesToCurrentPages",
base::Bind(&BrowserOptionsHandler::SetStartupPagesToCurrentPages,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("dragDropStartupPage",
+ web_ui()->RegisterMessageCallback("dragDropStartupPage",
base::Bind(&BrowserOptionsHandler::DragDropStartupPage,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("requestAutocompleteSuggestions",
+ web_ui()->RegisterMessageCallback("requestAutocompleteSuggestions",
base::Bind(&BrowserOptionsHandler::RequestAutocompleteSuggestions,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("enableInstant",
+ web_ui()->RegisterMessageCallback("enableInstant",
base::Bind(&BrowserOptionsHandler::EnableInstant,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("disableInstant",
+ web_ui()->RegisterMessageCallback("disableInstant",
base::Bind(&BrowserOptionsHandler::DisableInstant,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("getInstantFieldTrialStatus",
+ web_ui()->RegisterMessageCallback("getInstantFieldTrialStatus",
base::Bind(&BrowserOptionsHandler::GetInstantFieldTrialStatus,
base::Unretained(this)));
}
void BrowserOptionsHandler::Initialize() {
- Profile* profile = Profile::FromWebUI(web_ui_);
+ Profile* profile = Profile::FromWebUI(web_ui());
// Create our favicon data source.
profile->GetChromeURLDataManager()->AddDataSource(
@@ -199,12 +199,12 @@ void BrowserOptionsHandler::CheckAutoLaunchCallback(
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
if (is_in_auto_launch_group) {
- web_ui_->RegisterMessageCallback("toggleAutoLaunch",
+ web_ui()->RegisterMessageCallback("toggleAutoLaunch",
base::Bind(&BrowserOptionsHandler::ToggleAutoLaunch,
base::Unretained(this)));
base::FundamentalValue enabled(will_launch_at_login);
- web_ui_->CallJavascriptFunction("BrowserOptions.updateAutoLaunchState",
+ web_ui()->CallJavascriptFunction("BrowserOptions.updateAutoLaunchState",
enabled);
}
#endif
@@ -251,7 +251,7 @@ void BrowserOptionsHandler::BecomeDefaultBrowser(const ListValue* args) {
// If the user attempted to make Chrome the default browser, then he/she
// arguably wants to be notified when that changes.
- PrefService* prefs = Profile::FromWebUI(web_ui_)->GetPrefs();
+ PrefService* prefs = Profile::FromWebUI(web_ui())->GetPrefs();
prefs->SetBoolean(prefs::kCheckDefaultBrowser, true);
}
@@ -292,8 +292,9 @@ void BrowserOptionsHandler::SetDefaultBrowserUIString(int status_string_id) {
(status_string_id == IDS_OPTIONS_DEFAULTBROWSER_DEFAULT ||
status_string_id == IDS_OPTIONS_DEFAULTBROWSER_NOTDEFAULT)));
- web_ui_->CallJavascriptFunction("BrowserOptions.updateDefaultBrowserState",
- *status_string, *is_default, *can_be_default);
+ web_ui()->CallJavascriptFunction(
+ "BrowserOptions.updateDefaultBrowserState",
+ *status_string, *is_default, *can_be_default);
}
void BrowserOptionsHandler::OnTemplateURLServiceChanged() {
@@ -323,9 +324,9 @@ void BrowserOptionsHandler::OnTemplateURLServiceChanged() {
scoped_ptr<Value> default_managed(Value::CreateBooleanValue(
template_url_service_->is_default_search_managed()));
- web_ui_->CallJavascriptFunction("BrowserOptions.updateSearchEngines",
- search_engines, *default_value,
- *default_managed);
+ web_ui()->CallJavascriptFunction("BrowserOptions.updateSearchEngines",
+ search_engines, *default_value,
+ *default_managed);
}
void BrowserOptionsHandler::SetDefaultSearchEngine(const ListValue* args) {
@@ -346,7 +347,7 @@ void BrowserOptionsHandler::SetDefaultSearchEngine(const ListValue* args) {
void BrowserOptionsHandler::UpdateSearchEngines() {
template_url_service_ =
- TemplateURLServiceFactory::GetForProfile(Profile::FromWebUI(web_ui_));
+ TemplateURLServiceFactory::GetForProfile(Profile::FromWebUI(web_ui()));
if (template_url_service_) {
template_url_service_->Load();
template_url_service_->AddObserver(this);
@@ -355,7 +356,7 @@ void BrowserOptionsHandler::UpdateSearchEngines() {
}
void BrowserOptionsHandler::UpdateStartupPages() {
- Profile* profile = Profile::FromWebUI(web_ui_);
+ Profile* profile = Profile::FromWebUI(web_ui());
const SessionStartupPref startup_pref =
SessionStartupPref::GetStartupPref(profile->GetPrefs());
startup_custom_pages_table_model_->SetURLs(startup_pref.urls);
@@ -375,8 +376,8 @@ void BrowserOptionsHandler::OnModelChanged() {
startup_pages.Append(entry);
}
- web_ui_->CallJavascriptFunction("BrowserOptions.updateStartupPages",
- startup_pages);
+ web_ui()->CallJavascriptFunction("BrowserOptions.updateStartupPages",
+ startup_pages);
}
void BrowserOptionsHandler::OnItemsChanged(int start, int length) {
@@ -491,7 +492,7 @@ void BrowserOptionsHandler::DragDropStartupPage(const ListValue* args) {
}
void BrowserOptionsHandler::SaveStartupPagesPref() {
- PrefService* prefs = Profile::FromWebUI(web_ui_)->GetPrefs();
+ PrefService* prefs = Profile::FromWebUI(web_ui())->GetPrefs();
SessionStartupPref pref = SessionStartupPref::GetStartupPref(prefs);
pref.urls = startup_custom_pages_table_model_->GetURLs();
@@ -510,11 +511,11 @@ void BrowserOptionsHandler::RequestAutocompleteSuggestions(
}
void BrowserOptionsHandler::EnableInstant(const ListValue* args) {
- InstantController::Enable(Profile::FromWebUI(web_ui_));
+ InstantController::Enable(Profile::FromWebUI(web_ui()));
}
void BrowserOptionsHandler::DisableInstant(const ListValue* args) {
- InstantController::Disable(Profile::FromWebUI(web_ui_));
+ InstantController::Disable(Profile::FromWebUI(web_ui()));
}
void BrowserOptionsHandler::ToggleAutoLaunch(const ListValue* args) {
@@ -535,12 +536,12 @@ void BrowserOptionsHandler::ToggleAutoLaunch(const ListValue* args) {
}
void BrowserOptionsHandler::GetInstantFieldTrialStatus(const ListValue* args) {
- Profile* profile = Profile::FromWebUI(web_ui_);
+ Profile* profile = Profile::FromWebUI(web_ui());
base::FundamentalValue enabled(
InstantFieldTrial::IsInstantExperiment(profile) &&
!InstantFieldTrial::IsHiddenExperiment(profile));
- web_ui_->CallJavascriptFunction("BrowserOptions.setInstantFieldTrialStatus",
- enabled);
+ web_ui()->CallJavascriptFunction("BrowserOptions.setInstantFieldTrialStatus",
+ enabled);
}
void BrowserOptionsHandler::OnResultChanged(bool default_match_changed) {
@@ -562,6 +563,6 @@ void BrowserOptionsHandler::OnResultChanged(bool default_match_changed) {
suggestions.Append(entry);
}
- web_ui_->CallJavascriptFunction(
+ web_ui()->CallJavascriptFunction(
"BrowserOptions.updateAutocompleteSuggestions", suggestions);
}
diff --git a/chrome/browser/ui/webui/options/certificate_manager_handler.cc b/chrome/browser/ui/webui/options/certificate_manager_handler.cc
index 923c68b..cfdfc2a 100644
--- a/chrome/browser/ui/webui/options/certificate_manager_handler.cc
+++ b/chrome/browser/ui/webui/options/certificate_manager_handler.cc
@@ -365,82 +365,82 @@ void CertificateManagerHandler::GetLocalizedValues(
}
void CertificateManagerHandler::RegisterMessages() {
- web_ui_->RegisterMessageCallback(
+ web_ui()->RegisterMessageCallback(
"viewCertificate",
base::Bind(&CertificateManagerHandler::View, base::Unretained(this)));
- web_ui_->RegisterMessageCallback(
+ web_ui()->RegisterMessageCallback(
"getCaCertificateTrust",
base::Bind(&CertificateManagerHandler::GetCATrust,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback(
+ web_ui()->RegisterMessageCallback(
"editCaCertificateTrust",
base::Bind(&CertificateManagerHandler::EditCATrust,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback(
+ web_ui()->RegisterMessageCallback(
"editServerCertificate",
base::Bind(&CertificateManagerHandler::EditServer,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback(
+ web_ui()->RegisterMessageCallback(
"cancelImportExportCertificate",
base::Bind(&CertificateManagerHandler::CancelImportExportProcess,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback(
+ web_ui()->RegisterMessageCallback(
"exportPersonalCertificate",
base::Bind(&CertificateManagerHandler::ExportPersonal,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback(
+ web_ui()->RegisterMessageCallback(
"exportAllPersonalCertificates",
base::Bind(&CertificateManagerHandler::ExportAllPersonal,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback(
+ web_ui()->RegisterMessageCallback(
"exportPersonalCertificatePasswordSelected",
base::Bind(&CertificateManagerHandler::ExportPersonalPasswordSelected,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback(
+ web_ui()->RegisterMessageCallback(
"importPersonalCertificate",
base::Bind(&CertificateManagerHandler::StartImportPersonal,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback(
+ web_ui()->RegisterMessageCallback(
"importPersonalCertificatePasswordSelected",
base::Bind(&CertificateManagerHandler::ImportPersonalPasswordSelected,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback(
+ web_ui()->RegisterMessageCallback(
"importCaCertificate",
base::Bind(&CertificateManagerHandler::ImportCA,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback(
+ web_ui()->RegisterMessageCallback(
"importCaCertificateTrustSelected",
base::Bind(&CertificateManagerHandler::ImportCATrustSelected,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback(
+ web_ui()->RegisterMessageCallback(
"importServerCertificate",
base::Bind(&CertificateManagerHandler::ImportServer,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback(
+ web_ui()->RegisterMessageCallback(
"exportCertificate",
base::Bind(&CertificateManagerHandler::Export,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback(
+ web_ui()->RegisterMessageCallback(
"deleteCertificate",
base::Bind(&CertificateManagerHandler::Delete,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback(
+ web_ui()->RegisterMessageCallback(
"populateCertificateManager",
base::Bind(&CertificateManagerHandler::Populate,
base::Unretained(this)));
#if defined(OS_CHROMEOS)
- web_ui_->RegisterMessageCallback(
+ web_ui()->RegisterMessageCallback(
"checkTpmTokenReady",
base::Bind(&CertificateManagerHandler::CheckTpmTokenReady,
base::Unretained(this)));
@@ -498,7 +498,7 @@ void CertificateManagerHandler::View(const ListValue* args) {
void CertificateManagerHandler::GetCATrust(const ListValue* args) {
net::X509Certificate* cert = CallbackArgsToCert(args);
if (!cert) {
- web_ui_->CallJavascriptFunction("CertificateEditCaTrustOverlay.dismiss");
+ web_ui()->CallJavascriptFunction("CertificateEditCaTrustOverlay.dismiss");
return;
}
@@ -510,7 +510,7 @@ void CertificateManagerHandler::GetCATrust(const ListValue* args) {
static_cast<bool>(trust_bits & net::CertDatabase::TRUSTED_EMAIL));
base::FundamentalValue obj_sign_value(
static_cast<bool>(trust_bits & net::CertDatabase::TRUSTED_OBJ_SIGN));
- web_ui_->CallJavascriptFunction(
+ web_ui()->CallJavascriptFunction(
"CertificateEditCaTrustOverlay.populateTrust",
ssl_value, email_value, obj_sign_value);
}
@@ -526,7 +526,7 @@ void CertificateManagerHandler::EditCATrust(const ListValue* args) {
fail |= !CallbackArgsToBool(args, 3, &trust_obj_sign);
if (fail) {
LOG(ERROR) << "EditCATrust args fail";
- web_ui_->CallJavascriptFunction("CertificateEditCaTrustOverlay.dismiss");
+ web_ui()->CallJavascriptFunction("CertificateEditCaTrustOverlay.dismiss");
return;
}
@@ -536,7 +536,7 @@ void CertificateManagerHandler::EditCATrust(const ListValue* args) {
trust_ssl * net::CertDatabase::TRUSTED_SSL +
trust_email * net::CertDatabase::TRUSTED_EMAIL +
trust_obj_sign * net::CertDatabase::TRUSTED_OBJ_SIGN);
- web_ui_->CallJavascriptFunction("CertificateEditCaTrustOverlay.dismiss");
+ web_ui()->CallJavascriptFunction("CertificateEditCaTrustOverlay.dismiss");
if (!result) {
// TODO(mattm): better error messages?
ShowError(
@@ -566,7 +566,7 @@ void CertificateManagerHandler::ExportPersonal(const ListValue* args) {
select_file_dialog_->SelectFile(
SelectFileDialog::SELECT_SAVEAS_FILE, string16(),
FilePath(), &file_type_info, 1, FILE_PATH_LITERAL("p12"),
- web_ui_->tab_contents(), GetParentWindow(),
+ web_ui()->tab_contents(), GetParentWindow(),
reinterpret_cast<void*>(EXPORT_PERSONAL_FILE_SELECTED));
}
@@ -577,14 +577,14 @@ void CertificateManagerHandler::ExportAllPersonal(const ListValue* args) {
void CertificateManagerHandler::ExportPersonalFileSelected(
const FilePath& path) {
file_path_ = path;
- web_ui_->CallJavascriptFunction(
+ web_ui()->CallJavascriptFunction(
"CertificateManager.exportPersonalAskPassword");
}
void CertificateManagerHandler::ExportPersonalPasswordSelected(
const ListValue* args) {
if (!args->GetString(0, &password_)){
- web_ui_->CallJavascriptFunction("CertificateRestoreOverlay.dismiss");
+ web_ui()->CallJavascriptFunction("CertificateRestoreOverlay.dismiss");
ImportExportCleanup();
return;
}
@@ -610,7 +610,7 @@ void CertificateManagerHandler::ExportPersonalSlotsUnlocked() {
password_,
&output);
if (!num_exported) {
- web_ui_->CallJavascriptFunction("CertificateRestoreOverlay.dismiss");
+ web_ui()->CallJavascriptFunction("CertificateRestoreOverlay.dismiss");
ShowError(
l10n_util::GetStringUTF8(IDS_CERT_MANAGER_PKCS12_EXPORT_ERROR_TITLE),
l10n_util::GetStringUTF8(IDS_CERT_MANAGER_UNKNOWN_ERROR));
@@ -625,7 +625,7 @@ void CertificateManagerHandler::ExportPersonalSlotsUnlocked() {
void CertificateManagerHandler::ExportPersonalFileWritten(int write_errno,
int bytes_written) {
- web_ui_->CallJavascriptFunction("CertificateRestoreOverlay.dismiss");
+ web_ui()->CallJavascriptFunction("CertificateRestoreOverlay.dismiss");
ImportExportCleanup();
if (write_errno) {
ShowError(
@@ -640,7 +640,7 @@ void CertificateManagerHandler::StartImportPersonal(const ListValue* args) {
if (!args->GetBoolean(0, &use_hardware_backed_)){
// Unable to retrieve the hardware backed attribute from the args,
// so bail.
- web_ui_->CallJavascriptFunction("CertificateRestoreOverlay.dismiss");
+ web_ui()->CallJavascriptFunction("CertificateRestoreOverlay.dismiss");
ImportExportCleanup();
return;
}
@@ -653,21 +653,21 @@ void CertificateManagerHandler::StartImportPersonal(const ListValue* args) {
select_file_dialog_->SelectFile(
SelectFileDialog::SELECT_OPEN_FILE, string16(),
FilePath(), &file_type_info, 1, FILE_PATH_LITERAL("p12"),
- web_ui_->tab_contents(), GetParentWindow(),
+ web_ui()->tab_contents(), GetParentWindow(),
reinterpret_cast<void*>(IMPORT_PERSONAL_FILE_SELECTED));
}
void CertificateManagerHandler::ImportPersonalFileSelected(
const FilePath& path) {
file_path_ = path;
- web_ui_->CallJavascriptFunction(
+ web_ui()->CallJavascriptFunction(
"CertificateManager.importPersonalAskPassword");
}
void CertificateManagerHandler::ImportPersonalPasswordSelected(
const ListValue* args) {
if (!args->GetString(0, &password_)){
- web_ui_->CallJavascriptFunction("CertificateRestoreOverlay.dismiss");
+ web_ui()->CallJavascriptFunction("CertificateRestoreOverlay.dismiss");
ImportExportCleanup();
return;
}
@@ -681,7 +681,7 @@ void CertificateManagerHandler::ImportPersonalFileRead(
int read_errno, std::string data) {
if (read_errno) {
ImportExportCleanup();
- web_ui_->CallJavascriptFunction("CertificateRestoreOverlay.dismiss");
+ web_ui()->CallJavascriptFunction("CertificateRestoreOverlay.dismiss");
ShowError(
l10n_util::GetStringUTF8(IDS_CERT_MANAGER_PKCS12_IMPORT_ERROR_TITLE),
l10n_util::GetStringFUTF8(IDS_CERT_MANAGER_READ_ERROR_FORMAT,
@@ -716,7 +716,7 @@ void CertificateManagerHandler::ImportPersonalSlotUnlocked() {
int result = certificate_manager_model_->ImportFromPKCS12(
module_, file_data_, password_, is_extractable);
ImportExportCleanup();
- web_ui_->CallJavascriptFunction("CertificateRestoreOverlay.dismiss");
+ web_ui()->CallJavascriptFunction("CertificateRestoreOverlay.dismiss");
int string_id;
switch (result) {
case net::OK:
@@ -770,7 +770,7 @@ void CertificateManagerHandler::ImportServer(const ListValue* args) {
select_file_dialog_.get(),
SelectFileDialog::SELECT_OPEN_FILE,
FilePath(),
- web_ui_->tab_contents(),
+ web_ui()->tab_contents(),
GetParentWindow(),
reinterpret_cast<void*>(IMPORT_SERVER_FILE_SELECTED));
}
@@ -825,7 +825,7 @@ void CertificateManagerHandler::ImportCA(const ListValue* args) {
ShowCertSelectFileDialog(select_file_dialog_.get(),
SelectFileDialog::SELECT_OPEN_FILE,
FilePath(),
- web_ui_->tab_contents(),
+ web_ui()->tab_contents(),
GetParentWindow(),
reinterpret_cast<void*>(IMPORT_CA_FILE_SELECTED));
}
@@ -865,8 +865,8 @@ void CertificateManagerHandler::ImportCAFileRead(int read_errno,
// TODO(mattm): check here if root_cert is not a CA cert and show error.
StringValue cert_name(root_cert->subject().GetDisplayName());
- web_ui_->CallJavascriptFunction("CertificateEditCaTrustOverlay.showImport",
- cert_name);
+ web_ui()->CallJavascriptFunction("CertificateEditCaTrustOverlay.showImport",
+ cert_name);
}
void CertificateManagerHandler::ImportCATrustSelected(const ListValue* args) {
@@ -880,7 +880,7 @@ void CertificateManagerHandler::ImportCATrustSelected(const ListValue* args) {
if (fail) {
LOG(ERROR) << "ImportCATrustSelected args fail";
ImportExportCleanup();
- web_ui_->CallJavascriptFunction("CertificateEditCaTrustOverlay.dismiss");
+ web_ui()->CallJavascriptFunction("CertificateEditCaTrustOverlay.dismiss");
return;
}
@@ -891,7 +891,7 @@ void CertificateManagerHandler::ImportCATrustSelected(const ListValue* args) {
trust_email * net::CertDatabase::TRUSTED_EMAIL +
trust_obj_sign * net::CertDatabase::TRUSTED_OBJ_SIGN,
&not_imported);
- web_ui_->CallJavascriptFunction("CertificateEditCaTrustOverlay.dismiss");
+ web_ui()->CallJavascriptFunction("CertificateEditCaTrustOverlay.dismiss");
if (!result) {
ShowError(
l10n_util::GetStringUTF8(IDS_CERT_MANAGER_CA_IMPORT_ERROR_TITLE),
@@ -908,7 +908,7 @@ void CertificateManagerHandler::Export(const ListValue* args) {
net::X509Certificate* cert = CallbackArgsToCert(args);
if (!cert)
return;
- ShowCertExportDialog(web_ui_->tab_contents(), GetParentWindow(),
+ ShowCertExportDialog(web_ui()->tab_contents(), GetParentWindow(),
cert->os_cert_handle());
}
@@ -983,7 +983,7 @@ void CertificateManagerHandler::PopulateTree(const std::string& tab_name,
ListValue args;
args.Append(Value::CreateStringValue(tree_name));
args.Append(nodes);
- web_ui_->CallJavascriptFunction("CertificateManager.onPopulateTree", args);
+ web_ui()->CallJavascriptFunction("CertificateManager.onPopulateTree", args);
}
}
@@ -996,7 +996,7 @@ void CertificateManagerHandler::ShowError(const std::string& title,
args.push_back(Value::CreateNullValue()); // cancelTitle
args.push_back(Value::CreateNullValue()); // okCallback
args.push_back(Value::CreateNullValue()); // cancelCallback
- web_ui_->CallJavascriptFunction("AlertOverlay.show", args.get());
+ web_ui()->CallJavascriptFunction("AlertOverlay.show", args.get());
}
void CertificateManagerHandler::ShowImportErrors(
@@ -1022,10 +1022,10 @@ void CertificateManagerHandler::ShowImportErrors(
StringValue title_value(title);
StringValue error_value(error);
- web_ui_->CallJavascriptFunction("CertificateImportErrorOverlay.show",
- title_value,
- error_value,
- cert_error_list);
+ web_ui()->CallJavascriptFunction("CertificateImportErrorOverlay.show",
+ title_value,
+ error_value,
+ cert_error_list);
}
#if defined(OS_CHROMEOS)
@@ -1035,11 +1035,11 @@ void CertificateManagerHandler::CheckTpmTokenReady(const ListValue* args) {
// TODO(xiyuan): Use async way when underlying supports it.
base::FundamentalValue ready(cryptohome->Pkcs11IsTpmTokenReady());
- web_ui_->CallJavascriptFunction("CertificateManager.onCheckTpmTokenReady",
- ready);
+ web_ui()->CallJavascriptFunction("CertificateManager.onCheckTpmTokenReady",
+ ready);
}
#endif
gfx::NativeWindow CertificateManagerHandler::GetParentWindow() const {
- return web_ui_->tab_contents()->GetView()->GetTopLevelNativeWindow();
+ return web_ui()->tab_contents()->GetView()->GetTopLevelNativeWindow();
}
diff --git a/chrome/browser/ui/webui/options/chromeos/about_page_handler.cc b/chrome/browser/ui/webui/options/chromeos/about_page_handler.cc
index 0dcc7bb..5ca10cb 100644
--- a/chrome/browser/ui/webui/options/chromeos/about_page_handler.cc
+++ b/chrome/browser/ui/webui/options/chromeos/about_page_handler.cc
@@ -234,14 +234,14 @@ void AboutPageHandler::GetLocalizedValues(DictionaryValue* localized_strings) {
}
void AboutPageHandler::RegisterMessages() {
- web_ui_->RegisterMessageCallback("PageReady",
+ web_ui()->RegisterMessageCallback("PageReady",
base::Bind(&AboutPageHandler::PageReady, base::Unretained(this)));
- web_ui_->RegisterMessageCallback("SetReleaseTrack",
+ web_ui()->RegisterMessageCallback("SetReleaseTrack",
base::Bind(&AboutPageHandler::SetReleaseTrack, base::Unretained(this)));
- web_ui_->RegisterMessageCallback("CheckNow",
+ web_ui()->RegisterMessageCallback("CheckNow",
base::Bind(&AboutPageHandler::CheckNow, base::Unretained(this)));
- web_ui_->RegisterMessageCallback("RestartNow",
+ web_ui()->RegisterMessageCallback("RestartNow",
base::Bind(&AboutPageHandler::RestartNow, base::Unretained(this)));
}
@@ -366,20 +366,20 @@ void AboutPageHandler::UpdateStatus(
scoped_ptr<Value> insert_delay(Value::CreateBooleanValue(
status.status ==
UpdateEngineClient::UPDATE_STATUS_CHECKING_FOR_UPDATE));
- web_ui_->CallJavascriptFunction("AboutPage.updateStatusCallback",
- *update_message, *insert_delay);
+ web_ui()->CallJavascriptFunction("AboutPage.updateStatusCallback",
+ *update_message, *insert_delay);
scoped_ptr<Value> enabled_value(Value::CreateBooleanValue(enabled));
- web_ui_->CallJavascriptFunction("AboutPage.updateEnableCallback",
- *enabled_value);
+ web_ui()->CallJavascriptFunction("AboutPage.updateEnableCallback",
+ *enabled_value);
scoped_ptr<Value> image_string(Value::CreateStringValue(image));
- web_ui_->CallJavascriptFunction("AboutPage.setUpdateImage",
- *image_string);
+ web_ui()->CallJavascriptFunction("AboutPage.setUpdateImage",
+ *image_string);
}
// We'll change the "Check For Update" button to "Restart" button.
if (status.status == UpdateEngineClient::UPDATE_STATUS_UPDATED_NEED_REBOOT) {
- web_ui_->CallJavascriptFunction("AboutPage.changeToRestartButton");
+ web_ui()->CallJavascriptFunction("AboutPage.changeToRestartButton");
}
}
@@ -387,8 +387,8 @@ void AboutPageHandler::OnOSVersion(VersionLoader::Handle handle,
std::string version) {
if (version.size()) {
scoped_ptr<Value> version_string(Value::CreateStringValue(version));
- web_ui_->CallJavascriptFunction("AboutPage.updateOSVersionCallback",
- *version_string);
+ web_ui()->CallJavascriptFunction("AboutPage.updateOSVersionCallback",
+ *version_string);
}
}
@@ -396,8 +396,8 @@ void AboutPageHandler::OnOSFirmware(VersionLoader::Handle handle,
std::string firmware) {
if (firmware.size()) {
scoped_ptr<Value> firmware_string(Value::CreateStringValue(firmware));
- web_ui_->CallJavascriptFunction("AboutPage.updateOSFirmwareCallback",
- *firmware_string);
+ web_ui()->CallJavascriptFunction("AboutPage.updateOSFirmwareCallback",
+ *firmware_string);
}
}
@@ -411,7 +411,7 @@ void AboutPageHandler::UpdateSelectedChannel(UpdateObserver* observer,
// is valid.
AboutPageHandler* handler = observer->page_handler();
scoped_ptr<Value> channel_string(Value::CreateStringValue(channel));
- handler->web_ui_->CallJavascriptFunction(
+ handler->web_ui()->CallJavascriptFunction(
"AboutPage.updateSelectedOptionCallback", *channel_string);
}
}
diff --git a/chrome/browser/ui/webui/options/chromeos/accounts_options_handler.cc b/chrome/browser/ui/webui/options/chromeos/accounts_options_handler.cc
index 431a5dfd..1776ef0 100644
--- a/chrome/browser/ui/webui/options/chromeos/accounts_options_handler.cc
+++ b/chrome/browser/ui/webui/options/chromeos/accounts_options_handler.cc
@@ -44,14 +44,13 @@ AccountsOptionsHandler::~AccountsOptionsHandler() {
}
void AccountsOptionsHandler::RegisterMessages() {
- DCHECK(web_ui_);
- web_ui_->RegisterMessageCallback("whitelistUser",
+ web_ui()->RegisterMessageCallback("whitelistUser",
base::Bind(&AccountsOptionsHandler::HandleWhitelistUser,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("unwhitelistUser",
+ web_ui()->RegisterMessageCallback("unwhitelistUser",
base::Bind(&AccountsOptionsHandler::HandleUnwhitelistUser,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("whitelistExistingUsers",
+ web_ui()->RegisterMessageCallback("whitelistExistingUsers",
base::Bind(&AccountsOptionsHandler::HandleWhitelistExistingUsers,
base::Unretained(this)));
}
diff --git a/chrome/browser/ui/webui/options/chromeos/bluetooth_options_handler.cc b/chrome/browser/ui/webui/options/chromeos/bluetooth_options_handler.cc
index fa88d07..d714e82 100644
--- a/chrome/browser/ui/webui/options/chromeos/bluetooth_options_handler.cc
+++ b/chrome/browser/ui/webui/options/chromeos/bluetooth_options_handler.cc
@@ -101,7 +101,6 @@ void BluetoothOptionsHandler::GetLocalizedValues(
}
void BluetoothOptionsHandler::Initialize() {
- DCHECK(web_ui_);
// Bluetooth support is a work in progress. Supress the feature unless
// explicitly enabled via a command line flag.
if (!CommandLine::ForCurrentProcess()
@@ -109,13 +108,13 @@ void BluetoothOptionsHandler::Initialize() {
return;
}
- web_ui_->CallJavascriptFunction(
+ web_ui()->CallJavascriptFunction(
"options.SystemOptions.showBluetoothSettings");
// TODO(kevers): Determine whether bluetooth adapter is powered.
bool bluetooth_on = false;
base::FundamentalValue checked(bluetooth_on);
- web_ui_->CallJavascriptFunction(
+ web_ui()->CallJavascriptFunction(
"options.SystemOptions.setBluetoothState", checked);
chromeos::BluetoothManager* bluetooth_manager =
@@ -129,14 +128,13 @@ void BluetoothOptionsHandler::Initialize() {
}
void BluetoothOptionsHandler::RegisterMessages() {
- DCHECK(web_ui_);
- web_ui_->RegisterMessageCallback("bluetoothEnableChange",
+ web_ui()->RegisterMessageCallback("bluetoothEnableChange",
base::Bind(&BluetoothOptionsHandler::EnableChangeCallback,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("findBluetoothDevices",
+ web_ui()->RegisterMessageCallback("findBluetoothDevices",
base::Bind(&BluetoothOptionsHandler::FindDevicesCallback,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("updateBluetoothDevice",
+ web_ui()->RegisterMessageCallback("updateBluetoothDevice",
base::Bind(&BluetoothOptionsHandler::UpdateDeviceCallback,
base::Unretained(this)));
}
@@ -147,7 +145,7 @@ void BluetoothOptionsHandler::EnableChangeCallback(
args->GetBoolean(0, &bluetooth_enabled);
// TODO(kevers): Call Bluetooth API to enable or disable.
base::FundamentalValue checked(bluetooth_enabled);
- web_ui_->CallJavascriptFunction(
+ web_ui()->CallJavascriptFunction(
"options.SystemOptions.setBluetoothState", checked);
}
@@ -218,7 +216,7 @@ void BluetoothOptionsHandler::SendDeviceNotification(
if (params) {
js_properties.MergeDictionary(params);
}
- web_ui_->CallJavascriptFunction(
+ web_ui()->CallJavascriptFunction(
"options.SystemOptions.addBluetoothDevice",
js_properties);
}
@@ -279,7 +277,7 @@ void BluetoothOptionsHandler::DiscoveryStarted(const std::string& adapter_id) {
void BluetoothOptionsHandler::DiscoveryEnded(const std::string& adapter_id) {
VLOG(2) << "Discovery ended on " << adapter_id;
- web_ui_->CallJavascriptFunction(
+ web_ui()->CallJavascriptFunction(
"options.SystemOptions.notifyBluetoothSearchComplete");
// Stop the discovery session.
@@ -343,7 +341,7 @@ void BluetoothOptionsHandler::GenerateFakeDeviceList() {
false,
false,
"");
- web_ui_->CallJavascriptFunction(
+ web_ui()->CallJavascriptFunction(
"options.SystemOptions.notifyBluetoothSearchComplete");
}
diff --git a/chrome/browser/ui/webui/options/chromeos/change_picture_options_handler.cc b/chrome/browser/ui/webui/options/chromeos/change_picture_options_handler.cc
index 20ca200..6d2cac18 100644
--- a/chrome/browser/ui/webui/options/chromeos/change_picture_options_handler.cc
+++ b/chrome/browser/ui/webui/options/chromeos/change_picture_options_handler.cc
@@ -96,20 +96,19 @@ void ChangePictureOptionsHandler::GetLocalizedValues(
}
void ChangePictureOptionsHandler::RegisterMessages() {
- DCHECK(web_ui_);
- web_ui_->RegisterMessageCallback("chooseFile",
+ web_ui()->RegisterMessageCallback("chooseFile",
base::Bind(&ChangePictureOptionsHandler::HandleChooseFile,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("takePhoto",
+ web_ui()->RegisterMessageCallback("takePhoto",
base::Bind(&ChangePictureOptionsHandler::HandleTakePhoto,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("onChangePicturePageShown",
+ web_ui()->RegisterMessageCallback("onChangePicturePageShown",
base::Bind(&ChangePictureOptionsHandler::HandlePageShown,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("onChangePicturePageInitialized",
+ web_ui()->RegisterMessageCallback("onChangePicturePageInitialized",
base::Bind(&ChangePictureOptionsHandler::HandlePageInitialized,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("selectImage",
+ web_ui()->RegisterMessageCallback("selectImage",
base::Bind(&ChangePictureOptionsHandler::HandleSelectImage,
base::Unretained(this)));
}
@@ -119,8 +118,8 @@ void ChangePictureOptionsHandler::SendDefaultImages() {
for (int i = 0; i < kDefaultImagesCount; ++i) {
image_urls.Append(new StringValue(GetDefaultImageUrl(i)));
}
- web_ui_->CallJavascriptFunction("ChangePictureOptions.setDefaultImages",
- image_urls);
+ web_ui()->CallJavascriptFunction("ChangePictureOptions.setDefaultImages",
+ image_urls);
}
void ChangePictureOptionsHandler::HandleChooseFile(const ListValue* args) {
@@ -145,7 +144,7 @@ void ChangePictureOptionsHandler::HandleChooseFile(const ListValue* args) {
&file_type_info,
0,
FILE_PATH_LITERAL(""),
- web_ui_->tab_contents(),
+ web_ui()->tab_contents(),
GetBrowserWindow(),
NULL);
}
@@ -198,7 +197,7 @@ void ChangePictureOptionsHandler::SendSelectedImage() {
// User has image from camera/file, record it and add to the image list.
previous_image_ = user.image();
previous_image_data_url_ = web_ui_util::GetImageDataUrl(previous_image_);
- web_ui_->CallJavascriptFunction("ChangePictureOptions.setOldImage");
+ web_ui()->CallJavascriptFunction("ChangePictureOptions.setOldImage");
break;
}
case User::kProfileImageIndex: {
@@ -211,8 +210,8 @@ void ChangePictureOptionsHandler::SendSelectedImage() {
previous_image_index_ < kDefaultImagesCount);
// User has image from the set of default images.
base::StringValue image_url(GetDefaultImageUrl(previous_image_index_));
- web_ui_->CallJavascriptFunction("ChangePictureOptions.setSelectedImage",
- image_url);
+ web_ui()->CallJavascriptFunction("ChangePictureOptions.setSelectedImage",
+ image_url);
}
}
}
@@ -221,8 +220,8 @@ void ChangePictureOptionsHandler::SendProfileImage(const SkBitmap& image,
bool should_select) {
base::StringValue data_url(web_ui_util::GetImageDataUrl(image));
base::FundamentalValue select(should_select);
- web_ui_->CallJavascriptFunction("ChangePictureOptions.setProfileImage",
- data_url, select);
+ web_ui()->CallJavascriptFunction("ChangePictureOptions.setProfileImage",
+ data_url, select);
}
void ChangePictureOptionsHandler::UpdateProfileImage() {
@@ -317,8 +316,8 @@ void ChangePictureOptionsHandler::CheckCameraPresence() {
void ChangePictureOptionsHandler::SetCameraPresent(bool present) {
base::FundamentalValue present_value(present);
- web_ui_->CallJavascriptFunction("ChangePictureOptions.setCameraPresent",
- present_value);
+ web_ui()->CallJavascriptFunction("ChangePictureOptions.setCameraPresent",
+ present_value);
}
void ChangePictureOptionsHandler::OnCameraPresenceCheckDone() {
@@ -339,7 +338,7 @@ void ChangePictureOptionsHandler::Observe(
gfx::NativeWindow ChangePictureOptionsHandler::GetBrowserWindow() const {
Browser* browser =
- BrowserList::FindBrowserWithProfile(Profile::FromWebUI(web_ui_));
+ BrowserList::FindBrowserWithProfile(Profile::FromWebUI(web_ui()));
if (!browser)
return NULL;
return browser->window()->GetNativeHandle();
diff --git a/chrome/browser/ui/webui/options/chromeos/core_chromeos_options_handler.cc b/chrome/browser/ui/webui/options/chromeos/core_chromeos_options_handler.cc
index 31543d5..f03db29 100644
--- a/chrome/browser/ui/webui/options/chromeos/core_chromeos_options_handler.cc
+++ b/chrome/browser/ui/webui/options/chromeos/core_chromeos_options_handler.cc
@@ -94,7 +94,7 @@ CoreChromeOSOptionsHandler::CoreChromeOSOptionsHandler()
CoreChromeOSOptionsHandler::~CoreChromeOSOptionsHandler() {
PrefProxyConfigTracker* proxy_tracker =
- Profile::FromWebUI(web_ui_)->GetProxyConfigTracker();
+ Profile::FromWebUI(web_ui())->GetProxyConfigTracker();
proxy_tracker->RemoveNotificationCallback(
base::Bind(&CoreChromeOSOptionsHandler::NotifyProxyPrefsChanged,
pointer_factory_.GetWeakPtr()));
@@ -102,10 +102,10 @@ CoreChromeOSOptionsHandler::~CoreChromeOSOptionsHandler() {
void CoreChromeOSOptionsHandler::Initialize() {
proxy_prefs_.reset(PrefSetObserver::CreateProxyPrefSetObserver(
- Profile::FromWebUI(web_ui_)->GetPrefs(), this));
+ Profile::FromWebUI(web_ui())->GetPrefs(), this));
// Observe the chromeos::ProxyConfigServiceImpl for changes from the UI.
PrefProxyConfigTracker* proxy_tracker =
- Profile::FromWebUI(web_ui_)->GetProxyConfigTracker();
+ Profile::FromWebUI(web_ui())->GetProxyConfigTracker();
proxy_tracker->AddNotificationCallback(
base::Bind(&CoreChromeOSOptionsHandler::NotifyProxyPrefsChanged,
pointer_factory_.GetWeakPtr()));
@@ -115,7 +115,7 @@ base::Value* CoreChromeOSOptionsHandler::FetchPref(
const std::string& pref_name) {
if (proxy_cros_settings_parser::IsProxyPref(pref_name)) {
base::Value *value = NULL;
- proxy_cros_settings_parser::GetProxyPrefValue(Profile::FromWebUI(web_ui_),
+ proxy_cros_settings_parser::GetProxyPrefValue(Profile::FromWebUI(web_ui()),
pref_name, &value);
if (!value)
return base::Value::CreateNullValue();
@@ -126,7 +126,7 @@ base::Value* CoreChromeOSOptionsHandler::FetchPref(
// Specially handle kUseSharedProxies because kProxy controls it to
// determine if it's managed by policy/extension.
if (pref_name == prefs::kUseSharedProxies) {
- PrefService* pref_service = Profile::FromWebUI(web_ui_)->GetPrefs();
+ PrefService* pref_service = Profile::FromWebUI(web_ui())->GetPrefs();
const PrefService::Preference* pref =
pref_service->FindPreference(prefs::kUseSharedProxies);
if (!pref)
@@ -170,7 +170,7 @@ void CoreChromeOSOptionsHandler::SetPref(const std::string& pref_name,
const base::Value* value,
const std::string& metric) {
if (proxy_cros_settings_parser::IsProxyPref(pref_name)) {
- proxy_cros_settings_parser::SetProxyPrefValue(Profile::FromWebUI(web_ui_),
+ proxy_cros_settings_parser::SetProxyPrefValue(Profile::FromWebUI(web_ui()),
pref_name, value);
ProcessUserMetric(value, metric);
return;
@@ -208,7 +208,7 @@ void CoreChromeOSOptionsHandler::Observe(
// Special handling for preferences kUseSharedProxies and kProxy, the latter
// controls the former and decides if it's managed by policy/extension.
if (type == chrome::NOTIFICATION_PREF_CHANGED) {
- const PrefService* pref_service = Profile::FromWebUI(web_ui_)->GetPrefs();
+ const PrefService* pref_service = Profile::FromWebUI(web_ui())->GetPrefs();
std::string* pref_name = content::Details<std::string>(details).ptr();
if (content::Source<PrefService>(source).ptr() == pref_service &&
(proxy_prefs_->IsObserved(*pref_name) ||
@@ -222,7 +222,6 @@ void CoreChromeOSOptionsHandler::Observe(
void CoreChromeOSOptionsHandler::NotifySettingsChanged(
const std::string* setting_name) {
- DCHECK(web_ui_);
DCHECK(CrosSettings::Get()->IsCrosSettings(*setting_name));
const base::Value* value = FetchPref(*setting_name);
if (!value) {
@@ -238,19 +237,18 @@ void CoreChromeOSOptionsHandler::NotifySettingsChanged(
ListValue result_value;
result_value.Append(base::Value::CreateStringValue(setting_name->c_str()));
result_value.Append(value->DeepCopy());
- web_ui_->CallJavascriptFunction(WideToASCII(callback_function),
- result_value);
+ web_ui()->CallJavascriptFunction(WideToASCII(callback_function),
+ result_value);
}
if (value)
delete value;
}
void CoreChromeOSOptionsHandler::NotifyProxyPrefsChanged() {
- DCHECK(web_ui_);
for (size_t i = 0; i < kProxySettingsCount; ++i) {
base::Value* value = NULL;
proxy_cros_settings_parser::GetProxyPrefValue(
- Profile::FromWebUI(web_ui_), kProxySettings[i], &value);
+ Profile::FromWebUI(web_ui()), kProxySettings[i], &value);
DCHECK(value);
PreferenceCallbackMap::const_iterator iter =
pref_callback_map_.find(kProxySettings[i]);
@@ -259,8 +257,8 @@ void CoreChromeOSOptionsHandler::NotifyProxyPrefsChanged() {
ListValue result_value;
result_value.Append(base::Value::CreateStringValue(kProxySettings[i]));
result_value.Append(value->DeepCopy());
- web_ui_->CallJavascriptFunction(WideToASCII(callback_function),
- result_value);
+ web_ui()->CallJavascriptFunction(WideToASCII(callback_function),
+ result_value);
}
if (value)
delete value;
diff --git a/chrome/browser/ui/webui/options/chromeos/cros_language_options_handler.cc b/chrome/browser/ui/webui/options/chromeos/cros_language_options_handler.cc
index 06bfbc4..38d3851 100644
--- a/chrome/browser/ui/webui/options/chromeos/cros_language_options_handler.cc
+++ b/chrome/browser/ui/webui/options/chromeos/cros_language_options_handler.cc
@@ -77,16 +77,16 @@ void CrosLanguageOptionsHandler::GetLocalizedValues(
void CrosLanguageOptionsHandler::RegisterMessages() {
LanguageOptionsHandlerCommon::RegisterMessages();
- web_ui_->RegisterMessageCallback("inputMethodDisable",
+ web_ui()->RegisterMessageCallback("inputMethodDisable",
base::Bind(&CrosLanguageOptionsHandler::InputMethodDisableCallback,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("inputMethodEnable",
+ web_ui()->RegisterMessageCallback("inputMethodEnable",
base::Bind(&CrosLanguageOptionsHandler::InputMethodEnableCallback,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("inputMethodOptionsOpen",
+ web_ui()->RegisterMessageCallback("inputMethodOptionsOpen",
base::Bind(&CrosLanguageOptionsHandler::InputMethodOptionsOpenCallback,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("uiLanguageRestart",
+ web_ui()->RegisterMessageCallback("uiLanguageRestart",
base::Bind(&CrosLanguageOptionsHandler::RestartCallback,
base::Unretained(this)));
}
@@ -204,7 +204,7 @@ string16 CrosLanguageOptionsHandler::GetProductName() {
void CrosLanguageOptionsHandler::SetApplicationLocale(
const std::string& language_code) {
- Profile::FromWebUI(web_ui_)->ChangeAppLocale(
+ Profile::FromWebUI(web_ui())->ChangeAppLocale(
language_code, Profile::APP_LOCALE_CHANGED_VIA_SETTINGS);
}
@@ -212,7 +212,7 @@ void CrosLanguageOptionsHandler::RestartCallback(const ListValue* args) {
content::RecordAction(UserMetricsAction("LanguageOptions_SignOut"));
Browser* browser = Browser::GetBrowserForController(
- &web_ui_->tab_contents()->GetController(), NULL);
+ &web_ui()->tab_contents()->GetController(), NULL);
if (browser)
browser->ExecuteCommand(IDC_EXIT);
}
diff --git a/chrome/browser/ui/webui/options/chromeos/internet_options_handler.cc b/chrome/browser/ui/webui/options/chromeos/internet_options_handler.cc
index 198eda1..64c70ee 100644
--- a/chrome/browser/ui/webui/options/chromeos/internet_options_handler.cc
+++ b/chrome/browser/ui/webui/options/chromeos/internet_options_handler.cc
@@ -549,47 +549,46 @@ void InternetOptionsHandler::Initialize() {
void InternetOptionsHandler::RegisterMessages() {
// Setup handlers specific to this panel.
- DCHECK(web_ui_);
- web_ui_->RegisterMessageCallback("buttonClickCallback",
+ web_ui()->RegisterMessageCallback("buttonClickCallback",
base::Bind(&InternetOptionsHandler::ButtonClickCallback,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("refreshCellularPlan",
+ web_ui()->RegisterMessageCallback("refreshCellularPlan",
base::Bind(&InternetOptionsHandler::RefreshCellularPlanCallback,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("setPreferNetwork",
+ web_ui()->RegisterMessageCallback("setPreferNetwork",
base::Bind(&InternetOptionsHandler::SetPreferNetworkCallback,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("setAutoConnect",
+ web_ui()->RegisterMessageCallback("setAutoConnect",
base::Bind(&InternetOptionsHandler::SetAutoConnectCallback,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("setIPConfig",
+ web_ui()->RegisterMessageCallback("setIPConfig",
base::Bind(&InternetOptionsHandler::SetIPConfigCallback,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("enableWifi",
+ web_ui()->RegisterMessageCallback("enableWifi",
base::Bind(&InternetOptionsHandler::EnableWifiCallback,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("disableWifi",
+ web_ui()->RegisterMessageCallback("disableWifi",
base::Bind(&InternetOptionsHandler::DisableWifiCallback,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("enableCellular",
+ web_ui()->RegisterMessageCallback("enableCellular",
base::Bind(&InternetOptionsHandler::EnableCellularCallback,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("disableCellular",
+ web_ui()->RegisterMessageCallback("disableCellular",
base::Bind(&InternetOptionsHandler::DisableCellularCallback,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("buyDataPlan",
+ web_ui()->RegisterMessageCallback("buyDataPlan",
base::Bind(&InternetOptionsHandler::BuyDataPlanCallback,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("showMorePlanInfo",
+ web_ui()->RegisterMessageCallback("showMorePlanInfo",
base::Bind(&InternetOptionsHandler::BuyDataPlanCallback,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("setApn",
+ web_ui()->RegisterMessageCallback("setApn",
base::Bind(&InternetOptionsHandler::SetApnCallback,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("setSimCardLock",
+ web_ui()->RegisterMessageCallback("setSimCardLock",
base::Bind(&InternetOptionsHandler::SetSimCardLockCallback,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("changePin",
+ web_ui()->RegisterMessageCallback("changePin",
base::Bind(&InternetOptionsHandler::ChangePinCallback,
base::Unretained(this)));
}
@@ -621,10 +620,10 @@ void InternetOptionsHandler::DisableCellularCallback(const ListValue* args) {
}
void InternetOptionsHandler::BuyDataPlanCallback(const ListValue* args) {
- if (!web_ui_)
+ if (!web_ui())
return;
Browser* browser = BrowserList::FindBrowserWithFeature(
- Profile::FromWebUI(web_ui_), Browser::FEATURE_TABSTRIP);
+ Profile::FromWebUI(web_ui()), Browser::FEATURE_TABSTRIP);
if (browser)
browser->OpenMobilePlanTabAndActivate();
}
@@ -678,13 +677,13 @@ void InternetOptionsHandler::ChangePinCallback(const ListValue* args) {
void InternetOptionsHandler::RefreshNetworkData() {
DictionaryValue dictionary;
FillNetworkInfo(&dictionary);
- web_ui_->CallJavascriptFunction(
+ web_ui()->CallJavascriptFunction(
"options.InternetOptions.refreshNetworkData", dictionary);
}
void InternetOptionsHandler::OnNetworkManagerChanged(
chromeos::NetworkLibrary* cros) {
- if (!web_ui_)
+ if (!web_ui())
return;
MonitorNetworks();
RefreshNetworkData();
@@ -693,7 +692,7 @@ void InternetOptionsHandler::OnNetworkManagerChanged(
void InternetOptionsHandler::OnNetworkChanged(
chromeos::NetworkLibrary* cros,
const chromeos::Network* network) {
- if (web_ui_)
+ if (web_ui())
RefreshNetworkData();
}
@@ -726,7 +725,7 @@ void InternetOptionsHandler::MonitorNetworks() {
void InternetOptionsHandler::OnCellularDataPlanChanged(
chromeos::NetworkLibrary* cros) {
- if (!web_ui_)
+ if (!web_ui())
return;
const chromeos::CellularNetwork* cellular = cros_->cellular_network();
if (!cellular)
@@ -747,7 +746,7 @@ void InternetOptionsHandler::OnCellularDataPlanChanged(
cellular->activation_state() == chromeos::ACTIVATION_STATE_ACTIVATED);
connection_plans.Set("plans", plan_list);
SetActivationButtonVisibility(cellular, &connection_plans);
- web_ui_->CallJavascriptFunction(
+ web_ui()->CallJavascriptFunction(
"options.InternetOptions.updateCellularPlans", connection_plans);
}
@@ -759,7 +758,7 @@ void InternetOptionsHandler::Observe(
OptionsPageUIHandler::Observe(type, source, details);
if (type == chrome::NOTIFICATION_REQUIRE_PIN_SETTING_CHANGE_ENDED) {
base::FundamentalValue require_pin(*content::Details<bool>(details).ptr());
- web_ui_->CallJavascriptFunction(
+ web_ui()->CallJavascriptFunction(
"options.InternetOptions.updateSecurityTab", require_pin);
} else if (type == chrome::NOTIFICATION_ENTER_PIN_ENDED) {
// We make an assumption (which is valid for now) that the SIM
@@ -769,7 +768,7 @@ void InternetOptionsHandler::Observe(
if (cancelled) {
base::DictionaryValue dictionary;
FillNetworkInfo(&dictionary);
- web_ui_->CallJavascriptFunction(
+ web_ui()->CallJavascriptFunction(
"options.InternetOptions.setupAttributes", dictionary);
}
// The case in which the correct PIN was entered and the SIM is
@@ -862,8 +861,8 @@ void InternetOptionsHandler::PopulateDictionaryDetails(
const chromeos::Network* network) {
DCHECK(network);
- if (web_ui_) {
- Profile::FromWebUI(web_ui_)->GetProxyConfigTracker()->UISetCurrentNetwork(
+ if (web_ui()) {
+ Profile::FromWebUI(web_ui())->GetProxyConfigTracker()->UISetCurrentNetwork(
network->service_path());
}
@@ -974,7 +973,7 @@ void InternetOptionsHandler::PopulateDictionaryDetails(
dictionary.SetBoolean("deviceConnected", cros_->ethernet_connected());
}
- web_ui_->CallJavascriptFunction(
+ web_ui()->CallJavascriptFunction(
"options.InternetOptions.showDetailedInfo", dictionary);
}
@@ -1113,7 +1112,7 @@ gfx::NativeWindow InternetOptionsHandler::GetNativeWindow() const {
// TODO(beng): This is an improper direct dependency on Browser. Route this
// through some sort of delegate.
Browser* browser =
- BrowserList::FindBrowserWithProfile(Profile::FromWebUI(web_ui_));
+ BrowserList::FindBrowserWithProfile(Profile::FromWebUI(web_ui()));
return browser->window()->GetNativeHandle();
}
diff --git a/chrome/browser/ui/webui/options/chromeos/proxy_handler.cc b/chrome/browser/ui/webui/options/chromeos/proxy_handler.cc
index 30e9a6c..be47bb5 100644
--- a/chrome/browser/ui/webui/options/chromeos/proxy_handler.cc
+++ b/chrome/browser/ui/webui/options/chromeos/proxy_handler.cc
@@ -79,8 +79,8 @@ void ProxyHandler::GetLocalizedValues(
void ProxyHandler::SetNetworkName(const std::string& name) {
StringValue network(name);
- web_ui_->CallJavascriptFunction("options.ProxyOptions.setNetworkName",
- network);
+ web_ui()->CallJavascriptFunction("options.ProxyOptions.setNetworkName",
+ network);
}
} // namespace chromeos
diff --git a/chrome/browser/ui/webui/options/chromeos/stats_options_handler.cc b/chrome/browser/ui/webui/options/chromeos/stats_options_handler.cc
index f4738b6..fb935fd 100644
--- a/chrome/browser/ui/webui/options/chromeos/stats_options_handler.cc
+++ b/chrome/browser/ui/webui/options/chromeos/stats_options_handler.cc
@@ -27,7 +27,7 @@ void StatsOptionsHandler::Initialize() {
// WebUIMessageHandler implementation.
void StatsOptionsHandler::RegisterMessages() {
- web_ui_->RegisterMessageCallback("metricsReportingCheckboxAction",
+ web_ui()->RegisterMessageCallback("metricsReportingCheckboxAction",
base::Bind(&StatsOptionsHandler::HandleMetricsReportingCheckbox,
base::Unretained(this)));
}
diff --git a/chrome/browser/ui/webui/options/chromeos/system_options_handler.cc b/chrome/browser/ui/webui/options/chromeos/system_options_handler.cc
index e865502..ebc781a 100644
--- a/chrome/browser/ui/webui/options/chromeos/system_options_handler.cc
+++ b/chrome/browser/ui/webui/options/chromeos/system_options_handler.cc
@@ -127,11 +127,10 @@ void SystemOptionsHandler::GetLocalizedValues(
}
void SystemOptionsHandler::Initialize() {
- DCHECK(web_ui_);
PrefService* pref_service = g_browser_process->local_state();
bool acc_enabled = pref_service->GetBoolean(prefs::kSpokenFeedbackEnabled);
base::FundamentalValue checked(acc_enabled);
- web_ui_->CallJavascriptFunction(
+ web_ui()->CallJavascriptFunction(
"options.SystemOptions.SetAccessibilityCheckboxState", checked);
chromeos::XInputHierarchyChangedEventListener::GetInstance()
@@ -155,28 +154,27 @@ void SystemOptionsHandler::CheckMouseExists() {
void SystemOptionsHandler::TouchpadExists(bool* exists) {
base::FundamentalValue val(*exists);
- web_ui_->CallJavascriptFunction("options.SystemOptions.showTouchpadControls",
- val);
+ web_ui()->CallJavascriptFunction("options.SystemOptions.showTouchpadControls",
+ val);
delete exists;
}
void SystemOptionsHandler::MouseExists(bool* exists) {
base::FundamentalValue val(*exists);
- web_ui_->CallJavascriptFunction("options.SystemOptions.showMouseControls",
- val);
+ web_ui()->CallJavascriptFunction("options.SystemOptions.showMouseControls",
+ val);
delete exists;
}
void SystemOptionsHandler::RegisterMessages() {
- DCHECK(web_ui_);
- web_ui_->RegisterMessageCallback("accessibilityChange",
+ web_ui()->RegisterMessageCallback("accessibilityChange",
base::Bind(&SystemOptionsHandler::AccessibilityChangeCallback,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("decreaseScreenBrightness",
+ web_ui()->RegisterMessageCallback("decreaseScreenBrightness",
base::Bind(&SystemOptionsHandler::DecreaseScreenBrightnessCallback,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("increaseScreenBrightness",
+ web_ui()->RegisterMessageCallback("increaseScreenBrightness",
base::Bind(&SystemOptionsHandler::IncreaseScreenBrightnessCallback,
base::Unretained(this)));
}
diff --git a/chrome/browser/ui/webui/options/chromeos/virtual_keyboard_manager_handler.cc b/chrome/browser/ui/webui/options/chromeos/virtual_keyboard_manager_handler.cc
index 1e44643..061a6b3 100644
--- a/chrome/browser/ui/webui/options/chromeos/virtual_keyboard_manager_handler.cc
+++ b/chrome/browser/ui/webui/options/chromeos/virtual_keyboard_manager_handler.cc
@@ -54,28 +54,27 @@ void VirtualKeyboardManagerHandler::GetLocalizedValues(
RegisterTitle(localized_strings, "virtualKeyboardPage",
IDS_OPTIONS_SETTINGS_LANGUAGES_VIRTUAL_KEYBOARD_SETTINGS_TITLE);
- // Do not call GetVirtualKeyboardList() here since |web_ui_| is not ready yet.
+ // Do not call GetVirtualKeyboardList() here since |web_ui()| is not ready
+ // yet.
}
void VirtualKeyboardManagerHandler::Initialize() {
}
void VirtualKeyboardManagerHandler::RegisterMessages() {
- DCHECK(web_ui_);
// Register handler functions for chrome.send().
- web_ui_->RegisterMessageCallback("updateVirtualKeyboardList",
+ web_ui()->RegisterMessageCallback("updateVirtualKeyboardList",
base::Bind(&VirtualKeyboardManagerHandler::UpdateVirtualKeyboardList,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("setVirtualKeyboardPreference",
+ web_ui()->RegisterMessageCallback("setVirtualKeyboardPreference",
base::Bind(&VirtualKeyboardManagerHandler::SetVirtualKeyboardPreference,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("clearVirtualKeyboardPreference",
+ web_ui()->RegisterMessageCallback("clearVirtualKeyboardPreference",
base::Bind(&VirtualKeyboardManagerHandler::ClearVirtualKeyboardPreference,
base::Unretained(this)));
}
ListValue* VirtualKeyboardManagerHandler::GetVirtualKeyboardList() {
- DCHECK(web_ui_);
ime::InputMethodManager* input_method =
ime::InputMethodManager::GetInstance();
@@ -87,7 +86,7 @@ ListValue* VirtualKeyboardManagerHandler::GetVirtualKeyboardList() {
input_method->GetUrlToKeyboardMapping();
// Get the current pref values.
- PrefService* prefs = Profile::FromWebUI(web_ui_)->GetPrefs();
+ PrefService* prefs = Profile::FromWebUI(web_ui())->GetPrefs();
DCHECK(prefs);
const DictionaryValue* virtual_keyboard_pref =
prefs->GetDictionary(prefs::kLanguagePreferredVirtualKeyboard);
@@ -100,13 +99,12 @@ void VirtualKeyboardManagerHandler::UpdateVirtualKeyboardList(
const ListValue* args) {
scoped_ptr<Value> virtual_keyboards(GetVirtualKeyboardList());
DCHECK(virtual_keyboards.get());
- web_ui_->CallJavascriptFunction(
+ web_ui()->CallJavascriptFunction(
"VirtualKeyboardManager.updateVirtualKeyboardList", *virtual_keyboards);
}
void VirtualKeyboardManagerHandler::SetVirtualKeyboardPreference(
const ListValue* args) {
- DCHECK(web_ui_);
std::string layout, url;
if (!args || !args->GetString(0, &layout) || !args->GetString(1, &url)) {
LOG(ERROR) << "SetVirtualKeyboardPreference: Invalid argument";
@@ -122,7 +120,7 @@ void VirtualKeyboardManagerHandler::SetVirtualKeyboardPreference(
return;
}
- PrefService* prefs = Profile::FromWebUI(web_ui_)->GetPrefs();
+ PrefService* prefs = Profile::FromWebUI(web_ui())->GetPrefs();
DCHECK(prefs);
{
DictionaryPrefUpdate updater(
@@ -135,7 +133,6 @@ void VirtualKeyboardManagerHandler::SetVirtualKeyboardPreference(
void VirtualKeyboardManagerHandler::ClearVirtualKeyboardPreference(
const ListValue* args) {
- DCHECK(web_ui_);
std::string layout;
if (!args || !args->GetString(0, &layout)) {
LOG(ERROR) << "ClearVirtualKeyboardPreference: Invalid argument";
@@ -150,7 +147,7 @@ void VirtualKeyboardManagerHandler::ClearVirtualKeyboardPreference(
return;
}
- PrefService* prefs = Profile::FromWebUI(web_ui_)->GetPrefs();
+ PrefService* prefs = Profile::FromWebUI(web_ui())->GetPrefs();
DCHECK(prefs);
{
DictionaryPrefUpdate updater(
diff --git a/chrome/browser/ui/webui/options/clear_browser_data_handler.cc b/chrome/browser/ui/webui/options/clear_browser_data_handler.cc
index c1af0f5..494952b 100644
--- a/chrome/browser/ui/webui/options/clear_browser_data_handler.cc
+++ b/chrome/browser/ui/webui/options/clear_browser_data_handler.cc
@@ -29,7 +29,7 @@ ClearBrowserDataHandler::~ClearBrowserDataHandler() {
void ClearBrowserDataHandler::Initialize() {
clear_plugin_lso_data_enabled_.Init(prefs::kClearPluginLSODataEnabled,
- Profile::FromWebUI(web_ui_)->GetPrefs(),
+ Profile::FromWebUI(web_ui())->GetPrefs(),
NULL);
}
@@ -86,14 +86,13 @@ void ClearBrowserDataHandler::GetLocalizedValues(
void ClearBrowserDataHandler::RegisterMessages() {
// Setup handlers specific to this panel.
- DCHECK(web_ui_);
- web_ui_->RegisterMessageCallback("performClearBrowserData",
+ web_ui()->RegisterMessageCallback("performClearBrowserData",
base::Bind(&ClearBrowserDataHandler::HandleClearBrowserData,
base::Unretained(this)));
}
void ClearBrowserDataHandler::HandleClearBrowserData(const ListValue* value) {
- Profile* profile = Profile::FromWebUI(web_ui_);
+ Profile* profile = Profile::FromWebUI(web_ui());
PrefService* prefs = profile->GetPrefs();
int remove_mask = 0;
@@ -118,8 +117,8 @@ void ClearBrowserDataHandler::HandleClearBrowserData(const ListValue* value) {
int period_selected = prefs->GetInteger(prefs::kDeleteTimePeriod);
base::FundamentalValue state(true);
- web_ui_->CallJavascriptFunction("ClearBrowserDataOverlay.setClearingState",
- state);
+ web_ui()->CallJavascriptFunction("ClearBrowserDataOverlay.setClearingState",
+ state);
// If we are still observing a previous data remover, we need to stop
// observing.
@@ -138,6 +137,5 @@ void ClearBrowserDataHandler::OnBrowsingDataRemoverDone() {
// No need to remove ourselves as an observer as BrowsingDataRemover deletes
// itself after we return.
remover_ = NULL;
- DCHECK(web_ui_);
- web_ui_->CallJavascriptFunction("ClearBrowserDataOverlay.doneClearing");
+ web_ui()->CallJavascriptFunction("ClearBrowserDataOverlay.doneClearing");
}
diff --git a/chrome/browser/ui/webui/options/content_settings_handler.cc b/chrome/browser/ui/webui/options/content_settings_handler.cc
index 8b5d363..ea1afe8 100644
--- a/chrome/browser/ui/webui/options/content_settings_handler.cc
+++ b/chrome/browser/ui/webui/options/content_settings_handler.cc
@@ -304,7 +304,7 @@ void ContentSettingsHandler::Initialize() {
notification_registrar_.Add(
this, chrome::NOTIFICATION_DESKTOP_NOTIFICATION_SETTINGS_CHANGED,
content::NotificationService::AllSources());
- Profile* profile = Profile::FromWebUI(web_ui_);
+ Profile* profile = Profile::FromWebUI(web_ui());
notification_registrar_.Add(
this, chrome::NOTIFICATION_PROTOCOL_HANDLER_REGISTRY_CHANGED,
content::Source<Profile>(profile));
@@ -321,7 +321,7 @@ void ContentSettingsHandler::Observe(
switch (type) {
case chrome::NOTIFICATION_PROFILE_DESTROYED: {
if (content::Source<Profile>(source).ptr()->IsOffTheRecord()) {
- web_ui_->CallJavascriptFunction(
+ web_ui()->CallJavascriptFunction(
"ContentSettingsExceptionsArea.OTRProfileDestroyed");
}
break;
@@ -385,13 +385,13 @@ void ContentSettingsHandler::UpdateSettingDefaultFromModel(
ContentSettingsTypeToGroupName(type) + ".managedBy",
provider_id);
- web_ui_->CallJavascriptFunction(
+ web_ui()->CallJavascriptFunction(
"ContentSettings.setContentFilterSettingsValue", filter_settings);
}
std::string ContentSettingsHandler::GetSettingDefaultFromModel(
ContentSettingsType type, std::string* provider_id) {
- Profile* profile = Profile::FromWebUI(web_ui_);
+ Profile* profile = Profile::FromWebUI(web_ui());
ContentSetting default_setting;
if (type == CONTENT_SETTINGS_TYPE_NOTIFICATIONS) {
default_setting =
@@ -408,11 +408,11 @@ std::string ContentSettingsHandler::GetSettingDefaultFromModel(
void ContentSettingsHandler::UpdateHandlersEnabledRadios() {
#if defined(ENABLE_REGISTER_PROTOCOL_HANDLER)
- DCHECK(web_ui_);
base::FundamentalValue handlers_enabled(
GetProtocolHandlerRegistry()->enabled());
- web_ui_->CallJavascriptFunction("ContentSettings.updateHandlersEnabledRadios",
+ web_ui()->CallJavascriptFunction(
+ "ContentSettings.updateHandlersEnabledRadios",
handlers_enabled);
#endif // defined(ENABLE_REGISTER_PROTOCOL_HANDLER)
}
@@ -472,7 +472,7 @@ void ContentSettingsHandler::UpdateOTRExceptionsViewFromModel(
}
void ContentSettingsHandler::UpdateGeolocationExceptionsView() {
- Profile* profile = Profile::FromWebUI(web_ui_);
+ Profile* profile = Profile::FromWebUI(web_ui());
HostContentSettingsMap* map = profile->GetHostContentSettingsMap();
ContentSettingsForOneType all_settings;
@@ -529,8 +529,8 @@ void ContentSettingsHandler::UpdateGeolocationExceptionsView() {
StringValue type_string(
ContentSettingsTypeToGroupName(CONTENT_SETTINGS_TYPE_GEOLOCATION));
- web_ui_->CallJavascriptFunction("ContentSettings.setExceptions",
- type_string, exceptions);
+ web_ui()->CallJavascriptFunction("ContentSettings.setExceptions",
+ type_string, exceptions);
// This is mainly here to keep this function ideologically parallel to
// UpdateExceptionsViewFromHostContentSettingsMap().
@@ -538,7 +538,7 @@ void ContentSettingsHandler::UpdateGeolocationExceptionsView() {
}
void ContentSettingsHandler::UpdateNotificationExceptionsView() {
- Profile* profile = Profile::FromWebUI(web_ui_);
+ Profile* profile = Profile::FromWebUI(web_ui());
DesktopNotificationService* service =
DesktopNotificationServiceFactory::GetForProfile(profile);
@@ -564,8 +564,8 @@ void ContentSettingsHandler::UpdateNotificationExceptionsView() {
StringValue type_string(
ContentSettingsTypeToGroupName(CONTENT_SETTINGS_TYPE_NOTIFICATIONS));
- web_ui_->CallJavascriptFunction("ContentSettings.setExceptions",
- type_string, exceptions);
+ web_ui()->CallJavascriptFunction("ContentSettings.setExceptions",
+ type_string, exceptions);
// This is mainly here to keep this function ideologically parallel to
// UpdateExceptionsViewFromHostContentSettingsMap().
@@ -603,8 +603,8 @@ void ContentSettingsHandler::UpdateExceptionsViewFromHostContentSettingsMap(
}
StringValue type_string(ContentSettingsTypeToGroupName(type));
- web_ui_->CallJavascriptFunction("ContentSettings.setExceptions", type_string,
- exceptions);
+ web_ui()->CallJavascriptFunction("ContentSettings.setExceptions", type_string,
+ exceptions);
UpdateExceptionsViewFromOTRHostContentSettingsMap(type);
@@ -653,21 +653,21 @@ void ContentSettingsHandler::UpdateExceptionsViewFromOTRHostContentSettingsMap(
}
StringValue type_string(ContentSettingsTypeToGroupName(type));
- web_ui_->CallJavascriptFunction("ContentSettings.setOTRExceptions",
- type_string, otr_exceptions);
+ web_ui()->CallJavascriptFunction("ContentSettings.setOTRExceptions",
+ type_string, otr_exceptions);
}
void ContentSettingsHandler::RegisterMessages() {
- web_ui_->RegisterMessageCallback("setContentFilter",
+ web_ui()->RegisterMessageCallback("setContentFilter",
base::Bind(&ContentSettingsHandler::SetContentFilter,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("removeException",
+ web_ui()->RegisterMessageCallback("removeException",
base::Bind(&ContentSettingsHandler::RemoveException,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("setException",
+ web_ui()->RegisterMessageCallback("setException",
base::Bind(&ContentSettingsHandler::SetException,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("checkExceptionPatternValidity",
+ web_ui()->RegisterMessageCallback("checkExceptionPatternValidity",
base::Bind(&ContentSettingsHandler::CheckExceptionPatternValidity,
base::Unretained(this)));
}
@@ -684,7 +684,7 @@ void ContentSettingsHandler::SetContentFilter(const ListValue* args) {
ContentSetting default_setting = ContentSettingFromString(setting);
ContentSettingsType content_type = ContentSettingsTypeFromGroupName(group);
if (content_type == CONTENT_SETTINGS_TYPE_NOTIFICATIONS) {
- Profile* profile = Profile::FromWebUI(web_ui_);
+ Profile* profile = Profile::FromWebUI(web_ui());
DesktopNotificationServiceFactory::GetForProfile(profile)->
SetDefaultContentSetting(default_setting);
} else {
@@ -738,7 +738,7 @@ void ContentSettingsHandler::RemoveException(const ListValue* args) {
std::string type_string;
CHECK(args->GetString(arg_i++, &type_string));
- Profile* profile = Profile::FromWebUI(web_ui_);
+ Profile* profile = Profile::FromWebUI(web_ui());
ContentSettingsType type = ContentSettingsTypeFromGroupName(type_string);
if (type == CONTENT_SETTINGS_TYPE_GEOLOCATION) {
std::string origin;
@@ -842,7 +842,7 @@ void ContentSettingsHandler::CheckExceptionPatternValidity(
scoped_ptr<Value> pattern_value(Value::CreateStringValue(pattern_string));
scoped_ptr<Value> valid_value(Value::CreateBooleanValue(pattern.IsValid()));
- web_ui_->CallJavascriptFunction(
+ web_ui()->CallJavascriptFunction(
"ContentSettings.patternValidityCheckComplete",
*type,
*mode_value.get(),
@@ -863,16 +863,16 @@ std::string ContentSettingsHandler::ContentSettingsTypeToGroupName(
}
HostContentSettingsMap* ContentSettingsHandler::GetContentSettingsMap() {
- return Profile::FromWebUI(web_ui_)->GetHostContentSettingsMap();
+ return Profile::FromWebUI(web_ui())->GetHostContentSettingsMap();
}
ProtocolHandlerRegistry* ContentSettingsHandler::GetProtocolHandlerRegistry() {
- return Profile::FromWebUI(web_ui_)->GetProtocolHandlerRegistry();
+ return Profile::FromWebUI(web_ui())->GetProtocolHandlerRegistry();
}
HostContentSettingsMap*
ContentSettingsHandler::GetOTRContentSettingsMap() {
- Profile* profile = Profile::FromWebUI(web_ui_);
+ Profile* profile = Profile::FromWebUI(web_ui());
if (profile->HasOffTheRecordProfile())
return profile->GetOffTheRecordProfile()->GetHostContentSettingsMap();
return NULL;
diff --git a/chrome/browser/ui/webui/options/cookies_view_handler.cc b/chrome/browser/ui/webui/options/cookies_view_handler.cc
index 9050b98..748e1d7 100644
--- a/chrome/browser/ui/webui/options/cookies_view_handler.cc
+++ b/chrome/browser/ui/webui/options/cookies_view_handler.cc
@@ -78,16 +78,16 @@ void CookiesViewHandler::GetLocalizedValues(
}
void CookiesViewHandler::RegisterMessages() {
- web_ui_->RegisterMessageCallback("updateCookieSearchResults",
+ web_ui()->RegisterMessageCallback("updateCookieSearchResults",
base::Bind(&CookiesViewHandler::UpdateSearchResults,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("removeAllCookies",
+ web_ui()->RegisterMessageCallback("removeAllCookies",
base::Bind(&CookiesViewHandler::RemoveAll,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("removeCookie",
+ web_ui()->RegisterMessageCallback("removeCookie",
base::Bind(&CookiesViewHandler::Remove,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("loadCookie",
+ web_ui()->RegisterMessageCallback("loadCookie",
base::Bind(&CookiesViewHandler::LoadChildren,
base::Unretained(this)));
}
@@ -113,7 +113,7 @@ void CookiesViewHandler::TreeNodesAdded(ui::TreeModel* model,
cookies_tree_model_util::GetTreeNodeId(parent_node)));
args.Append(Value::CreateIntegerValue(start));
args.Append(children);
- web_ui_->CallJavascriptFunction("CookiesView.onTreeItemAdded", args);
+ web_ui()->CallJavascriptFunction("CookiesView.onTreeItemAdded", args);
}
void CookiesViewHandler::TreeNodesRemoved(ui::TreeModel* model,
@@ -131,7 +131,7 @@ void CookiesViewHandler::TreeNodesRemoved(ui::TreeModel* model,
cookies_tree_model_->AsNode(parent))));
args.Append(Value::CreateIntegerValue(start));
args.Append(Value::CreateIntegerValue(count));
- web_ui_->CallJavascriptFunction("CookiesView.onTreeItemRemoved", args);
+ web_ui()->CallJavascriptFunction("CookiesView.onTreeItemRemoved", args);
}
void CookiesViewHandler::TreeModelBeginBatch(CookiesTreeModel* model) {
@@ -148,7 +148,7 @@ void CookiesViewHandler::TreeModelEndBatch(CookiesTreeModel* model) {
void CookiesViewHandler::EnsureCookiesTreeModelCreated() {
if (!cookies_tree_model_.get()) {
- Profile* profile = Profile::FromWebUI(web_ui_);
+ Profile* profile = Profile::FromWebUI(web_ui());
cookies_tree_model_.reset(new CookiesTreeModel(
new BrowsingDataCookieHelper(profile),
new BrowsingDataDatabaseHelper(profile),
@@ -218,5 +218,5 @@ void CookiesViewHandler::SendChildren(CookieTreeNode* parent) {
Value::CreateStringValue(cookies_tree_model_util::GetTreeNodeId(parent)));
args.Append(children);
- web_ui_->CallJavascriptFunction("CookiesView.loadChildren", args);
+ web_ui()->CallJavascriptFunction("CookiesView.loadChildren", args);
}
diff --git a/chrome/browser/ui/webui/options/core_options_handler.cc b/chrome/browser/ui/webui/options/core_options_handler.cc
index bceaa5f..d717c6e 100644
--- a/chrome/browser/ui/webui/options/core_options_handler.cc
+++ b/chrome/browser/ui/webui/options/core_options_handler.cc
@@ -39,7 +39,7 @@ CoreOptionsHandler::~CoreOptionsHandler() {}
void CoreOptionsHandler::Initialize() {
clear_plugin_lso_data_enabled_.Init(prefs::kClearPluginLSODataEnabled,
- Profile::FromWebUI(web_ui_),
+ Profile::FromWebUI(web_ui()),
this);
UpdateClearPluginLSOData();
}
@@ -113,13 +113,6 @@ void CoreOptionsHandler::Uninitialize() {
}
}
-WebUIMessageHandler* CoreOptionsHandler::Attach(WebUI* web_ui) {
- WebUIMessageHandler* result = WebUIMessageHandler::Attach(web_ui);
- DCHECK(web_ui_);
- registrar_.Init(Profile::FromWebUI(web_ui_)->GetPrefs());
- return result;
-}
-
void CoreOptionsHandler::Observe(int type,
const content::NotificationSource& source,
const content::NotificationDetails& details) {
@@ -135,37 +128,39 @@ void CoreOptionsHandler::Observe(int type,
}
void CoreOptionsHandler::RegisterMessages() {
- web_ui_->RegisterMessageCallback("coreOptionsInitialize",
+ registrar_.Init(Profile::FromWebUI(web_ui())->GetPrefs());
+
+ web_ui()->RegisterMessageCallback("coreOptionsInitialize",
base::Bind(&CoreOptionsHandler::HandleInitialize,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("fetchPrefs",
+ web_ui()->RegisterMessageCallback("fetchPrefs",
base::Bind(&CoreOptionsHandler::HandleFetchPrefs,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("observePrefs",
+ web_ui()->RegisterMessageCallback("observePrefs",
base::Bind(&CoreOptionsHandler::HandleObservePrefs,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("setBooleanPref",
+ web_ui()->RegisterMessageCallback("setBooleanPref",
base::Bind(&CoreOptionsHandler::HandleSetBooleanPref,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("setIntegerPref",
+ web_ui()->RegisterMessageCallback("setIntegerPref",
base::Bind(&CoreOptionsHandler::HandleSetIntegerPref,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("setDoublePref",
+ web_ui()->RegisterMessageCallback("setDoublePref",
base::Bind(&CoreOptionsHandler::HandleSetDoublePref,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("setStringPref",
+ web_ui()->RegisterMessageCallback("setStringPref",
base::Bind(&CoreOptionsHandler::HandleSetStringPref,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("setURLPref",
+ web_ui()->RegisterMessageCallback("setURLPref",
base::Bind(&CoreOptionsHandler::HandleSetURLPref,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("setListPref",
+ web_ui()->RegisterMessageCallback("setListPref",
base::Bind(&CoreOptionsHandler::HandleSetListPref,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("clearPref",
+ web_ui()->RegisterMessageCallback("clearPref",
base::Bind(&CoreOptionsHandler::HandleClearPref,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("coreOptionsUserMetricsAction",
+ web_ui()->RegisterMessageCallback("coreOptionsUserMetricsAction",
base::Bind(&CoreOptionsHandler::HandleUserMetricsAction,
base::Unretained(this)));
}
@@ -176,7 +171,7 @@ void CoreOptionsHandler::HandleInitialize(const ListValue* args) {
}
base::Value* CoreOptionsHandler::FetchPref(const std::string& pref_name) {
- PrefService* pref_service = Profile::FromWebUI(web_ui_)->GetPrefs();
+ PrefService* pref_service = Profile::FromWebUI(web_ui())->GetPrefs();
const PrefService::Preference* pref =
pref_service->FindPreference(pref_name.c_str());
@@ -193,7 +188,7 @@ void CoreOptionsHandler::ObservePref(const std::string& pref_name) {
void CoreOptionsHandler::SetPref(const std::string& pref_name,
const base::Value* value,
const std::string& metric) {
- PrefService* pref_service = Profile::FromWebUI(web_ui_)->GetPrefs();
+ PrefService* pref_service = Profile::FromWebUI(web_ui())->GetPrefs();
switch (value->GetType()) {
case base::Value::TYPE_BOOLEAN:
@@ -213,7 +208,7 @@ void CoreOptionsHandler::SetPref(const std::string& pref_name,
void CoreOptionsHandler::ClearPref(const std::string& pref_name,
const std::string& metric) {
- PrefService* pref_service = Profile::FromWebUI(web_ui_)->GetPrefs();
+ PrefService* pref_service = Profile::FromWebUI(web_ui())->GetPrefs();
pref_service->ClearPref(pref_name.c_str());
if (!metric.empty())
@@ -238,7 +233,7 @@ void CoreOptionsHandler::ProcessUserMetric(const base::Value* value,
void CoreOptionsHandler::NotifyPrefChanged(
const std::string& pref_name,
const std::string& controlling_pref_name) {
- const PrefService* pref_service = Profile::FromWebUI(web_ui_)->GetPrefs();
+ const PrefService* pref_service = Profile::FromWebUI(web_ui())->GetPrefs();
const PrefService::Preference* pref =
pref_service->FindPreference(pref_name.c_str());
if (!pref)
@@ -255,8 +250,8 @@ void CoreOptionsHandler::NotifyPrefChanged(
ListValue result_value;
result_value.Append(base::Value::CreateStringValue(pref_name.c_str()));
result_value.Append(CreateValueForPref(pref, controlling_pref));
- web_ui_->CallJavascriptFunction(WideToASCII(callback_function),
- result_value);
+ web_ui()->CallJavascriptFunction(WideToASCII(callback_function),
+ result_value);
}
}
@@ -313,8 +308,8 @@ void CoreOptionsHandler::HandleFetchPrefs(const ListValue* args) {
result_value.Set(pref_name.c_str(), FetchPref(pref_name));
}
- web_ui_->CallJavascriptFunction(UTF16ToASCII(callback_function),
- result_value);
+ web_ui()->CallJavascriptFunction(UTF16ToASCII(callback_function),
+ result_value);
}
void CoreOptionsHandler::HandleObservePrefs(const ListValue* args) {
@@ -458,6 +453,6 @@ void CoreOptionsHandler::UpdateClearPluginLSOData() {
scoped_ptr<base::Value> enabled(
base::Value::CreateBooleanValue(
clear_plugin_lso_data_enabled_.GetValue()));
- web_ui_->CallJavascriptFunction(
+ web_ui()->CallJavascriptFunction(
"OptionsPage.setClearPluginLSODataEnabled", *enabled);
}
diff --git a/chrome/browser/ui/webui/options/core_options_handler.h b/chrome/browser/ui/webui/options/core_options_handler.h
index a8743ae..96308d6 100644
--- a/chrome/browser/ui/webui/options/core_options_handler.h
+++ b/chrome/browser/ui/webui/options/core_options_handler.h
@@ -34,7 +34,6 @@ class CoreOptionsHandler : public OptionsPageUIHandler {
// WebUIMessageHandler implementation.
virtual void RegisterMessages() OVERRIDE;
- virtual WebUIMessageHandler* Attach(WebUI* web_ui) OVERRIDE;
void set_handlers_host(OptionsPageUIHandlerHost* handlers_host) {
handlers_host_ = handlers_host;
diff --git a/chrome/browser/ui/webui/options/extension_settings_handler.cc b/chrome/browser/ui/webui/options/extension_settings_handler.cc
index 4288b8d..76f44ba 100644
--- a/chrome/browser/ui/webui/options/extension_settings_handler.cc
+++ b/chrome/browser/ui/webui/options/extension_settings_handler.cc
@@ -100,43 +100,46 @@ void ExtensionSettingsHandler::RegisterUserPrefs(PrefService* prefs) {
}
void ExtensionSettingsHandler::RegisterMessages() {
- web_ui_->RegisterMessageCallback("extensionSettingsRequestExtensionsData",
+ extension_service_ = Profile::FromWebUI(web_ui())->GetOriginalProfile()->
+ GetExtensionService();
+
+ web_ui()->RegisterMessageCallback("extensionSettingsRequestExtensionsData",
base::Bind(&ExtensionSettingsHandler::HandleRequestExtensionsData,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("extensionSettingsToggleDeveloperMode",
+ web_ui()->RegisterMessageCallback("extensionSettingsToggleDeveloperMode",
base::Bind(&ExtensionSettingsHandler::HandleToggleDeveloperMode,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("extensionSettingsInspect",
+ web_ui()->RegisterMessageCallback("extensionSettingsInspect",
base::Bind(&ExtensionSettingsHandler::HandleInspectMessage,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("extensionSettingsReload",
+ web_ui()->RegisterMessageCallback("extensionSettingsReload",
base::Bind(&ExtensionSettingsHandler::HandleReloadMessage,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("extensionSettingsEnable",
+ web_ui()->RegisterMessageCallback("extensionSettingsEnable",
base::Bind(&ExtensionSettingsHandler::HandleEnableMessage,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("extensionSettingsEnableIncognito",
+ web_ui()->RegisterMessageCallback("extensionSettingsEnableIncognito",
base::Bind(&ExtensionSettingsHandler::HandleEnableIncognitoMessage,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("extensionSettingsAllowFileAccess",
+ web_ui()->RegisterMessageCallback("extensionSettingsAllowFileAccess",
base::Bind(&ExtensionSettingsHandler::HandleAllowFileAccessMessage,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("extensionSettingsUninstall",
+ web_ui()->RegisterMessageCallback("extensionSettingsUninstall",
base::Bind(&ExtensionSettingsHandler::HandleUninstallMessage,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("extensionSettingsOptions",
+ web_ui()->RegisterMessageCallback("extensionSettingsOptions",
base::Bind(&ExtensionSettingsHandler::HandleOptionsMessage,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("extensionSettingsShowButton",
+ web_ui()->RegisterMessageCallback("extensionSettingsShowButton",
base::Bind(&ExtensionSettingsHandler::HandleShowButtonMessage,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("extensionSettingsLoad",
+ web_ui()->RegisterMessageCallback("extensionSettingsLoad",
base::Bind(&ExtensionSettingsHandler::HandleLoadMessage,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("extensionSettingsAutoupdate",
+ web_ui()->RegisterMessageCallback("extensionSettingsAutoupdate",
base::Bind(&ExtensionSettingsHandler::HandleAutoUpdateMessage,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("extensionSettingsSelectFilePath",
+ web_ui()->RegisterMessageCallback("extensionSettingsSelectFilePath",
base::Bind(&ExtensionSettingsHandler::HandleSelectFilePathMessage,
base::Unretained(this)));
}
@@ -189,13 +192,13 @@ void ExtensionSettingsHandler::HandleRequestExtensionsData(
}
results.Set("extensions", extensions_list);
- Profile* profile = Profile::FromWebUI(web_ui_);
+ Profile* profile = Profile::FromWebUI(web_ui());
bool developer_mode =
profile->GetPrefs()->GetBoolean(prefs::kExtensionsUIDeveloperMode);
results.SetBoolean("developerMode", developer_mode);
- web_ui_->CallJavascriptFunction("ExtensionSettings.returnExtensionsData",
- results);
+ web_ui()->CallJavascriptFunction("ExtensionSettings.returnExtensionsData",
+ results);
MaybeRegisterForNotifications();
}
@@ -205,7 +208,7 @@ void ExtensionSettingsHandler::MaybeRegisterForNotifications() {
return;
registered_for_notifications_ = true;
- Profile* profile = Profile::FromWebUI(web_ui_);
+ Profile* profile = Profile::FromWebUI(web_ui());
// Register for notifications that we need to reload the page.
registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_LOADED,
@@ -241,14 +244,14 @@ ExtensionUninstallDialog*
ExtensionSettingsHandler::GetExtensionUninstallDialog() {
if (!extension_uninstall_dialog_.get()) {
extension_uninstall_dialog_.reset(
- ExtensionUninstallDialog::Create(Profile::FromWebUI(web_ui_), this));
+ ExtensionUninstallDialog::Create(Profile::FromWebUI(web_ui()), this));
}
return extension_uninstall_dialog_.get();
}
void ExtensionSettingsHandler::HandleToggleDeveloperMode(
const ListValue* args) {
- Profile* profile = Profile::FromWebUI(web_ui_);
+ Profile* profile = Profile::FromWebUI(web_ui());
bool developer_mode =
profile->GetPrefs()->GetBoolean(prefs::kExtensionsUIDeveloperMode);
profile->GetPrefs()->SetBoolean(
@@ -300,7 +303,7 @@ void ExtensionSettingsHandler::HandleEnableMessage(const ListValue* args) {
ExtensionPrefs* prefs = extension_service_->extension_prefs();
if (prefs->DidExtensionEscalatePermissions(extension_id)) {
ShowExtensionDisabledDialog(extension_service_,
- Profile::FromWebUI(web_ui_), extension);
+ Profile::FromWebUI(web_ui()), extension);
} else {
extension_service_->EnableExtension(extension_id);
}
@@ -415,7 +418,7 @@ void ExtensionSettingsHandler::HandleOptionsMessage(const ListValue* args) {
const Extension* extension = GetExtension(args);
if (!extension || extension->options_url().is_empty())
return;
- Profile::FromWebUI(web_ui_)->GetExtensionProcessManager()->OpenOptionsPage(
+ Profile::FromWebUI(web_ui())->GetExtensionProcessManager()->OpenOptionsPage(
extension, NULL);
}
@@ -435,7 +438,7 @@ void ExtensionSettingsHandler::HandleLoadMessage(const ListValue* args) {
void ExtensionSettingsHandler::ShowAlert(const std::string& message) {
ListValue arguments;
arguments.Append(Value::CreateStringValue(message));
- web_ui_->CallJavascriptFunction("alert", arguments);
+ web_ui()->CallJavascriptFunction("alert", arguments);
}
void ExtensionSettingsHandler::HandleAutoUpdateMessage(const ListValue* args) {
@@ -481,8 +484,8 @@ void ExtensionSettingsHandler::HandleSelectFilePathMessage(
load_extension_dialog_ = SelectFileDialog::Create(this);
load_extension_dialog_->SelectFile(type, select_title, FilePath(), &info,
- file_type_index, FILE_PATH_LITERAL(""), web_ui_->tab_contents(),
- web_ui_->tab_contents()->GetView()->GetTopLevelNativeWindow(), NULL);
+ file_type_index, FILE_PATH_LITERAL(""), web_ui()->tab_contents(),
+ web_ui()->tab_contents()->GetView()->GetTopLevelNativeWindow(), NULL);
}
@@ -491,7 +494,7 @@ void ExtensionSettingsHandler::FileSelected(const FilePath& path, int index,
// Add the extensions to the results structure.
ListValue results;
results.Append(Value::CreateStringValue(path.value()));
- web_ui_->CallJavascriptFunction("window.handleFilePathSelected", results);
+ web_ui()->CallJavascriptFunction("window.handleFilePathSelected", results);
}
void ExtensionSettingsHandler::MultiFilesSelected(
@@ -501,8 +504,6 @@ void ExtensionSettingsHandler::MultiFilesSelected(
void ExtensionSettingsHandler::GetLocalizedValues(
DictionaryValue* localized_strings) {
- DCHECK(localized_strings);
-
RegisterTitle(localized_strings, "extensionSettings",
IDS_MANAGE_EXTENSIONS_SETTING_WINDOWS_TITLE);
@@ -577,22 +578,11 @@ void ExtensionSettingsHandler::GetLocalizedValues(
void ExtensionSettingsHandler::Initialize() {
}
-WebUIMessageHandler* ExtensionSettingsHandler::Attach(WebUI* web_ui) {
- // Call through to superclass.
- WebUIMessageHandler* handler = OptionsPageUIHandler::Attach(web_ui);
-
- extension_service_ = Profile::FromWebUI(web_ui_)
- ->GetOriginalProfile()->GetExtensionService();
-
- // Return result from the superclass.
- return handler;
-}
-
void ExtensionSettingsHandler::Observe(
int type,
const content::NotificationSource& source,
const content::NotificationDetails& details) {
- Profile* profile = Profile::FromWebUI(web_ui_);
+ Profile* profile = Profile::FromWebUI(web_ui());
Profile* source_profile = NULL;
switch (type) {
// We listen for notifications that will result in the page being
@@ -645,7 +635,7 @@ const Extension* ExtensionSettingsHandler::GetExtension(const ListValue* args) {
}
void ExtensionSettingsHandler::MaybeUpdateAfterNotification() {
- TabContents* contents = web_ui_->tab_contents();
+ TabContents* contents = web_ui()->tab_contents();
if (!ignore_notifications_ && contents && contents->GetRenderViewHost())
HandleRequestExtensionsData(NULL);
deleting_rvh_ = NULL;
diff --git a/chrome/browser/ui/webui/options/extension_settings_handler.h b/chrome/browser/ui/webui/options/extension_settings_handler.h
index f17cd0f..b791e10 100644
--- a/chrome/browser/ui/webui/options/extension_settings_handler.h
+++ b/chrome/browser/ui/webui/options/extension_settings_handler.h
@@ -135,7 +135,6 @@ class ExtensionSettingsHandler : public OptionsPageUIHandler,
// WebUIMessageHandler implementation.
virtual void RegisterMessages() OVERRIDE;
- virtual WebUIMessageHandler* Attach(WebUI* web_ui) OVERRIDE;
// OptionsUIHandler implementation.
virtual void GetLocalizedValues(
diff --git a/chrome/browser/ui/webui/options/font_settings_handler.cc b/chrome/browser/ui/webui/options/font_settings_handler.cc
index ef2ae12..dd27d84 100644
--- a/chrome/browser/ui/webui/options/font_settings_handler.cc
+++ b/chrome/browser/ui/webui/options/font_settings_handler.cc
@@ -65,7 +65,7 @@ void FontSettingsHandler::GetLocalizedValues(
}
void FontSettingsHandler::Initialize() {
- DCHECK(web_ui_);
+ DCHECK(web_ui());
SetUpStandardFontSample();
SetUpSerifFontSample();
SetUpSansSerifFontSample();
@@ -73,13 +73,9 @@ void FontSettingsHandler::Initialize() {
SetUpMinimumFontSample();
}
-WebUIMessageHandler* FontSettingsHandler::Attach(WebUI* web_ui) {
- // Call through to superclass.
- WebUIMessageHandler* handler = OptionsPageUIHandler::Attach(web_ui);
-
+void FontSettingsHandler::RegisterMessages() {
// Perform validation for saved fonts.
- DCHECK(web_ui_);
- PrefService* pref_service = Profile::FromWebUI(web_ui_)->GetPrefs();
+ PrefService* pref_service = Profile::FromWebUI(web_ui())->GetPrefs();
FontSettingsUtilities::ValidateSavedFonts(pref_service);
// Register for preferences that we need to observe manually.
@@ -97,12 +93,7 @@ WebUIMessageHandler* FontSettingsHandler::Attach(WebUI* web_ui) {
minimum_font_size_.Init(prefs::kWebKitGlobalMinimumFontSize,
pref_service, this);
- // Return result from the superclass.
- return handler;
-}
-
-void FontSettingsHandler::RegisterMessages() {
- web_ui_->RegisterMessageCallback("fetchFontsData",
+ web_ui()->RegisterMessageCallback("fetchFontsData",
base::Bind(&FontSettingsHandler::HandleFetchFontsData,
base::Unretained(this)));
}
@@ -117,7 +108,7 @@ void FontSettingsHandler::FontsListHasLoaded(
scoped_refptr<content::FontListResult> list) {
ListValue encoding_list;
const std::vector<CharacterEncoding::EncodingInfo>* encodings;
- PrefService* pref_service = Profile::FromWebUI(web_ui_)->GetPrefs();
+ PrefService* pref_service = Profile::FromWebUI(web_ui())->GetPrefs();
encodings = CharacterEncoding::GetCurrentDisplayEncodings(
g_browser_process->GetApplicationLocale(),
pref_service->GetString(prefs::kStaticEncodings),
@@ -151,9 +142,9 @@ void FontSettingsHandler::FontsListHasLoaded(
selected_values.Append(Value::CreateStringValue(fixed_font_.GetValue()));
selected_values.Append(Value::CreateStringValue(font_encoding_.GetValue()));
- web_ui_->CallJavascriptFunction("FontSettings.setFontsData",
- *list->list.get(), encoding_list,
- selected_values);
+ web_ui()->CallJavascriptFunction("FontSettings.setFontsData",
+ *list->list.get(), encoding_list,
+ selected_values);
}
void FontSettingsHandler::Observe(int type,
@@ -183,33 +174,33 @@ void FontSettingsHandler::Observe(int type,
void FontSettingsHandler::SetUpStandardFontSample() {
base::StringValue font_value(standard_font_.GetValue());
base::FundamentalValue size_value(default_font_size_.GetValue());
- web_ui_->CallJavascriptFunction(
+ web_ui()->CallJavascriptFunction(
"FontSettings.setUpStandardFontSample", font_value, size_value);
}
void FontSettingsHandler::SetUpSerifFontSample() {
base::StringValue font_value(serif_font_.GetValue());
base::FundamentalValue size_value(default_font_size_.GetValue());
- web_ui_->CallJavascriptFunction(
+ web_ui()->CallJavascriptFunction(
"FontSettings.setUpSerifFontSample", font_value, size_value);
}
void FontSettingsHandler::SetUpSansSerifFontSample() {
base::StringValue font_value(sans_serif_font_.GetValue());
base::FundamentalValue size_value(default_font_size_.GetValue());
- web_ui_->CallJavascriptFunction(
+ web_ui()->CallJavascriptFunction(
"FontSettings.setUpSansSerifFontSample", font_value, size_value);
}
void FontSettingsHandler::SetUpFixedFontSample() {
base::StringValue font_value(fixed_font_.GetValue());
base::FundamentalValue size_value(default_fixed_font_size_.GetValue());
- web_ui_->CallJavascriptFunction(
+ web_ui()->CallJavascriptFunction(
"FontSettings.setUpFixedFontSample", font_value, size_value);
}
void FontSettingsHandler::SetUpMinimumFontSample() {
base::FundamentalValue size_value(minimum_font_size_.GetValue());
- web_ui_->CallJavascriptFunction("FontSettings.setUpMinimumFontSample",
+ web_ui()->CallJavascriptFunction("FontSettings.setUpMinimumFontSample",
size_value);
}
diff --git a/chrome/browser/ui/webui/options/font_settings_handler.h b/chrome/browser/ui/webui/options/font_settings_handler.h
index e038939..0b56366 100644
--- a/chrome/browser/ui/webui/options/font_settings_handler.h
+++ b/chrome/browser/ui/webui/options/font_settings_handler.h
@@ -21,7 +21,6 @@ class FontSettingsHandler : public OptionsPageUIHandler {
virtual void Initialize() OVERRIDE;
// WebUIMessageHandler implementation.
- virtual WebUIMessageHandler* Attach(WebUI* web_ui) OVERRIDE;
virtual void RegisterMessages() OVERRIDE;
// content::NotificationObserver implementation.
diff --git a/chrome/browser/ui/webui/options/handler_options_handler.cc b/chrome/browser/ui/webui/options/handler_options_handler.cc
index 1cf2a96..1776723 100644
--- a/chrome/browser/ui/webui/options/handler_options_handler.cc
+++ b/chrome/browser/ui/webui/options/handler_options_handler.cc
@@ -47,31 +47,29 @@ void HandlerOptionsHandler::Initialize() {
UpdateHandlerList();
notification_registrar_.Add(
this, chrome::NOTIFICATION_PROTOCOL_HANDLER_REGISTRY_CHANGED,
- content::Source<Profile>(Profile::FromWebUI(web_ui_)));
+ content::Source<Profile>(Profile::FromWebUI(web_ui())));
}
void HandlerOptionsHandler::RegisterMessages() {
- DCHECK(web_ui_);
- web_ui_->RegisterMessageCallback("clearDefault",
+ web_ui()->RegisterMessageCallback("clearDefault",
base::Bind(&HandlerOptionsHandler::ClearDefault,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("removeHandler",
+ web_ui()->RegisterMessageCallback("removeHandler",
base::Bind(&HandlerOptionsHandler::RemoveHandler,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("setHandlersEnabled",
+ web_ui()->RegisterMessageCallback("setHandlersEnabled",
base::Bind(&HandlerOptionsHandler::SetHandlersEnabled,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("setDefault",
+ web_ui()->RegisterMessageCallback("setDefault",
base::Bind(&HandlerOptionsHandler::SetDefault,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("removeIgnoredHandler",
+ web_ui()->RegisterMessageCallback("removeIgnoredHandler",
base::Bind(&HandlerOptionsHandler::RemoveIgnoredHandler,
base::Unretained(this)));
}
ProtocolHandlerRegistry* HandlerOptionsHandler::GetProtocolHandlerRegistry() {
- DCHECK(web_ui_);
- return Profile::FromWebUI(web_ui_)->GetProtocolHandlerRegistry();
+ return Profile::FromWebUI(web_ui())->GetProtocolHandlerRegistry();
}
static void GetHandlersAsListValue(
@@ -123,9 +121,9 @@ void HandlerOptionsHandler::UpdateHandlerList() {
scoped_ptr<ListValue> ignored_handlers(new ListValue());
GetIgnoredHandlers(ignored_handlers.get());
- web_ui_->CallJavascriptFunction("HandlerOptions.setHandlers", handlers);
- web_ui_->CallJavascriptFunction("HandlerOptions.setIgnoredHandlers",
- *ignored_handlers);
+ web_ui()->CallJavascriptFunction("HandlerOptions.setHandlers", handlers);
+ web_ui()->CallJavascriptFunction("HandlerOptions.setIgnoredHandlers",
+ *ignored_handlers);
#endif // defined(ENABLE_REGISTER_PROTOCOL_HANDLER)
}
diff --git a/chrome/browser/ui/webui/options/import_data_handler.cc b/chrome/browser/ui/webui/options/import_data_handler.cc
index ad187cd..c5bf4bc 100644
--- a/chrome/browser/ui/webui/options/import_data_handler.cc
+++ b/chrome/browser/ui/webui/options/import_data_handler.cc
@@ -59,13 +59,13 @@ void ImportDataHandler::GetLocalizedValues(DictionaryValue* localized_strings) {
}
void ImportDataHandler::Initialize() {
- Profile* profile = Profile::FromWebUI(web_ui_);
+ Profile* profile = Profile::FromWebUI(web_ui());
importer_list_ = new ImporterList(profile->GetRequestContext());
importer_list_->DetectSourceProfiles(this);
}
void ImportDataHandler::RegisterMessages() {
- web_ui_->RegisterMessageCallback("importData",
+ web_ui()->RegisterMessageCallback("importData",
base::Bind(&ImportDataHandler::ImportData, base::Unretained(this)));
}
@@ -100,8 +100,8 @@ void ImportDataHandler::ImportData(const ListValue* args) {
uint16 import_services = (selected_items & supported_items);
if (import_services) {
base::FundamentalValue state(true);
- web_ui_->CallJavascriptFunction("ImportDataOverlay.setImportingState",
- state);
+ web_ui()->CallJavascriptFunction("ImportDataOverlay.setImportingState",
+ state);
import_did_succeed_ = false;
// TODO(csilv): Out-of-process import has only been qualified on MacOS X,
@@ -114,7 +114,7 @@ void ImportDataHandler::ImportData(const ListValue* args) {
importer_host_ = new ImporterHost;
#endif
importer_host_->SetObserver(this);
- Profile* profile = Profile::FromWebUI(web_ui_);
+ Profile* profile = Profile::FromWebUI(web_ui());
importer_host_->StartImportSettings(source_profile, profile,
import_services,
new ProfileWriter(profile), false);
@@ -146,8 +146,8 @@ void ImportDataHandler::OnSourceProfilesLoaded() {
browser_profiles.Append(browser_profile);
}
- web_ui_->CallJavascriptFunction("ImportDataOverlay.updateSupportedBrowsers",
- browser_profiles);
+ web_ui()->CallJavascriptFunction("ImportDataOverlay.updateSupportedBrowsers",
+ browser_profiles);
}
void ImportDataHandler::ImportStarted() {
@@ -167,11 +167,11 @@ void ImportDataHandler::ImportEnded() {
importer_host_ = NULL;
if (import_did_succeed_) {
- web_ui_->CallJavascriptFunction("ImportDataOverlay.confirmSuccess");
+ web_ui()->CallJavascriptFunction("ImportDataOverlay.confirmSuccess");
} else {
base::FundamentalValue state(false);
- web_ui_->CallJavascriptFunction("ImportDataOverlay.setImportingState",
- state);
- web_ui_->CallJavascriptFunction("ImportDataOverlay.dismiss");
+ web_ui()->CallJavascriptFunction("ImportDataOverlay.setImportingState",
+ state);
+ web_ui()->CallJavascriptFunction("ImportDataOverlay.dismiss");
}
}
diff --git a/chrome/browser/ui/webui/options/language_options_handler.cc b/chrome/browser/ui/webui/options/language_options_handler.cc
index f219f9d..6451325 100644
--- a/chrome/browser/ui/webui/options/language_options_handler.cc
+++ b/chrome/browser/ui/webui/options/language_options_handler.cc
@@ -48,7 +48,7 @@ void LanguageOptionsHandler::GetLocalizedValues(
void LanguageOptionsHandler::RegisterMessages() {
LanguageOptionsHandlerCommon::RegisterMessages();
- web_ui_->RegisterMessageCallback("uiLanguageRestart",
+ web_ui()->RegisterMessageCallback("uiLanguageRestart",
base::Bind(&LanguageOptionsHandler::RestartCallback,
base::Unretained(this)));
}
diff --git a/chrome/browser/ui/webui/options/language_options_handler_common.cc b/chrome/browser/ui/webui/options/language_options_handler_common.cc
index cc2cc14..165225a 100644
--- a/chrome/browser/ui/webui/options/language_options_handler_common.cc
+++ b/chrome/browser/ui/webui/options/language_options_handler_common.cc
@@ -107,16 +107,15 @@ void LanguageOptionsHandlerCommon::GetLocalizedValues(
}
void LanguageOptionsHandlerCommon::RegisterMessages() {
- DCHECK(web_ui_);
- web_ui_->RegisterMessageCallback("languageOptionsOpen",
+ web_ui()->RegisterMessageCallback("languageOptionsOpen",
base::Bind(
&LanguageOptionsHandlerCommon::LanguageOptionsOpenCallback,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("spellCheckLanguageChange",
+ web_ui()->RegisterMessageCallback("spellCheckLanguageChange",
base::Bind(
&LanguageOptionsHandlerCommon::SpellCheckLanguageChangeCallback,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("uiLanguageChange",
+ web_ui()->RegisterMessageCallback("uiLanguageChange",
base::Bind(
&LanguageOptionsHandlerCommon::UiLanguageChangeCallback,
base::Unretained(this)));
@@ -155,7 +154,7 @@ void LanguageOptionsHandlerCommon::UiLanguageChangeCallback(
"LanguageOptions_UiLanguageChange_%s", language_code.c_str());
content::RecordComputedAction(action);
SetApplicationLocale(language_code);
- web_ui_->CallJavascriptFunction("options.LanguageOptions.uiLanguageSaved");
+ web_ui()->CallJavascriptFunction("options.LanguageOptions.uiLanguageSaved");
}
void LanguageOptionsHandlerCommon::SpellCheckLanguageChangeCallback(
diff --git a/chrome/browser/ui/webui/options/manage_profile_handler.cc b/chrome/browser/ui/webui/options/manage_profile_handler.cc
index 2acaf8a..097cbbb 100644
--- a/chrome/browser/ui/webui/options/manage_profile_handler.cc
+++ b/chrome/browser/ui/webui/options/manage_profile_handler.cc
@@ -56,19 +56,19 @@ void ManageProfileHandler::Initialize() {
}
void ManageProfileHandler::RegisterMessages() {
- web_ui_->RegisterMessageCallback("setProfileNameAndIcon",
+ web_ui()->RegisterMessageCallback("setProfileNameAndIcon",
base::Bind(&ManageProfileHandler::SetProfileNameAndIcon,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("deleteProfile",
+ web_ui()->RegisterMessageCallback("deleteProfile",
base::Bind(&ManageProfileHandler::DeleteProfile,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("requestDefaultProfileIcons",
+ web_ui()->RegisterMessageCallback("requestDefaultProfileIcons",
base::Bind(&ManageProfileHandler::RequestDefaultProfileIcons,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("requestProfileInfo",
+ web_ui()->RegisterMessageCallback("requestProfileInfo",
base::Bind(&ManageProfileHandler::RequestProfileInfo,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("profileIconSelectionChanged",
+ web_ui()->RegisterMessageCallback("profileIconSelectionChanged",
base::Bind(&ManageProfileHandler::ProfileIconSelectionChanged,
base::Unretained(this)));
}
@@ -95,7 +95,7 @@ void ManageProfileHandler::SendProfileIcons() {
// First add the GAIA picture if it's available.
ProfileInfoCache& cache =
g_browser_process->profile_manager()->GetProfileInfoCache();
- Profile* profile = Profile::FromWebUI(web_ui_);
+ Profile* profile = Profile::FromWebUI(web_ui());
size_t profile_index = cache.GetIndexOfProfileWithPath(profile->GetPath());
if (profile_index != std::string::npos) {
const gfx::Image* icon =
@@ -113,7 +113,7 @@ void ManageProfileHandler::SendProfileIcons() {
image_url_list.Append(Value::CreateStringValue(url));
}
- web_ui_->CallJavascriptFunction(
+ web_ui()->CallJavascriptFunction(
"ManageProfileOverlay.receiveDefaultProfileIcons",
image_url_list);
}
@@ -126,8 +126,8 @@ void ManageProfileHandler::SendProfileNames() {
profile_name_dict.SetBoolean(UTF16ToUTF8(cache.GetNameOfProfileAtIndex(i)),
true);
- web_ui_->CallJavascriptFunction("ManageProfileOverlay.receiveProfileNames",
- profile_name_dict);
+ web_ui()->CallJavascriptFunction("ManageProfileOverlay.receiveProfileNames",
+ profile_name_dict);
}
void ManageProfileHandler::SetProfileNameAndIcon(const ListValue* args) {
@@ -239,9 +239,9 @@ void ManageProfileHandler::RequestProfileInfo(const ListValue* args) {
return;
FilePath profile_path = cache.GetPathOfProfileAtIndex(index);
- FilePath current_profile_path = Profile::FromWebUI(web_ui_)->GetPath();
+ FilePath current_profile_path = Profile::FromWebUI(web_ui())->GetPath();
bool is_current_profile =
- profile_path == Profile::FromWebUI(web_ui_)->GetPath();
+ profile_path == Profile::FromWebUI(web_ui())->GetPath();
DictionaryValue profile_value;
profile_value.SetString("name", cache.GetNameOfProfileAtIndex(index));
@@ -261,13 +261,13 @@ void ManageProfileHandler::RequestProfileInfo(const ListValue* args) {
cache.GetDefaultAvatarIconUrl(icon_index));
}
- web_ui_->CallJavascriptFunction("ManageProfileOverlay.setProfileInfo",
- profile_value);
+ web_ui()->CallJavascriptFunction("ManageProfileOverlay.setProfileInfo",
+ profile_value);
// Ensure that we have the most up to date GAIA picture.
if (is_current_profile) {
GAIAInfoUpdateService* service =
- Profile::FromWebUI(web_ui_)->GetGAIAInfoUpdateService();
+ Profile::FromWebUI(web_ui())->GetGAIAInfoUpdateService();
if (service)
service->Update();
}
@@ -285,7 +285,7 @@ void ManageProfileHandler::ProfileIconSelectionChanged(
}
// Currently this only supports editing the current profile's info.
- if (file_path != Profile::FromWebUI(web_ui_)->GetPath())
+ if (file_path != Profile::FromWebUI(web_ui())->GetPath())
return;
std::string icon_url;
@@ -307,6 +307,6 @@ void ManageProfileHandler::ProfileIconSelectionChanged(
return;
StringValue gaia_name_value(gaia_name);
- web_ui_->CallJavascriptFunction("ManageProfileOverlay.setProfileName",
- gaia_name_value);
+ web_ui()->CallJavascriptFunction("ManageProfileOverlay.setProfileName",
+ gaia_name_value);
}
diff --git a/chrome/browser/ui/webui/options/options_sync_setup_handler.cc b/chrome/browser/ui/webui/options/options_sync_setup_handler.cc
index b40c527..4b976c8 100644
--- a/chrome/browser/ui/webui/options/options_sync_setup_handler.cc
+++ b/chrome/browser/ui/webui/options/options_sync_setup_handler.cc
@@ -16,7 +16,7 @@ OptionsSyncSetupHandler::~OptionsSyncSetupHandler() {
void OptionsSyncSetupHandler::StepWizardForShowSetupUI() {
ProfileSyncService* service =
- Profile::FromWebUI(web_ui_)->GetProfileSyncService();
+ Profile::FromWebUI(web_ui())->GetProfileSyncService();
DCHECK(service);
// We should bring up either a login or a configure flow based on the state of
@@ -35,5 +35,5 @@ void OptionsSyncSetupHandler::StepWizardForShowSetupUI() {
void OptionsSyncSetupHandler::ShowSetupUI() {
// Show the Sync Setup page.
scoped_ptr<Value> page(Value::CreateStringValue("syncSetup"));
- web_ui_->CallJavascriptFunction("OptionsPage.navigateToPage", *page);
+ web_ui()->CallJavascriptFunction("OptionsPage.navigateToPage", *page);
}
diff --git a/chrome/browser/ui/webui/options/options_ui.cc b/chrome/browser/ui/webui/options/options_ui.cc
index cdcdde0..5b07e6c 100644
--- a/chrome/browser/ui/webui/options/options_ui.cc
+++ b/chrome/browser/ui/webui/options/options_ui.cc
@@ -352,7 +352,7 @@ void OptionsUI::AddOptionsPageUIHandler(DictionaryValue* localized_strings,
if (handler->IsEnabled()) {
handler->GetLocalizedValues(localized_strings);
// Add handler to the list and also pass the ownership.
- AddMessageHandler(handler.release()->Attach(this));
+ AddMessageHandler(handler.release());
}
}
diff --git a/chrome/browser/ui/webui/options/pack_extension_handler.cc b/chrome/browser/ui/webui/options/pack_extension_handler.cc
index 614f27a..03a2e878 100644
--- a/chrome/browser/ui/webui/options/pack_extension_handler.cc
+++ b/chrome/browser/ui/webui/options/pack_extension_handler.cc
@@ -43,7 +43,7 @@ void PackExtensionHandler::GetLocalizedValues(
void PackExtensionHandler::RegisterMessages() {
// Setup handlers specific to this panel.
- web_ui_->RegisterMessageCallback("pack",
+ web_ui()->RegisterMessageCallback("pack",
base::Bind(&PackExtensionHandler::HandlePackMessage,
base::Unretained(this)));
}
@@ -51,7 +51,7 @@ void PackExtensionHandler::RegisterMessages() {
void PackExtensionHandler::OnPackSuccess(const FilePath& crx_file,
const FilePath& pem_file) {
ListValue results;
- web_ui_->CallJavascriptFunction("OptionsPage.closeOverlay", results);
+ web_ui()->CallJavascriptFunction("OptionsPage.closeOverlay", results);
ShowAlert(UTF16ToUTF8(PackExtensionJob::StandardSuccessMessage(crx_file,
pem_file)));
@@ -97,5 +97,5 @@ void PackExtensionHandler::HandlePackMessage(const ListValue* args) {
void PackExtensionHandler::ShowAlert(const std::string& message) {
ListValue arguments;
arguments.Append(Value::CreateStringValue(message));
- web_ui_->CallJavascriptFunction("alert", arguments);
+ web_ui()->CallJavascriptFunction("alert", arguments);
}
diff --git a/chrome/browser/ui/webui/options/password_manager_handler.cc b/chrome/browser/ui/webui/options/password_manager_handler.cc
index 7333d89..026d3b8 100644
--- a/chrome/browser/ui/webui/options/password_manager_handler.cc
+++ b/chrome/browser/ui/webui/options/password_manager_handler.cc
@@ -84,29 +84,27 @@ void PasswordManagerHandler::Initialize() {
return;
show_passwords_.Init(prefs::kPasswordManagerAllowShowPasswords,
- Profile::FromWebUI(web_ui_)->GetPrefs(), this);
- // We should not cache web_ui_->GetProfile(). See crosbug.com/6304.
+ Profile::FromWebUI(web_ui())->GetPrefs(), this);
+ // We should not cache web_ui()->GetProfile(). See crosbug.com/6304.
PasswordStore* store = GetPasswordStore();
if (store)
store->AddObserver(this);
}
void PasswordManagerHandler::RegisterMessages() {
- DCHECK(web_ui_);
-
- web_ui_->RegisterMessageCallback("updatePasswordLists",
+ web_ui()->RegisterMessageCallback("updatePasswordLists",
base::Bind(&PasswordManagerHandler::UpdatePasswordLists,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("removeSavedPassword",
+ web_ui()->RegisterMessageCallback("removeSavedPassword",
base::Bind(&PasswordManagerHandler::RemoveSavedPassword,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("removePasswordException",
+ web_ui()->RegisterMessageCallback("removePasswordException",
base::Bind(&PasswordManagerHandler::RemovePasswordException,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("removeAllSavedPasswords",
+ web_ui()->RegisterMessageCallback("removeAllSavedPasswords",
base::Bind(&PasswordManagerHandler::RemoveAllSavedPasswords,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("removeAllPasswordExceptions",
+ web_ui()->RegisterMessageCallback("removeAllPasswordExceptions",
base::Bind(&PasswordManagerHandler::RemoveAllPasswordExceptions,
base::Unretained(this)));
}
@@ -116,7 +114,7 @@ void PasswordManagerHandler::OnLoginsChanged() {
}
PasswordStore* PasswordManagerHandler::GetPasswordStore() {
- return Profile::FromWebUI(web_ui_)->
+ return Profile::FromWebUI(web_ui())->
GetPasswordStore(Profile::EXPLICIT_ACCESS);
}
@@ -139,7 +137,7 @@ void PasswordManagerHandler::UpdatePasswordLists(const ListValue* args) {
password_list_.reset();
password_exception_list_.reset();
- languages_ = Profile::FromWebUI(web_ui_)->GetPrefs()->
+ languages_ = Profile::FromWebUI(web_ui())->GetPrefs()->
GetString(prefs::kAcceptLanguages);
populater_.Populate();
exception_populater_.Populate();
@@ -209,8 +207,8 @@ void PasswordManagerHandler::SetPasswordList() {
entries.Append(entry);
}
- web_ui_->CallJavascriptFunction("PasswordManager.setSavedPasswordsList",
- entries);
+ web_ui()->CallJavascriptFunction("PasswordManager.setSavedPasswordsList",
+ entries);
}
void PasswordManagerHandler::SetPasswordExceptionList() {
@@ -220,8 +218,8 @@ void PasswordManagerHandler::SetPasswordExceptionList() {
net::FormatUrl(password_exception_list_[i]->origin, languages_)));
}
- web_ui_->CallJavascriptFunction("PasswordManager.setPasswordExceptionsList",
- entries);
+ web_ui()->CallJavascriptFunction("PasswordManager.setPasswordExceptionsList",
+ entries);
}
PasswordManagerHandler::ListPopulater::ListPopulater(
diff --git a/chrome/browser/ui/webui/options/personal_options_handler.cc b/chrome/browser/ui/webui/options/personal_options_handler.cc
index e0aa630..f1389e5 100644
--- a/chrome/browser/ui/webui/options/personal_options_handler.cc
+++ b/chrome/browser/ui/webui/options/personal_options_handler.cc
@@ -66,7 +66,7 @@ PersonalOptionsHandler::PersonalOptionsHandler() {
PersonalOptionsHandler::~PersonalOptionsHandler() {
ProfileSyncService* sync_service =
- Profile::FromWebUI(web_ui_)->GetProfileSyncService();
+ Profile::FromWebUI(web_ui())->GetProfileSyncService();
if (sync_service)
sync_service->RemoveObserver(this);
}
@@ -214,18 +214,17 @@ void PersonalOptionsHandler::GetLocalizedValues(
}
void PersonalOptionsHandler::RegisterMessages() {
- DCHECK(web_ui_);
- web_ui_->RegisterMessageCallback(
+ web_ui()->RegisterMessageCallback(
"themesReset",
base::Bind(&PersonalOptionsHandler::ThemesReset,
base::Unretained(this)));
#if defined(TOOLKIT_GTK)
- web_ui_->RegisterMessageCallback(
+ web_ui()->RegisterMessageCallback(
"themesSetGTK",
base::Bind(&PersonalOptionsHandler::ThemesSetGTK,
base::Unretained(this)));
#endif
- web_ui_->RegisterMessageCallback(
+ web_ui()->RegisterMessageCallback(
"createProfile",
base::Bind(&PersonalOptionsHandler::CreateProfile,
base::Unretained(this)));
@@ -253,7 +252,7 @@ void PersonalOptionsHandler::OnStateChanged() {
string16 status_label;
string16 link_label;
ProfileSyncService* service =
- Profile::FromWebUI(web_ui_)->GetProfileSyncService();
+ Profile::FromWebUI(web_ui())->GetProfileSyncService();
DCHECK(service);
bool managed = service->IsManaged();
bool sync_setup_completed = service->HasSyncSetupCompleted();
@@ -287,66 +286,66 @@ void PersonalOptionsHandler::OnStateChanged() {
}
scoped_ptr<Value> completed(Value::CreateBooleanValue(sync_setup_completed));
- web_ui_->CallJavascriptFunction("PersonalOptions.setSyncSetupCompleted",
- *completed);
+ web_ui()->CallJavascriptFunction("PersonalOptions.setSyncSetupCompleted",
+ *completed);
scoped_ptr<Value> label(Value::CreateStringValue(status_label));
- web_ui_->CallJavascriptFunction("PersonalOptions.setSyncStatus", *label);
+ web_ui()->CallJavascriptFunction("PersonalOptions.setSyncStatus", *label);
scoped_ptr<Value> enabled(
Value::CreateBooleanValue(is_start_stop_button_enabled));
- web_ui_->CallJavascriptFunction("PersonalOptions.setStartStopButtonEnabled",
- *enabled);
+ web_ui()->CallJavascriptFunction("PersonalOptions.setStartStopButtonEnabled",
+ *enabled);
scoped_ptr<Value> visible(
Value::CreateBooleanValue(is_start_stop_button_visible));
- web_ui_->CallJavascriptFunction("PersonalOptions.setStartStopButtonVisible",
- *visible);
+ web_ui()->CallJavascriptFunction("PersonalOptions.setStartStopButtonVisible",
+ *visible);
label.reset(Value::CreateStringValue(start_stop_button_label));
- web_ui_->CallJavascriptFunction("PersonalOptions.setStartStopButtonLabel",
- *label);
+ web_ui()->CallJavascriptFunction("PersonalOptions.setStartStopButtonLabel",
+ *label);
label.reset(Value::CreateStringValue(link_label));
- web_ui_->CallJavascriptFunction("PersonalOptions.setSyncActionLinkLabel",
- *label);
+ web_ui()->CallJavascriptFunction("PersonalOptions.setSyncActionLinkLabel",
+ *label);
enabled.reset(Value::CreateBooleanValue(!managed));
- web_ui_->CallJavascriptFunction("PersonalOptions.setSyncActionLinkEnabled",
- *enabled);
+ web_ui()->CallJavascriptFunction("PersonalOptions.setSyncActionLinkEnabled",
+ *enabled);
visible.reset(Value::CreateBooleanValue(status_has_error));
- web_ui_->CallJavascriptFunction("PersonalOptions.setSyncStatusErrorVisible",
- *visible);
+ web_ui()->CallJavascriptFunction("PersonalOptions.setSyncStatusErrorVisible",
+ *visible);
enabled.reset(Value::CreateBooleanValue(
!service->unrecoverable_error_detected()));
- web_ui_->CallJavascriptFunction(
+ web_ui()->CallJavascriptFunction(
"PersonalOptions.setCustomizeSyncButtonEnabled",
*enabled);
if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnableAutologin)) {
visible.reset(Value::CreateBooleanValue(
service->AreCredentialsAvailable()));
- web_ui_->CallJavascriptFunction("PersonalOptions.setAutoLoginVisible",
- *visible);
+ web_ui()->CallJavascriptFunction("PersonalOptions.setAutoLoginVisible",
+ *visible);
}
// Set profile creation text and button if multi-profiles switch is on.
visible.reset(Value::CreateBooleanValue(multiprofile_));
- web_ui_->CallJavascriptFunction("PersonalOptions.setProfilesSectionVisible",
- *visible);
+ web_ui()->CallJavascriptFunction("PersonalOptions.setProfilesSectionVisible",
+ *visible);
if (multiprofile_)
SendProfilesInfo();
}
void PersonalOptionsHandler::ObserveThemeChanged() {
- Profile* profile = Profile::FromWebUI(web_ui_);
+ Profile* profile = Profile::FromWebUI(web_ui());
#if defined(TOOLKIT_GTK)
GtkThemeService* theme_service = GtkThemeService::GetFrom(profile);
bool is_gtk_theme = theme_service->UsingNativeTheme();
base::FundamentalValue gtk_enabled(!is_gtk_theme);
- web_ui_->CallJavascriptFunction(
+ web_ui()->CallJavascriptFunction(
"options.PersonalOptions.setGtkThemeButtonEnabled", gtk_enabled);
#else
ThemeService* theme_service = ThemeServiceFactory::GetForProfile(profile);
@@ -355,12 +354,12 @@ void PersonalOptionsHandler::ObserveThemeChanged() {
bool is_classic_theme = !is_gtk_theme && theme_service->UsingDefaultTheme();
base::FundamentalValue enabled(!is_classic_theme);
- web_ui_->CallJavascriptFunction(
+ web_ui()->CallJavascriptFunction(
"options.PersonalOptions.setThemesResetButtonEnabled", enabled);
}
void PersonalOptionsHandler::Initialize() {
- Profile* profile = Profile::FromWebUI(web_ui_);
+ Profile* profile = Profile::FromWebUI(web_ui());
// Listen for theme installation.
registrar_.Add(this, chrome::NOTIFICATION_BROWSER_THEME_CHANGED,
@@ -375,20 +374,20 @@ void PersonalOptionsHandler::Initialize() {
sync_service->AddObserver(this);
OnStateChanged();
} else {
- web_ui_->CallJavascriptFunction("options.PersonalOptions.hideSyncSection");
+ web_ui()->CallJavascriptFunction("options.PersonalOptions.hideSyncSection");
}
}
void PersonalOptionsHandler::ThemesReset(const ListValue* args) {
content::RecordAction(UserMetricsAction("Options_ThemesReset"));
- Profile* profile = Profile::FromWebUI(web_ui_);
+ Profile* profile = Profile::FromWebUI(web_ui());
ThemeServiceFactory::GetForProfile(profile)->UseDefaultTheme();
}
#if defined(TOOLKIT_GTK)
void PersonalOptionsHandler::ThemesSetGTK(const ListValue* args) {
content::RecordAction(UserMetricsAction("Options_GtkThemeSet"));
- Profile* profile = Profile::FromWebUI(web_ui_);
+ Profile* profile = Profile::FromWebUI(web_ui());
ThemeServiceFactory::GetForProfile(profile)->SetNativeTheme();
}
#endif
@@ -397,10 +396,10 @@ void PersonalOptionsHandler::ThemesSetGTK(const ListValue* args) {
void PersonalOptionsHandler::UpdateAccountPicture() {
std::string email = chromeos::UserManager::Get()->logged_in_user().email();
if (!email.empty()) {
- web_ui_->CallJavascriptFunction("PersonalOptions.updateAccountPicture");
+ web_ui()->CallJavascriptFunction("PersonalOptions.updateAccountPicture");
base::StringValue email_value(email);
- web_ui_->CallJavascriptFunction("AccountsOptions.updateAccountPicture",
- email_value);
+ web_ui()->CallJavascriptFunction("AccountsOptions.updateAccountPicture",
+ email_value);
}
}
#endif
@@ -410,7 +409,7 @@ void PersonalOptionsHandler::SendProfilesInfo() {
g_browser_process->profile_manager()->GetProfileInfoCache();
ListValue profile_info_list;
FilePath current_profile_path =
- web_ui_->tab_contents()->GetBrowserContext()->GetPath();
+ web_ui()->tab_contents()->GetBrowserContext()->GetPath();
for (size_t i = 0, e = cache.GetNumberOfProfiles(); i < e; ++i) {
DictionaryValue* profile_value = new DictionaryValue();
FilePath profile_path = cache.GetPathOfProfileAtIndex(i);
@@ -435,8 +434,8 @@ void PersonalOptionsHandler::SendProfilesInfo() {
profile_info_list.Append(profile_value);
}
- web_ui_->CallJavascriptFunction("PersonalOptions.setProfilesInfo",
- profile_info_list);
+ web_ui()->CallJavascriptFunction("PersonalOptions.setProfilesInfo",
+ profile_info_list);
}
void PersonalOptionsHandler::CreateProfile(const ListValue* args) {
diff --git a/chrome/browser/ui/webui/options/search_engine_manager_handler.cc b/chrome/browser/ui/webui/options/search_engine_manager_handler.cc
index 1748e3a..3a3d721 100644
--- a/chrome/browser/ui/webui/options/search_engine_manager_handler.cc
+++ b/chrome/browser/ui/webui/options/search_engine_manager_handler.cc
@@ -40,7 +40,7 @@ SearchEngineManagerHandler::~SearchEngineManagerHandler() {
void SearchEngineManagerHandler::Initialize() {
list_controller_.reset(
- new KeywordEditorController(Profile::FromWebUI(web_ui_)));
+ new KeywordEditorController(Profile::FromWebUI(web_ui())));
if (list_controller_.get()) {
list_controller_->table_model()->SetObserver(this);
OnModelChanged();
@@ -85,27 +85,27 @@ void SearchEngineManagerHandler::GetLocalizedValues(
}
void SearchEngineManagerHandler::RegisterMessages() {
- web_ui_->RegisterMessageCallback(
+ web_ui()->RegisterMessageCallback(
"managerSetDefaultSearchEngine",
base::Bind(&SearchEngineManagerHandler::SetDefaultSearchEngine,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback(
+ web_ui()->RegisterMessageCallback(
"removeSearchEngine",
base::Bind(&SearchEngineManagerHandler::RemoveSearchEngine,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback(
+ web_ui()->RegisterMessageCallback(
"editSearchEngine",
base::Bind(&SearchEngineManagerHandler::EditSearchEngine,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback(
+ web_ui()->RegisterMessageCallback(
"checkSearchEngineInfoValidity",
base::Bind(&SearchEngineManagerHandler::CheckSearchEngineInfoValidity,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback(
+ web_ui()->RegisterMessageCallback(
"searchEngineEditCancelled",
base::Bind(&SearchEngineManagerHandler::EditCancelled,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback(
+ web_ui()->RegisterMessageCallback(
"searchEngineEditCompleted",
base::Bind(&SearchEngineManagerHandler::EditCompleted,
base::Unretained(this)));
@@ -141,7 +141,7 @@ void SearchEngineManagerHandler::OnModelChanged() {
// Build the extension keywords list.
ListValue keyword_list;
ExtensionService* extension_service =
- Profile::FromWebUI(web_ui_)->GetExtensionService();
+ Profile::FromWebUI(web_ui())->GetExtensionService();
if (extension_service) {
const ExtensionSet* extensions = extension_service->extensions();
for (ExtensionSet::const_iterator it = extensions->begin();
@@ -151,8 +151,8 @@ void SearchEngineManagerHandler::OnModelChanged() {
}
}
- web_ui_->CallJavascriptFunction("SearchEngineManager.updateSearchEngineList",
- defaults_list, others_list, keyword_list);
+ web_ui()->CallJavascriptFunction("SearchEngineManager.updateSearchEngineList",
+ defaults_list, others_list, keyword_list);
}
void SearchEngineManagerHandler::OnItemsChanged(int start, int length) {
@@ -248,7 +248,7 @@ void SearchEngineManagerHandler::EditSearchEngine(const ListValue* args) {
if (index != -1)
edit_url = list_controller_->GetTemplateURL(index);
edit_controller_.reset(new EditSearchEngineController(
- edit_url, this, Profile::FromWebUI(web_ui_)));
+ edit_url, this, Profile::FromWebUI(web_ui())));
}
void SearchEngineManagerHandler::OnEditedKeyword(
@@ -286,8 +286,8 @@ void SearchEngineManagerHandler::CheckSearchEngineInfoValidity(
validity.SetBoolean("keyword", edit_controller_->IsKeywordValid(keyword));
validity.SetBoolean("url", edit_controller_->IsURLValid(url));
StringValue indexValue(modelIndex);
- web_ui_->CallJavascriptFunction("SearchEngineManager.validityCheckCallback",
- validity, indexValue);
+ web_ui()->CallJavascriptFunction("SearchEngineManager.validityCheckCallback",
+ validity, indexValue);
}
void SearchEngineManagerHandler::EditCancelled(const ListValue* args) {
diff --git a/chrome/browser/ui/webui/options/stop_syncing_handler.cc b/chrome/browser/ui/webui/options/stop_syncing_handler.cc
index 1d5a91e..b3a15db 100644
--- a/chrome/browser/ui/webui/options/stop_syncing_handler.cc
+++ b/chrome/browser/ui/webui/options/stop_syncing_handler.cc
@@ -39,14 +39,13 @@ void StopSyncingHandler::GetLocalizedValues(
}
void StopSyncingHandler::RegisterMessages() {
- DCHECK(web_ui_);
- web_ui_->RegisterMessageCallback("stopSyncing",
+ web_ui()->RegisterMessageCallback("stopSyncing",
base::Bind(&StopSyncingHandler::StopSyncing, base::Unretained(this)));
}
void StopSyncingHandler::StopSyncing(const ListValue* args){
ProfileSyncService* service =
- Profile::FromWebUI(web_ui_)->GetProfileSyncService();
+ Profile::FromWebUI(web_ui())->GetProfileSyncService();
if (service != NULL && ProfileSyncService::IsSyncEnabled()) {
service->DisableForUser();
ProfileSyncService::SyncEvent(ProfileSyncService::STOP_FROM_OPTIONS);
diff --git a/chrome/browser/ui/webui/options/web_intents_settings_handler.cc b/chrome/browser/ui/webui/options/web_intents_settings_handler.cc
index 544e6f56..7b6683f 100644
--- a/chrome/browser/ui/webui/options/web_intents_settings_handler.cc
+++ b/chrome/browser/ui/webui/options/web_intents_settings_handler.cc
@@ -46,10 +46,10 @@ void WebIntentsSettingsHandler::GetLocalizedValues(
}
void WebIntentsSettingsHandler::RegisterMessages() {
- web_ui_->RegisterMessageCallback("removeIntent",
+ web_ui()->RegisterMessageCallback("removeIntent",
base::Bind(&WebIntentsSettingsHandler::RemoveIntent,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("loadIntents",
+ web_ui()->RegisterMessageCallback("loadIntents",
base::Bind(&WebIntentsSettingsHandler::LoadChildren,
base::Unretained(this)));
}
@@ -81,7 +81,7 @@ void WebIntentsSettingsHandler::TreeModelEndBatch(WebIntentsModel* model) {
void WebIntentsSettingsHandler::EnsureWebIntentsModelCreated() {
if (intents_tree_model_.get()) return;
- Profile* profile = Profile::FromWebUI(web_ui_);
+ Profile* profile = Profile::FromWebUI(web_ui());
web_intents_registry_ = WebIntentsRegistryFactory::GetForProfile(profile);
intents_tree_model_.reset(new WebIntentsModel(web_intents_registry_));
intents_tree_model_->AddWebIntentsTreeObserver(this);
@@ -156,5 +156,5 @@ void WebIntentsSettingsHandler::SendChildren(WebIntentsTreeNode* parent) {
Value::CreateStringValue(intents_tree_model_->GetTreeNodeId(parent)));
args.Append(children);
- web_ui_->CallJavascriptFunction("IntentsView.loadChildren", args);
+ web_ui()->CallJavascriptFunction("IntentsView.loadChildren", args);
}
diff --git a/chrome/browser/ui/webui/options2/advanced_options_handler2.cc b/chrome/browser/ui/webui/options2/advanced_options_handler2.cc
index 05d5343..d334368 100644
--- a/chrome/browser/ui/webui/options2/advanced_options_handler2.cc
+++ b/chrome/browser/ui/webui/options2/advanced_options_handler2.cc
@@ -223,7 +223,7 @@ void AdvancedOptionsHandler::RegisterCloudPrintStrings(
}
void AdvancedOptionsHandler::Initialize() {
- DCHECK(web_ui_);
+ DCHECK(web_ui());
SetupMetricsReportingCheckbox();
SetupMetricsReportingSettingVisibility();
SetupFontSizeSelector();
@@ -245,14 +245,10 @@ void AdvancedOptionsHandler::Initialize() {
}
-WebUIMessageHandler* AdvancedOptionsHandler::Attach(WebUI* web_ui) {
- // Call through to superclass.
- WebUIMessageHandler* handler = OptionsPageUIHandler::Attach(web_ui);
-
+void AdvancedOptionsHandler::RegisterMessages() {
// Register for preferences that we need to observe manually. These have
// special behaviors that aren't handled by the standard prefs UI.
- DCHECK(web_ui_);
- PrefService* prefs = Profile::FromWebUI(web_ui_)->GetPrefs();
+ PrefService* prefs = Profile::FromWebUI(web_ui())->GetPrefs();
#if !defined(OS_CHROMEOS)
enable_metrics_recording_.Init(prefs::kMetricsReportingEnabled,
g_browser_process->local_state(), this);
@@ -279,56 +275,50 @@ WebUIMessageHandler* AdvancedOptionsHandler::Attach(WebUI* web_ui) {
PrefSetObserver::CreateProxyPrefSetObserver(prefs, this));
#endif // !defined(OS_CHROMEOS)
- // Return result from the superclass.
- return handler;
-}
-
-void AdvancedOptionsHandler::RegisterMessages() {
// Setup handlers specific to this panel.
- DCHECK(web_ui_);
- web_ui_->RegisterMessageCallback("selectDownloadLocation",
+ web_ui()->RegisterMessageCallback("selectDownloadLocation",
base::Bind(&AdvancedOptionsHandler::HandleSelectDownloadLocation,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("autoOpenFileTypesAction",
+ web_ui()->RegisterMessageCallback("autoOpenFileTypesAction",
base::Bind(&AdvancedOptionsHandler::HandleAutoOpenButton,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("defaultFontSizeAction",
+ web_ui()->RegisterMessageCallback("defaultFontSizeAction",
base::Bind(&AdvancedOptionsHandler::HandleDefaultFontSize,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("defaultZoomFactorAction",
+ web_ui()->RegisterMessageCallback("defaultZoomFactorAction",
base::Bind(&AdvancedOptionsHandler::HandleDefaultZoomFactor,
base::Unretained(this)));
#if !defined(OS_CHROMEOS)
- web_ui_->RegisterMessageCallback("metricsReportingCheckboxAction",
+ web_ui()->RegisterMessageCallback("metricsReportingCheckboxAction",
base::Bind(&AdvancedOptionsHandler::HandleMetricsReportingCheckbox,
base::Unretained(this)));
#endif
#if !defined(USE_NSS) && !defined(USE_OPENSSL)
- web_ui_->RegisterMessageCallback("showManageSSLCertificates",
+ web_ui()->RegisterMessageCallback("showManageSSLCertificates",
base::Bind(&AdvancedOptionsHandler::ShowManageSSLCertificates,
base::Unretained(this)));
#endif
- web_ui_->RegisterMessageCallback("showCloudPrintManagePage",
+ web_ui()->RegisterMessageCallback("showCloudPrintManagePage",
base::Bind(&AdvancedOptionsHandler::ShowCloudPrintManagePage,
base::Unretained(this)));
#if !defined(OS_CHROMEOS)
if (cloud_print_connector_ui_enabled_) {
- web_ui_->RegisterMessageCallback("showCloudPrintSetupDialog",
+ web_ui()->RegisterMessageCallback("showCloudPrintSetupDialog",
base::Bind(&AdvancedOptionsHandler::ShowCloudPrintSetupDialog,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("disableCloudPrintConnector",
+ web_ui()->RegisterMessageCallback("disableCloudPrintConnector",
base::Bind(&AdvancedOptionsHandler::HandleDisableCloudPrintConnector,
base::Unretained(this)));
}
- web_ui_->RegisterMessageCallback("showNetworkProxySettings",
+ web_ui()->RegisterMessageCallback("showNetworkProxySettings",
base::Bind(&AdvancedOptionsHandler::ShowNetworkProxySettings,
base::Unretained(this)));
#endif
- web_ui_->RegisterMessageCallback("checkRevocationCheckboxAction",
+ web_ui()->RegisterMessageCallback("checkRevocationCheckboxAction",
base::Bind(&AdvancedOptionsHandler::HandleCheckRevocationCheckbox,
base::Unretained(this)));
#if !defined(OS_MACOSX) && !defined(OS_CHROMEOS)
- web_ui_->RegisterMessageCallback("backgroundModeAction",
+ web_ui()->RegisterMessageCallback("backgroundModeAction",
base::Bind(&AdvancedOptionsHandler::HandleBackgroundModeCheckbox,
base::Unretained(this)));
#endif
@@ -366,20 +356,20 @@ void AdvancedOptionsHandler::Observe(
void AdvancedOptionsHandler::HandleSelectDownloadLocation(
const ListValue* args) {
- PrefService* pref_service = Profile::FromWebUI(web_ui_)->GetPrefs();
+ PrefService* pref_service = Profile::FromWebUI(web_ui())->GetPrefs();
select_folder_dialog_ = SelectFileDialog::Create(this);
select_folder_dialog_->SelectFile(
SelectFileDialog::SELECT_FOLDER,
l10n_util::GetStringUTF16(IDS_OPTIONS_DOWNLOADLOCATION_BROWSE_TITLE),
pref_service->GetFilePath(prefs::kDownloadDefaultDirectory),
- NULL, 0, FILE_PATH_LITERAL(""), web_ui_->tab_contents(),
- web_ui_->tab_contents()->GetView()->GetTopLevelNativeWindow(), NULL);
+ NULL, 0, FILE_PATH_LITERAL(""), web_ui()->tab_contents(),
+ web_ui()->tab_contents()->GetView()->GetTopLevelNativeWindow(), NULL);
}
void AdvancedOptionsHandler::FileSelected(const FilePath& path, int index,
void* params) {
content::RecordAction(UserMetricsAction("Options_SetDownloadDirectory"));
- PrefService* pref_service = Profile::FromWebUI(web_ui_)->GetPrefs();
+ PrefService* pref_service = Profile::FromWebUI(web_ui())->GetPrefs();
pref_service->SetFilePath(prefs::kDownloadDefaultDirectory, path);
}
@@ -393,7 +383,7 @@ void AdvancedOptionsHandler::OnCloudPrintSetupClosed() {
void AdvancedOptionsHandler::HandleAutoOpenButton(const ListValue* args) {
content::RecordAction(UserMetricsAction("Options_ResetAutoOpenFiles"));
DownloadManager* manager =
- web_ui_->tab_contents()->GetBrowserContext()->GetDownloadManager();
+ web_ui()->tab_contents()->GetBrowserContext()->GetDownloadManager();
if (manager)
DownloadPrefs::FromDownloadManager(manager)->ResetAutoOpen();
}
@@ -455,7 +445,7 @@ void AdvancedOptionsHandler::HandleBackgroundModeCheckbox(
void AdvancedOptionsHandler::SetupBackgroundModeSettings() {
base::FundamentalValue checked(background_mode_enabled_.GetValue());
- web_ui_->CallJavascriptFunction(
+ web_ui()->CallJavascriptFunction(
"options.AdvancedOptions.SetBackgroundModeCheckboxState", checked);
}
#endif
@@ -463,55 +453,55 @@ void AdvancedOptionsHandler::SetupBackgroundModeSettings() {
#if !defined(OS_CHROMEOS)
void AdvancedOptionsHandler::ShowNetworkProxySettings(const ListValue* args) {
content::RecordAction(UserMetricsAction("Options_ShowProxySettings"));
- AdvancedOptionsUtilities::ShowNetworkProxySettings(web_ui_->tab_contents());
+ AdvancedOptionsUtilities::ShowNetworkProxySettings(web_ui()->tab_contents());
}
#endif
#if !defined(USE_NSS) && !defined(USE_OPENSSL)
void AdvancedOptionsHandler::ShowManageSSLCertificates(const ListValue* args) {
content::RecordAction(UserMetricsAction("Options_ManageSSLCertificates"));
- AdvancedOptionsUtilities::ShowManageSSLCertificates(web_ui_->tab_contents());
+ AdvancedOptionsUtilities::ShowManageSSLCertificates(web_ui()->tab_contents());
}
#endif
void AdvancedOptionsHandler::ShowCloudPrintManagePage(const ListValue* args) {
content::RecordAction(UserMetricsAction("Options_ManageCloudPrinters"));
// Open a new tab in the current window for the management page.
- Profile* profile = Profile::FromWebUI(web_ui_);
+ Profile* profile = Profile::FromWebUI(web_ui());
OpenURLParams params(
CloudPrintURL(profile).GetCloudPrintServiceManageURL(), Referrer(),
NEW_FOREGROUND_TAB, content::PAGE_TRANSITION_LINK, false);
- web_ui_->tab_contents()->OpenURL(params);
+ web_ui()->tab_contents()->OpenURL(params);
}
#if !defined(OS_CHROMEOS)
void AdvancedOptionsHandler::ShowCloudPrintSetupDialog(const ListValue* args) {
content::RecordAction(UserMetricsAction("Options_EnableCloudPrintProxy"));
// Open the connector enable page in the current tab.
- Profile* profile = Profile::FromWebUI(web_ui_);
+ Profile* profile = Profile::FromWebUI(web_ui());
OpenURLParams params(
CloudPrintURL(profile).GetCloudPrintServiceEnableURL(
CloudPrintProxyServiceFactory::GetForProfile(profile)->proxy_id()),
Referrer(), CURRENT_TAB, content::PAGE_TRANSITION_LINK, false);
- web_ui_->tab_contents()->OpenURL(params);
+ web_ui()->tab_contents()->OpenURL(params);
}
void AdvancedOptionsHandler::HandleDisableCloudPrintConnector(
const ListValue* args) {
content::RecordAction(
UserMetricsAction("Options_DisableCloudPrintProxy"));
- CloudPrintProxyServiceFactory::GetForProfile(Profile::FromWebUI(web_ui_))->
+ CloudPrintProxyServiceFactory::GetForProfile(Profile::FromWebUI(web_ui()))->
DisableForUser();
}
void AdvancedOptionsHandler::RefreshCloudPrintStatusFromService() {
if (cloud_print_connector_ui_enabled_)
- CloudPrintProxyServiceFactory::GetForProfile(Profile::FromWebUI(web_ui_))->
+ CloudPrintProxyServiceFactory::GetForProfile(Profile::FromWebUI(web_ui()))->
RefreshStatusFromService();
}
void AdvancedOptionsHandler::SetupCloudPrintConnectorSection() {
- Profile* profile = Profile::FromWebUI(web_ui_);
+ Profile* profile = Profile::FromWebUI(web_ui());
if (!CloudPrintProxyServiceFactory::GetForProfile(profile)) {
cloud_print_connector_ui_enabled_ = false;
RemoveCloudPrintConnectorSection();
@@ -543,13 +533,13 @@ void AdvancedOptionsHandler::SetupCloudPrintConnectorSection() {
}
StringValue label(label_str);
- web_ui_->CallJavascriptFunction(
+ web_ui()->CallJavascriptFunction(
"options.AdvancedOptions.SetupCloudPrintConnectorSection",
disabled, label, allowed);
}
void AdvancedOptionsHandler::RemoveCloudPrintConnectorSection() {
- web_ui_->CallJavascriptFunction(
+ web_ui()->CallJavascriptFunction(
"options.AdvancedOptions.RemoveCloudPrintConnectorSection");
}
@@ -559,7 +549,7 @@ void AdvancedOptionsHandler::SetupMetricsReportingCheckbox() {
#if defined(GOOGLE_CHROME_BUILD) && !defined(OS_CHROMEOS)
base::FundamentalValue checked(enable_metrics_recording_.GetValue());
base::FundamentalValue disabled(enable_metrics_recording_.IsManaged());
- web_ui_->CallJavascriptFunction(
+ web_ui()->CallJavascriptFunction(
"options.AdvancedOptions.SetMetricsReportingCheckboxState", checked,
disabled);
#endif
@@ -570,7 +560,7 @@ void AdvancedOptionsHandler::SetupMetricsReportingSettingVisibility() {
// Don't show the reporting setting if we are in the guest mode.
if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kGuestSession)) {
base::FundamentalValue visible(false);
- web_ui_->CallJavascriptFunction(
+ web_ui()->CallJavascriptFunction(
"options.AdvancedOptions.SetMetricsReportingSettingVisibility",
visible);
}
@@ -580,12 +570,12 @@ void AdvancedOptionsHandler::SetupMetricsReportingSettingVisibility() {
void AdvancedOptionsHandler::SetupFontSizeSelector() {
// We're only interested in integer values, so convert to int.
base::FundamentalValue font_size(default_font_size_.GetValue());
- web_ui_->CallJavascriptFunction(
+ web_ui()->CallJavascriptFunction(
"options.AdvancedOptions.SetFontSize", font_size);
}
void AdvancedOptionsHandler::SetupPageZoomSelector() {
- PrefService* pref_service = Profile::FromWebUI(web_ui_)->GetPrefs();
+ PrefService* pref_service = Profile::FromWebUI(web_ui())->GetPrefs();
double default_zoom_level = pref_service->GetDouble(prefs::kDefaultZoomLevel);
double default_zoom_factor =
WebKit::WebView::zoomLevelToZoomFactor(default_zoom_level);
@@ -615,7 +605,7 @@ void AdvancedOptionsHandler::SetupPageZoomSelector() {
zoom_factors_value.Append(option);
}
- web_ui_->CallJavascriptFunction(
+ web_ui()->CallJavascriptFunction(
"options.AdvancedOptions.SetupPageZoomSelector", zoom_factors_value);
}
@@ -623,11 +613,11 @@ void AdvancedOptionsHandler::SetupAutoOpenFileTypesDisabledAttribute() {
// Set the enabled state for the AutoOpenFileTypesResetToDefault button.
// We enable the button if the user has any auto-open file types registered.
DownloadManager* manager =
- web_ui_->tab_contents()->GetBrowserContext()->GetDownloadManager();
+ web_ui()->tab_contents()->GetBrowserContext()->GetDownloadManager();
bool disabled = !(manager &&
DownloadPrefs::FromDownloadManager(manager)->IsAutoOpenUsed());
base::FundamentalValue value(disabled);
- web_ui_->CallJavascriptFunction(
+ web_ui()->CallJavascriptFunction(
"options.AdvancedOptions.SetAutoOpenFileTypesDisabledAttribute", value);
}
@@ -635,7 +625,7 @@ void AdvancedOptionsHandler::SetupProxySettingsSection() {
#if !defined(OS_CHROMEOS)
// Disable the button if proxy settings are managed by a sysadmin or
// overridden by an extension.
- PrefService* pref_service = Profile::FromWebUI(web_ui_)->GetPrefs();
+ PrefService* pref_service = Profile::FromWebUI(web_ui())->GetPrefs();
const PrefService::Preference* proxy_config =
pref_service->FindPreference(prefs::kProxy);
bool is_extension_controlled = (proxy_config &&
@@ -654,7 +644,7 @@ void AdvancedOptionsHandler::SetupProxySettingsSection() {
}
StringValue label(label_str);
- web_ui_->CallJavascriptFunction(
+ web_ui()->CallJavascriptFunction(
"options.AdvancedOptions.SetupProxySettingsSection", disabled, label);
#endif // !defined(OS_CHROMEOS)
}
@@ -663,7 +653,7 @@ void AdvancedOptionsHandler::SetupSSLConfigSettings() {
{
base::FundamentalValue checked(rev_checking_enabled_.GetValue());
base::FundamentalValue disabled(rev_checking_enabled_.IsManaged());
- web_ui_->CallJavascriptFunction(
+ web_ui()->CallJavascriptFunction(
"options.AdvancedOptions.SetCheckRevocationCheckboxState", checked,
disabled);
}
diff --git a/chrome/browser/ui/webui/options2/advanced_options_handler2.h b/chrome/browser/ui/webui/options2/advanced_options_handler2.h
index 3de0c53..0e1f88e4 100644
--- a/chrome/browser/ui/webui/options2/advanced_options_handler2.h
+++ b/chrome/browser/ui/webui/options2/advanced_options_handler2.h
@@ -33,7 +33,6 @@ class AdvancedOptionsHandler
virtual void Initialize() OVERRIDE;
// WebUIMessageHandler implementation.
- virtual WebUIMessageHandler* Attach(WebUI* web_ui) OVERRIDE;
virtual void RegisterMessages() OVERRIDE;
// content::NotificationObserver implementation.
diff --git a/chrome/browser/ui/webui/options2/autofill_options_handler2.cc b/chrome/browser/ui/webui/options2/autofill_options_handler2.cc
index ab8b01f..7482ae4 100644
--- a/chrome/browser/ui/webui/options2/autofill_options_handler2.cc
+++ b/chrome/browser/ui/webui/options2/autofill_options_handler2.cc
@@ -300,7 +300,7 @@ void AutofillOptionsHandler::GetLocalizedValues(
void AutofillOptionsHandler::Initialize() {
personal_data_ = PersonalDataManagerFactory::GetForProfile(
- Profile::FromWebUI(web_ui_));
+ Profile::FromWebUI(web_ui()));
// personal_data_ is NULL in guest mode on Chrome OS.
if (personal_data_) {
personal_data_->SetObserver(this);
@@ -309,30 +309,30 @@ void AutofillOptionsHandler::Initialize() {
}
void AutofillOptionsHandler::RegisterMessages() {
- web_ui_->RegisterMessageCallback(
+ web_ui()->RegisterMessageCallback(
"removeAddress",
base::Bind(&AutofillOptionsHandler::RemoveAddress,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback(
+ web_ui()->RegisterMessageCallback(
"removeCreditCard",
base::Bind(&AutofillOptionsHandler::RemoveCreditCard,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback(
+ web_ui()->RegisterMessageCallback(
"loadAddressEditor",
base::Bind(&AutofillOptionsHandler::LoadAddressEditor,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback(
+ web_ui()->RegisterMessageCallback(
"loadCreditCardEditor",
base::Bind(&AutofillOptionsHandler::LoadCreditCardEditor,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback(
+ web_ui()->RegisterMessageCallback(
"setAddress",
base::Bind(&AutofillOptionsHandler::SetAddress, base::Unretained(this)));
- web_ui_->RegisterMessageCallback(
+ web_ui()->RegisterMessageCallback(
"setCreditCard",
base::Bind(&AutofillOptionsHandler::SetCreditCard,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback(
+ web_ui()->RegisterMessageCallback(
"validatePhoneNumbers",
base::Bind(&AutofillOptionsHandler::ValidatePhoneNumbers,
base::Unretained(this)));
@@ -412,7 +412,7 @@ void AutofillOptionsHandler::LoadAutofillData() {
addresses.Append(entry);
}
- web_ui_->CallJavascriptFunction("AutofillOptions.setAddressList", addresses);
+ web_ui()->CallJavascriptFunction("AutofillOptions.setAddressList", addresses);
ListValue credit_cards;
for (std::vector<CreditCard*>::const_iterator i =
@@ -428,8 +428,8 @@ void AutofillOptionsHandler::LoadAutofillData() {
credit_cards.Append(entry);
}
- web_ui_->CallJavascriptFunction("AutofillOptions.setCreditCardList",
- credit_cards);
+ web_ui()->CallJavascriptFunction("AutofillOptions.setCreditCardList",
+ credit_cards);
}
void AutofillOptionsHandler::RemoveAddress(const ListValue* args) {
@@ -492,7 +492,7 @@ void AutofillOptionsHandler::LoadAddressEditor(const ListValue* args) {
GetValueList(*profile, EMAIL_ADDRESS, &list);
address.Set("email", list.release());
- web_ui_->CallJavascriptFunction("AutofillOptions.editAddress", address);
+ web_ui()->CallJavascriptFunction("AutofillOptions.editAddress", address);
}
void AutofillOptionsHandler::LoadCreditCardEditor(const ListValue* args) {
@@ -526,8 +526,8 @@ void AutofillOptionsHandler::LoadCreditCardEditor(const ListValue* args) {
"expirationYear",
credit_card->GetInfo(CREDIT_CARD_EXP_4_DIGIT_YEAR));
- web_ui_->CallJavascriptFunction("AutofillOptions.editCreditCard",
- credit_card_data);
+ web_ui()->CallJavascriptFunction("AutofillOptions.editCreditCard",
+ credit_card_data);
}
void AutofillOptionsHandler::SetAddress(const ListValue* args) {
@@ -611,7 +611,7 @@ void AutofillOptionsHandler::ValidatePhoneNumbers(const ListValue* args) {
ListValue* list_value = NULL;
ValidatePhoneArguments(args, &list_value);
- web_ui_->CallJavascriptFunction(
+ web_ui()->CallJavascriptFunction(
"AutofillEditAddressOverlay.setValidatedPhoneNumbers", *list_value);
}
diff --git a/chrome/browser/ui/webui/options2/browser_options_handler2.cc b/chrome/browser/ui/webui/options2/browser_options_handler2.cc
index 7817a77..2eae016 100644
--- a/chrome/browser/ui/webui/options2/browser_options_handler2.cc
+++ b/chrome/browser/ui/webui/options2/browser_options_handler2.cc
@@ -110,43 +110,43 @@ void BrowserOptionsHandler::GetLocalizedValues(
}
void BrowserOptionsHandler::RegisterMessages() {
- web_ui_->RegisterMessageCallback("becomeDefaultBrowser",
+ web_ui()->RegisterMessageCallback("becomeDefaultBrowser",
base::Bind(&BrowserOptionsHandler::BecomeDefaultBrowser,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("setDefaultSearchEngine",
+ web_ui()->RegisterMessageCallback("setDefaultSearchEngine",
base::Bind(&BrowserOptionsHandler::SetDefaultSearchEngine,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("removeStartupPages",
+ web_ui()->RegisterMessageCallback("removeStartupPages",
base::Bind(&BrowserOptionsHandler::RemoveStartupPages,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("addStartupPage",
+ web_ui()->RegisterMessageCallback("addStartupPage",
base::Bind(&BrowserOptionsHandler::AddStartupPage,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("editStartupPage",
+ web_ui()->RegisterMessageCallback("editStartupPage",
base::Bind(&BrowserOptionsHandler::EditStartupPage,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("setStartupPagesToCurrentPages",
+ web_ui()->RegisterMessageCallback("setStartupPagesToCurrentPages",
base::Bind(&BrowserOptionsHandler::SetStartupPagesToCurrentPages,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("dragDropStartupPage",
+ web_ui()->RegisterMessageCallback("dragDropStartupPage",
base::Bind(&BrowserOptionsHandler::DragDropStartupPage,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("requestAutocompleteSuggestions",
+ web_ui()->RegisterMessageCallback("requestAutocompleteSuggestions",
base::Bind(&BrowserOptionsHandler::RequestAutocompleteSuggestions,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("enableInstant",
+ web_ui()->RegisterMessageCallback("enableInstant",
base::Bind(&BrowserOptionsHandler::EnableInstant,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("disableInstant",
+ web_ui()->RegisterMessageCallback("disableInstant",
base::Bind(&BrowserOptionsHandler::DisableInstant,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("getInstantFieldTrialStatus",
+ web_ui()->RegisterMessageCallback("getInstantFieldTrialStatus",
base::Bind(&BrowserOptionsHandler::GetInstantFieldTrialStatus,
base::Unretained(this)));
}
void BrowserOptionsHandler::Initialize() {
- Profile* profile = Profile::FromWebUI(web_ui_);
+ Profile* profile = Profile::FromWebUI(web_ui());
// Create our favicon data source.
profile->GetChromeURLDataManager()->AddDataSource(
@@ -201,12 +201,12 @@ void BrowserOptionsHandler::CheckAutoLaunchCallback(
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
if (is_in_auto_launch_group) {
- web_ui_->RegisterMessageCallback("toggleAutoLaunch",
+ web_ui()->RegisterMessageCallback("toggleAutoLaunch",
base::Bind(&BrowserOptionsHandler::ToggleAutoLaunch,
base::Unretained(this)));
base::FundamentalValue enabled(will_launch_at_login);
- web_ui_->CallJavascriptFunction("BrowserOptions.updateAutoLaunchState",
+ web_ui()->CallJavascriptFunction("BrowserOptions.updateAutoLaunchState",
enabled);
}
#endif
@@ -253,7 +253,7 @@ void BrowserOptionsHandler::BecomeDefaultBrowser(const ListValue* args) {
// If the user attempted to make Chrome the default browser, then he/she
// arguably wants to be notified when that changes.
- PrefService* prefs = Profile::FromWebUI(web_ui_)->GetPrefs();
+ PrefService* prefs = Profile::FromWebUI(web_ui())->GetPrefs();
prefs->SetBoolean(prefs::kCheckDefaultBrowser, true);
}
@@ -294,8 +294,9 @@ void BrowserOptionsHandler::SetDefaultBrowserUIString(int status_string_id) {
(status_string_id == IDS_OPTIONS_DEFAULTBROWSER_DEFAULT ||
status_string_id == IDS_OPTIONS_DEFAULTBROWSER_NOTDEFAULT)));
- web_ui_->CallJavascriptFunction("BrowserOptions.updateDefaultBrowserState",
- *status_string, *is_default, *can_be_default);
+ web_ui()->CallJavascriptFunction(
+ "BrowserOptions.updateDefaultBrowserState",
+ *status_string, *is_default, *can_be_default);
}
void BrowserOptionsHandler::OnTemplateURLServiceChanged() {
@@ -325,9 +326,9 @@ void BrowserOptionsHandler::OnTemplateURLServiceChanged() {
scoped_ptr<Value> default_managed(Value::CreateBooleanValue(
template_url_service_->is_default_search_managed()));
- web_ui_->CallJavascriptFunction("BrowserOptions.updateSearchEngines",
- search_engines, *default_value,
- *default_managed);
+ web_ui()->CallJavascriptFunction("BrowserOptions.updateSearchEngines",
+ search_engines, *default_value,
+ *default_managed);
}
void BrowserOptionsHandler::SetDefaultSearchEngine(const ListValue* args) {
@@ -348,7 +349,7 @@ void BrowserOptionsHandler::SetDefaultSearchEngine(const ListValue* args) {
void BrowserOptionsHandler::UpdateSearchEngines() {
template_url_service_ =
- TemplateURLServiceFactory::GetForProfile(Profile::FromWebUI(web_ui_));
+ TemplateURLServiceFactory::GetForProfile(Profile::FromWebUI(web_ui()));
if (template_url_service_) {
template_url_service_->Load();
template_url_service_->AddObserver(this);
@@ -357,7 +358,7 @@ void BrowserOptionsHandler::UpdateSearchEngines() {
}
void BrowserOptionsHandler::UpdateStartupPages() {
- Profile* profile = Profile::FromWebUI(web_ui_);
+ Profile* profile = Profile::FromWebUI(web_ui());
const SessionStartupPref startup_pref =
SessionStartupPref::GetStartupPref(profile->GetPrefs());
startup_custom_pages_table_model_->SetURLs(startup_pref.urls);
@@ -377,8 +378,8 @@ void BrowserOptionsHandler::OnModelChanged() {
startup_pages.Append(entry);
}
- web_ui_->CallJavascriptFunction("BrowserOptions.updateStartupPages",
- startup_pages);
+ web_ui()->CallJavascriptFunction("BrowserOptions.updateStartupPages",
+ startup_pages);
}
void BrowserOptionsHandler::OnItemsChanged(int start, int length) {
@@ -493,7 +494,7 @@ void BrowserOptionsHandler::DragDropStartupPage(const ListValue* args) {
}
void BrowserOptionsHandler::SaveStartupPagesPref() {
- PrefService* prefs = Profile::FromWebUI(web_ui_)->GetPrefs();
+ PrefService* prefs = Profile::FromWebUI(web_ui())->GetPrefs();
SessionStartupPref pref = SessionStartupPref::GetStartupPref(prefs);
pref.urls = startup_custom_pages_table_model_->GetURLs();
@@ -512,11 +513,11 @@ void BrowserOptionsHandler::RequestAutocompleteSuggestions(
}
void BrowserOptionsHandler::EnableInstant(const ListValue* args) {
- InstantController::Enable(Profile::FromWebUI(web_ui_));
+ InstantController::Enable(Profile::FromWebUI(web_ui()));
}
void BrowserOptionsHandler::DisableInstant(const ListValue* args) {
- InstantController::Disable(Profile::FromWebUI(web_ui_));
+ InstantController::Disable(Profile::FromWebUI(web_ui()));
}
void BrowserOptionsHandler::ToggleAutoLaunch(const ListValue* args) {
@@ -537,12 +538,12 @@ void BrowserOptionsHandler::ToggleAutoLaunch(const ListValue* args) {
}
void BrowserOptionsHandler::GetInstantFieldTrialStatus(const ListValue* args) {
- Profile* profile = Profile::FromWebUI(web_ui_);
+ Profile* profile = Profile::FromWebUI(web_ui());
base::FundamentalValue enabled(
InstantFieldTrial::IsInstantExperiment(profile) &&
!InstantFieldTrial::IsHiddenExperiment(profile));
- web_ui_->CallJavascriptFunction("BrowserOptions.setInstantFieldTrialStatus",
- enabled);
+ web_ui()->CallJavascriptFunction("BrowserOptions.setInstantFieldTrialStatus",
+ enabled);
}
void BrowserOptionsHandler::OnResultChanged(bool default_match_changed) {
@@ -564,7 +565,7 @@ void BrowserOptionsHandler::OnResultChanged(bool default_match_changed) {
suggestions.Append(entry);
}
- web_ui_->CallJavascriptFunction(
+ web_ui()->CallJavascriptFunction(
"BrowserOptions.updateAutocompleteSuggestions", suggestions);
}
diff --git a/chrome/browser/ui/webui/options2/certificate_manager_handler2.cc b/chrome/browser/ui/webui/options2/certificate_manager_handler2.cc
index 960e7fe..a335ed6 100644
--- a/chrome/browser/ui/webui/options2/certificate_manager_handler2.cc
+++ b/chrome/browser/ui/webui/options2/certificate_manager_handler2.cc
@@ -367,82 +367,82 @@ void CertificateManagerHandler::GetLocalizedValues(
}
void CertificateManagerHandler::RegisterMessages() {
- web_ui_->RegisterMessageCallback(
+ web_ui()->RegisterMessageCallback(
"viewCertificate",
base::Bind(&CertificateManagerHandler::View, base::Unretained(this)));
- web_ui_->RegisterMessageCallback(
+ web_ui()->RegisterMessageCallback(
"getCaCertificateTrust",
base::Bind(&CertificateManagerHandler::GetCATrust,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback(
+ web_ui()->RegisterMessageCallback(
"editCaCertificateTrust",
base::Bind(&CertificateManagerHandler::EditCATrust,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback(
+ web_ui()->RegisterMessageCallback(
"editServerCertificate",
base::Bind(&CertificateManagerHandler::EditServer,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback(
+ web_ui()->RegisterMessageCallback(
"cancelImportExportCertificate",
base::Bind(&CertificateManagerHandler::CancelImportExportProcess,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback(
+ web_ui()->RegisterMessageCallback(
"exportPersonalCertificate",
base::Bind(&CertificateManagerHandler::ExportPersonal,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback(
+ web_ui()->RegisterMessageCallback(
"exportAllPersonalCertificates",
base::Bind(&CertificateManagerHandler::ExportAllPersonal,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback(
+ web_ui()->RegisterMessageCallback(
"exportPersonalCertificatePasswordSelected",
base::Bind(&CertificateManagerHandler::ExportPersonalPasswordSelected,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback(
+ web_ui()->RegisterMessageCallback(
"importPersonalCertificate",
base::Bind(&CertificateManagerHandler::StartImportPersonal,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback(
+ web_ui()->RegisterMessageCallback(
"importPersonalCertificatePasswordSelected",
base::Bind(&CertificateManagerHandler::ImportPersonalPasswordSelected,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback(
+ web_ui()->RegisterMessageCallback(
"importCaCertificate",
base::Bind(&CertificateManagerHandler::ImportCA,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback(
+ web_ui()->RegisterMessageCallback(
"importCaCertificateTrustSelected",
base::Bind(&CertificateManagerHandler::ImportCATrustSelected,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback(
+ web_ui()->RegisterMessageCallback(
"importServerCertificate",
base::Bind(&CertificateManagerHandler::ImportServer,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback(
+ web_ui()->RegisterMessageCallback(
"exportCertificate",
base::Bind(&CertificateManagerHandler::Export,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback(
+ web_ui()->RegisterMessageCallback(
"deleteCertificate",
base::Bind(&CertificateManagerHandler::Delete,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback(
+ web_ui()->RegisterMessageCallback(
"populateCertificateManager",
base::Bind(&CertificateManagerHandler::Populate,
base::Unretained(this)));
#if defined(OS_CHROMEOS)
- web_ui_->RegisterMessageCallback(
+ web_ui()->RegisterMessageCallback(
"checkTpmTokenReady",
base::Bind(&CertificateManagerHandler::CheckTpmTokenReady,
base::Unretained(this)));
@@ -500,7 +500,7 @@ void CertificateManagerHandler::View(const ListValue* args) {
void CertificateManagerHandler::GetCATrust(const ListValue* args) {
net::X509Certificate* cert = CallbackArgsToCert(args);
if (!cert) {
- web_ui_->CallJavascriptFunction("CertificateEditCaTrustOverlay.dismiss");
+ web_ui()->CallJavascriptFunction("CertificateEditCaTrustOverlay.dismiss");
return;
}
@@ -512,7 +512,7 @@ void CertificateManagerHandler::GetCATrust(const ListValue* args) {
static_cast<bool>(trust_bits & net::CertDatabase::TRUSTED_EMAIL));
base::FundamentalValue obj_sign_value(
static_cast<bool>(trust_bits & net::CertDatabase::TRUSTED_OBJ_SIGN));
- web_ui_->CallJavascriptFunction(
+ web_ui()->CallJavascriptFunction(
"CertificateEditCaTrustOverlay.populateTrust",
ssl_value, email_value, obj_sign_value);
}
@@ -528,7 +528,7 @@ void CertificateManagerHandler::EditCATrust(const ListValue* args) {
fail |= !CallbackArgsToBool(args, 3, &trust_obj_sign);
if (fail) {
LOG(ERROR) << "EditCATrust args fail";
- web_ui_->CallJavascriptFunction("CertificateEditCaTrustOverlay.dismiss");
+ web_ui()->CallJavascriptFunction("CertificateEditCaTrustOverlay.dismiss");
return;
}
@@ -538,7 +538,7 @@ void CertificateManagerHandler::EditCATrust(const ListValue* args) {
trust_ssl * net::CertDatabase::TRUSTED_SSL +
trust_email * net::CertDatabase::TRUSTED_EMAIL +
trust_obj_sign * net::CertDatabase::TRUSTED_OBJ_SIGN);
- web_ui_->CallJavascriptFunction("CertificateEditCaTrustOverlay.dismiss");
+ web_ui()->CallJavascriptFunction("CertificateEditCaTrustOverlay.dismiss");
if (!result) {
// TODO(mattm): better error messages?
ShowError(
@@ -568,7 +568,7 @@ void CertificateManagerHandler::ExportPersonal(const ListValue* args) {
select_file_dialog_->SelectFile(
SelectFileDialog::SELECT_SAVEAS_FILE, string16(),
FilePath(), &file_type_info, 1, FILE_PATH_LITERAL("p12"),
- web_ui_->tab_contents(), GetParentWindow(),
+ web_ui()->tab_contents(), GetParentWindow(),
reinterpret_cast<void*>(EXPORT_PERSONAL_FILE_SELECTED));
}
@@ -579,14 +579,14 @@ void CertificateManagerHandler::ExportAllPersonal(const ListValue* args) {
void CertificateManagerHandler::ExportPersonalFileSelected(
const FilePath& path) {
file_path_ = path;
- web_ui_->CallJavascriptFunction(
+ web_ui()->CallJavascriptFunction(
"CertificateManager.exportPersonalAskPassword");
}
void CertificateManagerHandler::ExportPersonalPasswordSelected(
const ListValue* args) {
if (!args->GetString(0, &password_)){
- web_ui_->CallJavascriptFunction("CertificateRestoreOverlay.dismiss");
+ web_ui()->CallJavascriptFunction("CertificateRestoreOverlay.dismiss");
ImportExportCleanup();
return;
}
@@ -612,7 +612,7 @@ void CertificateManagerHandler::ExportPersonalSlotsUnlocked() {
password_,
&output);
if (!num_exported) {
- web_ui_->CallJavascriptFunction("CertificateRestoreOverlay.dismiss");
+ web_ui()->CallJavascriptFunction("CertificateRestoreOverlay.dismiss");
ShowError(
l10n_util::GetStringUTF8(IDS_CERT_MANAGER_PKCS12_EXPORT_ERROR_TITLE),
l10n_util::GetStringUTF8(IDS_CERT_MANAGER_UNKNOWN_ERROR));
@@ -629,7 +629,7 @@ void CertificateManagerHandler::ExportPersonalSlotsUnlocked() {
void CertificateManagerHandler::ExportPersonalFileWritten(int write_errno,
int bytes_written) {
- web_ui_->CallJavascriptFunction("CertificateRestoreOverlay.dismiss");
+ web_ui()->CallJavascriptFunction("CertificateRestoreOverlay.dismiss");
ImportExportCleanup();
if (write_errno) {
ShowError(
@@ -644,7 +644,7 @@ void CertificateManagerHandler::StartImportPersonal(const ListValue* args) {
if (!args->GetBoolean(0, &use_hardware_backed_)){
// Unable to retrieve the hardware backed attribute from the args,
// so bail.
- web_ui_->CallJavascriptFunction("CertificateRestoreOverlay.dismiss");
+ web_ui()->CallJavascriptFunction("CertificateRestoreOverlay.dismiss");
ImportExportCleanup();
return;
}
@@ -657,21 +657,21 @@ void CertificateManagerHandler::StartImportPersonal(const ListValue* args) {
select_file_dialog_->SelectFile(
SelectFileDialog::SELECT_OPEN_FILE, string16(),
FilePath(), &file_type_info, 1, FILE_PATH_LITERAL("p12"),
- web_ui_->tab_contents(), GetParentWindow(),
+ web_ui()->tab_contents(), GetParentWindow(),
reinterpret_cast<void*>(IMPORT_PERSONAL_FILE_SELECTED));
}
void CertificateManagerHandler::ImportPersonalFileSelected(
const FilePath& path) {
file_path_ = path;
- web_ui_->CallJavascriptFunction(
+ web_ui()->CallJavascriptFunction(
"CertificateManager.importPersonalAskPassword");
}
void CertificateManagerHandler::ImportPersonalPasswordSelected(
const ListValue* args) {
if (!args->GetString(0, &password_)){
- web_ui_->CallJavascriptFunction("CertificateRestoreOverlay.dismiss");
+ web_ui()->CallJavascriptFunction("CertificateRestoreOverlay.dismiss");
ImportExportCleanup();
return;
}
@@ -686,7 +686,7 @@ void CertificateManagerHandler::ImportPersonalFileRead(
int read_errno, std::string data) {
if (read_errno) {
ImportExportCleanup();
- web_ui_->CallJavascriptFunction("CertificateRestoreOverlay.dismiss");
+ web_ui()->CallJavascriptFunction("CertificateRestoreOverlay.dismiss");
ShowError(
l10n_util::GetStringUTF8(IDS_CERT_MANAGER_PKCS12_IMPORT_ERROR_TITLE),
l10n_util::GetStringFUTF8(IDS_CERT_MANAGER_READ_ERROR_FORMAT,
@@ -721,7 +721,7 @@ void CertificateManagerHandler::ImportPersonalSlotUnlocked() {
int result = certificate_manager_model_->ImportFromPKCS12(
module_, file_data_, password_, is_extractable);
ImportExportCleanup();
- web_ui_->CallJavascriptFunction("CertificateRestoreOverlay.dismiss");
+ web_ui()->CallJavascriptFunction("CertificateRestoreOverlay.dismiss");
int string_id;
switch (result) {
case net::OK:
@@ -775,7 +775,7 @@ void CertificateManagerHandler::ImportServer(const ListValue* args) {
select_file_dialog_.get(),
SelectFileDialog::SELECT_OPEN_FILE,
FilePath(),
- web_ui_->tab_contents(),
+ web_ui()->tab_contents(),
GetParentWindow(),
reinterpret_cast<void*>(IMPORT_SERVER_FILE_SELECTED));
}
@@ -831,7 +831,7 @@ void CertificateManagerHandler::ImportCA(const ListValue* args) {
ShowCertSelectFileDialog(select_file_dialog_.get(),
SelectFileDialog::SELECT_OPEN_FILE,
FilePath(),
- web_ui_->tab_contents(),
+ web_ui()->tab_contents(),
GetParentWindow(),
reinterpret_cast<void*>(IMPORT_CA_FILE_SELECTED));
}
@@ -872,8 +872,8 @@ void CertificateManagerHandler::ImportCAFileRead(int read_errno,
// TODO(mattm): check here if root_cert is not a CA cert and show error.
StringValue cert_name(root_cert->subject().GetDisplayName());
- web_ui_->CallJavascriptFunction("CertificateEditCaTrustOverlay.showImport",
- cert_name);
+ web_ui()->CallJavascriptFunction("CertificateEditCaTrustOverlay.showImport",
+ cert_name);
}
void CertificateManagerHandler::ImportCATrustSelected(const ListValue* args) {
@@ -887,7 +887,7 @@ void CertificateManagerHandler::ImportCATrustSelected(const ListValue* args) {
if (fail) {
LOG(ERROR) << "ImportCATrustSelected args fail";
ImportExportCleanup();
- web_ui_->CallJavascriptFunction("CertificateEditCaTrustOverlay.dismiss");
+ web_ui()->CallJavascriptFunction("CertificateEditCaTrustOverlay.dismiss");
return;
}
@@ -898,7 +898,7 @@ void CertificateManagerHandler::ImportCATrustSelected(const ListValue* args) {
trust_email * net::CertDatabase::TRUSTED_EMAIL +
trust_obj_sign * net::CertDatabase::TRUSTED_OBJ_SIGN,
&not_imported);
- web_ui_->CallJavascriptFunction("CertificateEditCaTrustOverlay.dismiss");
+ web_ui()->CallJavascriptFunction("CertificateEditCaTrustOverlay.dismiss");
if (!result) {
ShowError(
l10n_util::GetStringUTF8(IDS_CERT_MANAGER_CA_IMPORT_ERROR_TITLE),
@@ -915,7 +915,7 @@ void CertificateManagerHandler::Export(const ListValue* args) {
net::X509Certificate* cert = CallbackArgsToCert(args);
if (!cert)
return;
- ShowCertExportDialog(web_ui_->tab_contents(), GetParentWindow(),
+ ShowCertExportDialog(web_ui()->tab_contents(), GetParentWindow(),
cert->os_cert_handle());
}
@@ -990,7 +990,7 @@ void CertificateManagerHandler::PopulateTree(const std::string& tab_name,
ListValue args;
args.Append(Value::CreateStringValue(tree_name));
args.Append(nodes);
- web_ui_->CallJavascriptFunction("CertificateManager.onPopulateTree", args);
+ web_ui()->CallJavascriptFunction("CertificateManager.onPopulateTree", args);
}
}
@@ -1003,7 +1003,7 @@ void CertificateManagerHandler::ShowError(const std::string& title,
args.push_back(Value::CreateNullValue()); // cancelTitle
args.push_back(Value::CreateNullValue()); // okCallback
args.push_back(Value::CreateNullValue()); // cancelCallback
- web_ui_->CallJavascriptFunction("AlertOverlay.show", args.get());
+ web_ui()->CallJavascriptFunction("AlertOverlay.show", args.get());
}
void CertificateManagerHandler::ShowImportErrors(
@@ -1029,10 +1029,10 @@ void CertificateManagerHandler::ShowImportErrors(
StringValue title_value(title);
StringValue error_value(error);
- web_ui_->CallJavascriptFunction("CertificateImportErrorOverlay.show",
- title_value,
- error_value,
- cert_error_list);
+ web_ui()->CallJavascriptFunction("CertificateImportErrorOverlay.show",
+ title_value,
+ error_value,
+ cert_error_list);
}
#if defined(OS_CHROMEOS)
@@ -1042,13 +1042,13 @@ void CertificateManagerHandler::CheckTpmTokenReady(const ListValue* args) {
// TODO(xiyuan): Use async way when underlying supports it.
base::FundamentalValue ready(cryptohome->Pkcs11IsTpmTokenReady());
- web_ui_->CallJavascriptFunction("CertificateManager.onCheckTpmTokenReady",
- ready);
+ web_ui()->CallJavascriptFunction("CertificateManager.onCheckTpmTokenReady",
+ ready);
}
#endif
gfx::NativeWindow CertificateManagerHandler::GetParentWindow() const {
- return web_ui_->tab_contents()->GetView()->GetTopLevelNativeWindow();
+ return web_ui()->tab_contents()->GetView()->GetTopLevelNativeWindow();
}
} // namespace options2
diff --git a/chrome/browser/ui/webui/options2/chromeos/about_page_handler2.cc b/chrome/browser/ui/webui/options2/chromeos/about_page_handler2.cc
index 86d8eaa..de472c8 100644
--- a/chrome/browser/ui/webui/options2/chromeos/about_page_handler2.cc
+++ b/chrome/browser/ui/webui/options2/chromeos/about_page_handler2.cc
@@ -235,14 +235,14 @@ void AboutPageHandler::GetLocalizedValues(DictionaryValue* localized_strings) {
}
void AboutPageHandler::RegisterMessages() {
- web_ui_->RegisterMessageCallback("PageReady",
+ web_ui()->RegisterMessageCallback("PageReady",
base::Bind(&AboutPageHandler::PageReady, base::Unretained(this)));
- web_ui_->RegisterMessageCallback("SetReleaseTrack",
+ web_ui()->RegisterMessageCallback("SetReleaseTrack",
base::Bind(&AboutPageHandler::SetReleaseTrack, base::Unretained(this)));
- web_ui_->RegisterMessageCallback("CheckNow",
+ web_ui()->RegisterMessageCallback("CheckNow",
base::Bind(&AboutPageHandler::CheckNow, base::Unretained(this)));
- web_ui_->RegisterMessageCallback("RestartNow",
+ web_ui()->RegisterMessageCallback("RestartNow",
base::Bind(&AboutPageHandler::RestartNow, base::Unretained(this)));
}
@@ -367,20 +367,20 @@ void AboutPageHandler::UpdateStatus(
scoped_ptr<Value> insert_delay(Value::CreateBooleanValue(
status.status ==
UpdateEngineClient::UPDATE_STATUS_CHECKING_FOR_UPDATE));
- web_ui_->CallJavascriptFunction("AboutPage.updateStatusCallback",
- *update_message, *insert_delay);
+ web_ui()->CallJavascriptFunction("AboutPage.updateStatusCallback",
+ *update_message, *insert_delay);
scoped_ptr<Value> enabled_value(Value::CreateBooleanValue(enabled));
- web_ui_->CallJavascriptFunction("AboutPage.updateEnableCallback",
- *enabled_value);
+ web_ui()->CallJavascriptFunction("AboutPage.updateEnableCallback",
+ *enabled_value);
scoped_ptr<Value> image_string(Value::CreateStringValue(image));
- web_ui_->CallJavascriptFunction("AboutPage.setUpdateImage",
- *image_string);
+ web_ui()->CallJavascriptFunction("AboutPage.setUpdateImage",
+ *image_string);
}
// We'll change the "Check For Update" button to "Restart" button.
if (status.status == UpdateEngineClient::UPDATE_STATUS_UPDATED_NEED_REBOOT) {
- web_ui_->CallJavascriptFunction("AboutPage.changeToRestartButton");
+ web_ui()->CallJavascriptFunction("AboutPage.changeToRestartButton");
}
}
@@ -388,8 +388,8 @@ void AboutPageHandler::OnOSVersion(VersionLoader::Handle handle,
std::string version) {
if (version.size()) {
scoped_ptr<Value> version_string(Value::CreateStringValue(version));
- web_ui_->CallJavascriptFunction("AboutPage.updateOSVersionCallback",
- *version_string);
+ web_ui()->CallJavascriptFunction("AboutPage.updateOSVersionCallback",
+ *version_string);
}
}
@@ -397,8 +397,8 @@ void AboutPageHandler::OnOSFirmware(VersionLoader::Handle handle,
std::string firmware) {
if (firmware.size()) {
scoped_ptr<Value> firmware_string(Value::CreateStringValue(firmware));
- web_ui_->CallJavascriptFunction("AboutPage.updateOSFirmwareCallback",
- *firmware_string);
+ web_ui()->CallJavascriptFunction("AboutPage.updateOSFirmwareCallback",
+ *firmware_string);
}
}
@@ -412,7 +412,7 @@ void AboutPageHandler::UpdateSelectedChannel(UpdateObserver* observer,
// is valid.
AboutPageHandler* handler = observer->page_handler();
scoped_ptr<Value> channel_string(Value::CreateStringValue(channel));
- handler->web_ui_->CallJavascriptFunction(
+ handler->web_ui()->CallJavascriptFunction(
"AboutPage.updateSelectedOptionCallback", *channel_string);
}
}
diff --git a/chrome/browser/ui/webui/options2/chromeos/accounts_options_handler2.cc b/chrome/browser/ui/webui/options2/chromeos/accounts_options_handler2.cc
index 434c8a8b..2c273e9 100644
--- a/chrome/browser/ui/webui/options2/chromeos/accounts_options_handler2.cc
+++ b/chrome/browser/ui/webui/options2/chromeos/accounts_options_handler2.cc
@@ -46,14 +46,13 @@ AccountsOptionsHandler::~AccountsOptionsHandler() {
}
void AccountsOptionsHandler::RegisterMessages() {
- DCHECK(web_ui_);
- web_ui_->RegisterMessageCallback("whitelistUser",
+ web_ui()->RegisterMessageCallback("whitelistUser",
base::Bind(&AccountsOptionsHandler::HandleWhitelistUser,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("unwhitelistUser",
+ web_ui()->RegisterMessageCallback("unwhitelistUser",
base::Bind(&AccountsOptionsHandler::HandleUnwhitelistUser,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("whitelistExistingUsers",
+ web_ui()->RegisterMessageCallback("whitelistExistingUsers",
base::Bind(&AccountsOptionsHandler::HandleWhitelistExistingUsers,
base::Unretained(this)));
}
diff --git a/chrome/browser/ui/webui/options2/chromeos/bluetooth_options_handler2.cc b/chrome/browser/ui/webui/options2/chromeos/bluetooth_options_handler2.cc
index f6554ab..46a5315 100644
--- a/chrome/browser/ui/webui/options2/chromeos/bluetooth_options_handler2.cc
+++ b/chrome/browser/ui/webui/options2/chromeos/bluetooth_options_handler2.cc
@@ -102,7 +102,6 @@ void BluetoothOptionsHandler::GetLocalizedValues(
}
void BluetoothOptionsHandler::Initialize() {
- DCHECK(web_ui_);
// Bluetooth support is a work in progress. Supress the feature unless
// explicitly enabled via a command line flag.
if (!CommandLine::ForCurrentProcess()
@@ -110,13 +109,13 @@ void BluetoothOptionsHandler::Initialize() {
return;
}
- web_ui_->CallJavascriptFunction(
+ web_ui()->CallJavascriptFunction(
"options.SystemOptions.showBluetoothSettings");
// TODO(kevers): Determine whether bluetooth adapter is powered.
bool bluetooth_on = false;
base::FundamentalValue checked(bluetooth_on);
- web_ui_->CallJavascriptFunction(
+ web_ui()->CallJavascriptFunction(
"options.SystemOptions.setBluetoothState", checked);
chromeos::BluetoothManager* bluetooth_manager =
@@ -130,14 +129,13 @@ void BluetoothOptionsHandler::Initialize() {
}
void BluetoothOptionsHandler::RegisterMessages() {
- DCHECK(web_ui_);
- web_ui_->RegisterMessageCallback("bluetoothEnableChange",
+ web_ui()->RegisterMessageCallback("bluetoothEnableChange",
base::Bind(&BluetoothOptionsHandler::EnableChangeCallback,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("findBluetoothDevices",
+ web_ui()->RegisterMessageCallback("findBluetoothDevices",
base::Bind(&BluetoothOptionsHandler::FindDevicesCallback,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("updateBluetoothDevice",
+ web_ui()->RegisterMessageCallback("updateBluetoothDevice",
base::Bind(&BluetoothOptionsHandler::UpdateDeviceCallback,
base::Unretained(this)));
}
@@ -148,7 +146,7 @@ void BluetoothOptionsHandler::EnableChangeCallback(
args->GetBoolean(0, &bluetooth_enabled);
// TODO(kevers): Call Bluetooth API to enable or disable.
base::FundamentalValue checked(bluetooth_enabled);
- web_ui_->CallJavascriptFunction(
+ web_ui()->CallJavascriptFunction(
"options.SystemOptions.setBluetoothState", checked);
}
@@ -219,7 +217,7 @@ void BluetoothOptionsHandler::SendDeviceNotification(
if (params) {
js_properties.MergeDictionary(params);
}
- web_ui_->CallJavascriptFunction(
+ web_ui()->CallJavascriptFunction(
"options.SystemOptions.addBluetoothDevice",
js_properties);
}
@@ -280,7 +278,7 @@ void BluetoothOptionsHandler::DiscoveryStarted(const std::string& adapter_id) {
void BluetoothOptionsHandler::DiscoveryEnded(const std::string& adapter_id) {
VLOG(2) << "Discovery ended on " << adapter_id;
- web_ui_->CallJavascriptFunction(
+ web_ui()->CallJavascriptFunction(
"options.SystemOptions.notifyBluetoothSearchComplete");
// Stop the discovery session.
@@ -344,7 +342,7 @@ void BluetoothOptionsHandler::GenerateFakeDeviceList() {
false,
false,
"");
- web_ui_->CallJavascriptFunction(
+ web_ui()->CallJavascriptFunction(
"options.SystemOptions.notifyBluetoothSearchComplete");
}
diff --git a/chrome/browser/ui/webui/options2/chromeos/change_picture_options_handler2.cc b/chrome/browser/ui/webui/options2/chromeos/change_picture_options_handler2.cc
index 5ac62a245d..b0cfac9 100644
--- a/chrome/browser/ui/webui/options2/chromeos/change_picture_options_handler2.cc
+++ b/chrome/browser/ui/webui/options2/chromeos/change_picture_options_handler2.cc
@@ -97,20 +97,19 @@ void ChangePictureOptionsHandler::GetLocalizedValues(
}
void ChangePictureOptionsHandler::RegisterMessages() {
- DCHECK(web_ui_);
- web_ui_->RegisterMessageCallback("chooseFile",
+ web_ui()->RegisterMessageCallback("chooseFile",
base::Bind(&ChangePictureOptionsHandler::HandleChooseFile,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("takePhoto",
+ web_ui()->RegisterMessageCallback("takePhoto",
base::Bind(&ChangePictureOptionsHandler::HandleTakePhoto,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("onChangePicturePageShown",
+ web_ui()->RegisterMessageCallback("onChangePicturePageShown",
base::Bind(&ChangePictureOptionsHandler::HandlePageShown,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("onChangePicturePageInitialized",
+ web_ui()->RegisterMessageCallback("onChangePicturePageInitialized",
base::Bind(&ChangePictureOptionsHandler::HandlePageInitialized,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("selectImage",
+ web_ui()->RegisterMessageCallback("selectImage",
base::Bind(&ChangePictureOptionsHandler::HandleSelectImage,
base::Unretained(this)));
}
@@ -120,8 +119,8 @@ void ChangePictureOptionsHandler::SendDefaultImages() {
for (int i = 0; i < kDefaultImagesCount; ++i) {
image_urls.Append(new StringValue(GetDefaultImageUrl(i)));
}
- web_ui_->CallJavascriptFunction("ChangePictureOptions.setDefaultImages",
- image_urls);
+ web_ui()->CallJavascriptFunction("ChangePictureOptions.setDefaultImages",
+ image_urls);
}
void ChangePictureOptionsHandler::HandleChooseFile(const ListValue* args) {
@@ -146,7 +145,7 @@ void ChangePictureOptionsHandler::HandleChooseFile(const ListValue* args) {
&file_type_info,
0,
FILE_PATH_LITERAL(""),
- web_ui_->tab_contents(),
+ web_ui()->tab_contents(),
GetBrowserWindow(),
NULL);
}
@@ -199,7 +198,7 @@ void ChangePictureOptionsHandler::SendSelectedImage() {
// User has image from camera/file, record it and add to the image list.
previous_image_ = user.image();
previous_image_data_url_ = web_ui_util::GetImageDataUrl(previous_image_);
- web_ui_->CallJavascriptFunction("ChangePictureOptions.setOldImage");
+ web_ui()->CallJavascriptFunction("ChangePictureOptions.setOldImage");
break;
}
case User::kProfileImageIndex: {
@@ -212,8 +211,8 @@ void ChangePictureOptionsHandler::SendSelectedImage() {
previous_image_index_ < kDefaultImagesCount);
// User has image from the set of default images.
base::StringValue image_url(GetDefaultImageUrl(previous_image_index_));
- web_ui_->CallJavascriptFunction("ChangePictureOptions.setSelectedImage",
- image_url);
+ web_ui()->CallJavascriptFunction("ChangePictureOptions.setSelectedImage",
+ image_url);
}
}
}
@@ -222,8 +221,8 @@ void ChangePictureOptionsHandler::SendProfileImage(const SkBitmap& image,
bool should_select) {
base::StringValue data_url(web_ui_util::GetImageDataUrl(image));
base::FundamentalValue select(should_select);
- web_ui_->CallJavascriptFunction("ChangePictureOptions.setProfileImage",
- data_url, select);
+ web_ui()->CallJavascriptFunction("ChangePictureOptions.setProfileImage",
+ data_url, select);
}
void ChangePictureOptionsHandler::UpdateProfileImage() {
@@ -318,8 +317,8 @@ void ChangePictureOptionsHandler::CheckCameraPresence() {
void ChangePictureOptionsHandler::SetCameraPresent(bool present) {
base::FundamentalValue present_value(present);
- web_ui_->CallJavascriptFunction("ChangePictureOptions.setCameraPresent",
- present_value);
+ web_ui()->CallJavascriptFunction("ChangePictureOptions.setCameraPresent",
+ present_value);
}
void ChangePictureOptionsHandler::OnCameraPresenceCheckDone() {
@@ -340,7 +339,7 @@ void ChangePictureOptionsHandler::Observe(
gfx::NativeWindow ChangePictureOptionsHandler::GetBrowserWindow() const {
Browser* browser =
- BrowserList::FindBrowserWithProfile(Profile::FromWebUI(web_ui_));
+ BrowserList::FindBrowserWithProfile(Profile::FromWebUI(web_ui()));
if (!browser)
return NULL;
return browser->window()->GetNativeHandle();
diff --git a/chrome/browser/ui/webui/options2/chromeos/core_chromeos_options_handler2.cc b/chrome/browser/ui/webui/options2/chromeos/core_chromeos_options_handler2.cc
index d03c918..81254e2 100644
--- a/chrome/browser/ui/webui/options2/chromeos/core_chromeos_options_handler2.cc
+++ b/chrome/browser/ui/webui/options2/chromeos/core_chromeos_options_handler2.cc
@@ -93,7 +93,7 @@ CoreChromeOSOptionsHandler::CoreChromeOSOptionsHandler()
CoreChromeOSOptionsHandler::~CoreChromeOSOptionsHandler() {
PrefProxyConfigTracker* proxy_tracker =
- Profile::FromWebUI(web_ui_)->GetProxyConfigTracker();
+ Profile::FromWebUI(web_ui())->GetProxyConfigTracker();
proxy_tracker->RemoveNotificationCallback(
base::Bind(&CoreChromeOSOptionsHandler::NotifyProxyPrefsChanged,
pointer_factory_.GetWeakPtr()));
@@ -101,10 +101,10 @@ CoreChromeOSOptionsHandler::~CoreChromeOSOptionsHandler() {
void CoreChromeOSOptionsHandler::Initialize() {
proxy_prefs_.reset(PrefSetObserver::CreateProxyPrefSetObserver(
- Profile::FromWebUI(web_ui_)->GetPrefs(), this));
+ Profile::FromWebUI(web_ui())->GetPrefs(), this));
// Observe the chromeos::ProxyConfigServiceImpl for changes from the UI.
PrefProxyConfigTracker* proxy_tracker =
- Profile::FromWebUI(web_ui_)->GetProxyConfigTracker();
+ Profile::FromWebUI(web_ui())->GetProxyConfigTracker();
proxy_tracker->AddNotificationCallback(
base::Bind(&CoreChromeOSOptionsHandler::NotifyProxyPrefsChanged,
pointer_factory_.GetWeakPtr()));
@@ -114,7 +114,7 @@ base::Value* CoreChromeOSOptionsHandler::FetchPref(
const std::string& pref_name) {
if (proxy_cros_settings_parser::IsProxyPref(pref_name)) {
base::Value *value = NULL;
- proxy_cros_settings_parser::GetProxyPrefValue(Profile::FromWebUI(web_ui_),
+ proxy_cros_settings_parser::GetProxyPrefValue(Profile::FromWebUI(web_ui()),
pref_name, &value);
if (!value)
return base::Value::CreateNullValue();
@@ -125,7 +125,7 @@ base::Value* CoreChromeOSOptionsHandler::FetchPref(
// Specially handle kUseSharedProxies because kProxy controls it to
// determine if it's managed by policy/extension.
if (pref_name == prefs::kUseSharedProxies) {
- PrefService* pref_service = Profile::FromWebUI(web_ui_)->GetPrefs();
+ PrefService* pref_service = Profile::FromWebUI(web_ui())->GetPrefs();
const PrefService::Preference* pref =
pref_service->FindPreference(prefs::kUseSharedProxies);
if (!pref)
@@ -169,7 +169,7 @@ void CoreChromeOSOptionsHandler::SetPref(const std::string& pref_name,
const base::Value* value,
const std::string& metric) {
if (proxy_cros_settings_parser::IsProxyPref(pref_name)) {
- proxy_cros_settings_parser::SetProxyPrefValue(Profile::FromWebUI(web_ui_),
+ proxy_cros_settings_parser::SetProxyPrefValue(Profile::FromWebUI(web_ui()),
pref_name, value);
ProcessUserMetric(value, metric);
return;
@@ -207,7 +207,7 @@ void CoreChromeOSOptionsHandler::Observe(
// Special handling for preferences kUseSharedProxies and kProxy, the latter
// controls the former and decides if it's managed by policy/extension.
if (type == chrome::NOTIFICATION_PREF_CHANGED) {
- const PrefService* pref_service = Profile::FromWebUI(web_ui_)->GetPrefs();
+ const PrefService* pref_service = Profile::FromWebUI(web_ui())->GetPrefs();
std::string* pref_name = content::Details<std::string>(details).ptr();
if (content::Source<PrefService>(source).ptr() == pref_service &&
(proxy_prefs_->IsObserved(*pref_name) ||
@@ -221,7 +221,6 @@ void CoreChromeOSOptionsHandler::Observe(
void CoreChromeOSOptionsHandler::NotifySettingsChanged(
const std::string* setting_name) {
- DCHECK(web_ui_);
DCHECK(CrosSettings::Get()->IsCrosSettings(*setting_name));
const base::Value* value = FetchPref(*setting_name);
if (!value) {
@@ -237,19 +236,18 @@ void CoreChromeOSOptionsHandler::NotifySettingsChanged(
ListValue result_value;
result_value.Append(base::Value::CreateStringValue(setting_name->c_str()));
result_value.Append(value->DeepCopy());
- web_ui_->CallJavascriptFunction(WideToASCII(callback_function),
- result_value);
+ web_ui()->CallJavascriptFunction(WideToASCII(callback_function),
+ result_value);
}
if (value)
delete value;
}
void CoreChromeOSOptionsHandler::NotifyProxyPrefsChanged() {
- DCHECK(web_ui_);
for (size_t i = 0; i < kProxySettingsCount; ++i) {
base::Value* value = NULL;
proxy_cros_settings_parser::GetProxyPrefValue(
- Profile::FromWebUI(web_ui_), kProxySettings[i], &value);
+ Profile::FromWebUI(web_ui()), kProxySettings[i], &value);
DCHECK(value);
PreferenceCallbackMap::const_iterator iter =
pref_callback_map_.find(kProxySettings[i]);
@@ -258,8 +256,8 @@ void CoreChromeOSOptionsHandler::NotifyProxyPrefsChanged() {
ListValue result_value;
result_value.Append(base::Value::CreateStringValue(kProxySettings[i]));
result_value.Append(value->DeepCopy());
- web_ui_->CallJavascriptFunction(WideToASCII(callback_function),
- result_value);
+ web_ui()->CallJavascriptFunction(WideToASCII(callback_function),
+ result_value);
}
if (value)
delete value;
diff --git a/chrome/browser/ui/webui/options2/chromeos/cros_language_options_handler2.cc b/chrome/browser/ui/webui/options2/chromeos/cros_language_options_handler2.cc
index 9aeedaf..10e0260 100644
--- a/chrome/browser/ui/webui/options2/chromeos/cros_language_options_handler2.cc
+++ b/chrome/browser/ui/webui/options2/chromeos/cros_language_options_handler2.cc
@@ -79,16 +79,16 @@ void CrosLanguageOptionsHandler::GetLocalizedValues(
void CrosLanguageOptionsHandler::RegisterMessages() {
::options2::LanguageOptionsHandlerCommon::RegisterMessages();
- web_ui_->RegisterMessageCallback("inputMethodDisable",
+ web_ui()->RegisterMessageCallback("inputMethodDisable",
base::Bind(&CrosLanguageOptionsHandler::InputMethodDisableCallback,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("inputMethodEnable",
+ web_ui()->RegisterMessageCallback("inputMethodEnable",
base::Bind(&CrosLanguageOptionsHandler::InputMethodEnableCallback,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("inputMethodOptionsOpen",
+ web_ui()->RegisterMessageCallback("inputMethodOptionsOpen",
base::Bind(&CrosLanguageOptionsHandler::InputMethodOptionsOpenCallback,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("uiLanguageRestart",
+ web_ui()->RegisterMessageCallback("uiLanguageRestart",
base::Bind(&CrosLanguageOptionsHandler::RestartCallback,
base::Unretained(this)));
}
@@ -206,7 +206,7 @@ string16 CrosLanguageOptionsHandler::GetProductName() {
void CrosLanguageOptionsHandler::SetApplicationLocale(
const std::string& language_code) {
- Profile::FromWebUI(web_ui_)->ChangeAppLocale(
+ Profile::FromWebUI(web_ui())->ChangeAppLocale(
language_code, Profile::APP_LOCALE_CHANGED_VIA_SETTINGS);
}
@@ -214,7 +214,7 @@ void CrosLanguageOptionsHandler::RestartCallback(const ListValue* args) {
content::RecordAction(UserMetricsAction("LanguageOptions_SignOut"));
Browser* browser = Browser::GetBrowserForController(
- &web_ui_->tab_contents()->GetController(), NULL);
+ &web_ui()->tab_contents()->GetController(), NULL);
if (browser)
browser->ExecuteCommand(IDC_EXIT);
}
diff --git a/chrome/browser/ui/webui/options2/chromeos/internet_options_handler2.cc b/chrome/browser/ui/webui/options2/chromeos/internet_options_handler2.cc
index d4d04e8..5ecd18f 100644
--- a/chrome/browser/ui/webui/options2/chromeos/internet_options_handler2.cc
+++ b/chrome/browser/ui/webui/options2/chromeos/internet_options_handler2.cc
@@ -551,47 +551,46 @@ void InternetOptionsHandler::Initialize() {
void InternetOptionsHandler::RegisterMessages() {
// Setup handlers specific to this panel.
- DCHECK(web_ui_);
- web_ui_->RegisterMessageCallback("buttonClickCallback",
+ web_ui()->RegisterMessageCallback("buttonClickCallback",
base::Bind(&InternetOptionsHandler::ButtonClickCallback,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("refreshCellularPlan",
+ web_ui()->RegisterMessageCallback("refreshCellularPlan",
base::Bind(&InternetOptionsHandler::RefreshCellularPlanCallback,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("setPreferNetwork",
+ web_ui()->RegisterMessageCallback("setPreferNetwork",
base::Bind(&InternetOptionsHandler::SetPreferNetworkCallback,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("setAutoConnect",
+ web_ui()->RegisterMessageCallback("setAutoConnect",
base::Bind(&InternetOptionsHandler::SetAutoConnectCallback,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("setIPConfig",
+ web_ui()->RegisterMessageCallback("setIPConfig",
base::Bind(&InternetOptionsHandler::SetIPConfigCallback,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("enableWifi",
+ web_ui()->RegisterMessageCallback("enableWifi",
base::Bind(&InternetOptionsHandler::EnableWifiCallback,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("disableWifi",
+ web_ui()->RegisterMessageCallback("disableWifi",
base::Bind(&InternetOptionsHandler::DisableWifiCallback,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("enableCellular",
+ web_ui()->RegisterMessageCallback("enableCellular",
base::Bind(&InternetOptionsHandler::EnableCellularCallback,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("disableCellular",
+ web_ui()->RegisterMessageCallback("disableCellular",
base::Bind(&InternetOptionsHandler::DisableCellularCallback,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("buyDataPlan",
+ web_ui()->RegisterMessageCallback("buyDataPlan",
base::Bind(&InternetOptionsHandler::BuyDataPlanCallback,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("showMorePlanInfo",
+ web_ui()->RegisterMessageCallback("showMorePlanInfo",
base::Bind(&InternetOptionsHandler::BuyDataPlanCallback,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("setApn",
+ web_ui()->RegisterMessageCallback("setApn",
base::Bind(&InternetOptionsHandler::SetApnCallback,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("setSimCardLock",
+ web_ui()->RegisterMessageCallback("setSimCardLock",
base::Bind(&InternetOptionsHandler::SetSimCardLockCallback,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("changePin",
+ web_ui()->RegisterMessageCallback("changePin",
base::Bind(&InternetOptionsHandler::ChangePinCallback,
base::Unretained(this)));
}
@@ -623,10 +622,10 @@ void InternetOptionsHandler::DisableCellularCallback(const ListValue* args) {
}
void InternetOptionsHandler::BuyDataPlanCallback(const ListValue* args) {
- if (!web_ui_)
+ if (!web_ui())
return;
Browser* browser = BrowserList::FindBrowserWithFeature(
- Profile::FromWebUI(web_ui_), Browser::FEATURE_TABSTRIP);
+ Profile::FromWebUI(web_ui()), Browser::FEATURE_TABSTRIP);
if (browser)
browser->OpenMobilePlanTabAndActivate();
}
@@ -680,13 +679,13 @@ void InternetOptionsHandler::ChangePinCallback(const ListValue* args) {
void InternetOptionsHandler::RefreshNetworkData() {
DictionaryValue dictionary;
FillNetworkInfo(&dictionary);
- web_ui_->CallJavascriptFunction(
+ web_ui()->CallJavascriptFunction(
"options.InternetOptions.refreshNetworkData", dictionary);
}
void InternetOptionsHandler::OnNetworkManagerChanged(
chromeos::NetworkLibrary* cros) {
- if (!web_ui_)
+ if (!web_ui())
return;
MonitorNetworks();
RefreshNetworkData();
@@ -695,7 +694,7 @@ void InternetOptionsHandler::OnNetworkManagerChanged(
void InternetOptionsHandler::OnNetworkChanged(
chromeos::NetworkLibrary* cros,
const chromeos::Network* network) {
- if (web_ui_)
+ if (web_ui())
RefreshNetworkData();
}
@@ -728,7 +727,7 @@ void InternetOptionsHandler::MonitorNetworks() {
void InternetOptionsHandler::OnCellularDataPlanChanged(
chromeos::NetworkLibrary* cros) {
- if (!web_ui_)
+ if (!web_ui())
return;
const chromeos::CellularNetwork* cellular = cros_->cellular_network();
if (!cellular)
@@ -749,7 +748,7 @@ void InternetOptionsHandler::OnCellularDataPlanChanged(
cellular->activation_state() == chromeos::ACTIVATION_STATE_ACTIVATED);
connection_plans.Set("plans", plan_list);
SetActivationButtonVisibility(cellular, &connection_plans);
- web_ui_->CallJavascriptFunction(
+ web_ui()->CallJavascriptFunction(
"options.InternetOptions.updateCellularPlans", connection_plans);
}
@@ -761,7 +760,7 @@ void InternetOptionsHandler::Observe(
OptionsPageUIHandler::Observe(type, source, details);
if (type == chrome::NOTIFICATION_REQUIRE_PIN_SETTING_CHANGE_ENDED) {
base::FundamentalValue require_pin(*content::Details<bool>(details).ptr());
- web_ui_->CallJavascriptFunction(
+ web_ui()->CallJavascriptFunction(
"options.InternetOptions.updateSecurityTab", require_pin);
} else if (type == chrome::NOTIFICATION_ENTER_PIN_ENDED) {
// We make an assumption (which is valid for now) that the SIM
@@ -771,7 +770,7 @@ void InternetOptionsHandler::Observe(
if (cancelled) {
base::DictionaryValue dictionary;
FillNetworkInfo(&dictionary);
- web_ui_->CallJavascriptFunction(
+ web_ui()->CallJavascriptFunction(
"options.InternetOptions.setupAttributes", dictionary);
}
// The case in which the correct PIN was entered and the SIM is
@@ -864,8 +863,8 @@ void InternetOptionsHandler::PopulateDictionaryDetails(
const chromeos::Network* network) {
DCHECK(network);
- if (web_ui_) {
- Profile::FromWebUI(web_ui_)->GetProxyConfigTracker()->UISetCurrentNetwork(
+ if (web_ui()) {
+ Profile::FromWebUI(web_ui())->GetProxyConfigTracker()->UISetCurrentNetwork(
network->service_path());
}
@@ -976,7 +975,7 @@ void InternetOptionsHandler::PopulateDictionaryDetails(
dictionary.SetBoolean("deviceConnected", cros_->ethernet_connected());
}
- web_ui_->CallJavascriptFunction(
+ web_ui()->CallJavascriptFunction(
"options.InternetOptions.showDetailedInfo", dictionary);
}
@@ -1115,7 +1114,7 @@ gfx::NativeWindow InternetOptionsHandler::GetNativeWindow() const {
// TODO(beng): This is an improper direct dependency on Browser. Route this
// through some sort of delegate.
Browser* browser =
- BrowserList::FindBrowserWithProfile(Profile::FromWebUI(web_ui_));
+ BrowserList::FindBrowserWithProfile(Profile::FromWebUI(web_ui()));
return browser->window()->GetNativeHandle();
}
diff --git a/chrome/browser/ui/webui/options2/chromeos/proxy_handler2.cc b/chrome/browser/ui/webui/options2/chromeos/proxy_handler2.cc
index d3fa638..a92d7c4 100644
--- a/chrome/browser/ui/webui/options2/chromeos/proxy_handler2.cc
+++ b/chrome/browser/ui/webui/options2/chromeos/proxy_handler2.cc
@@ -80,8 +80,8 @@ void ProxyHandler::GetLocalizedValues(
void ProxyHandler::SetNetworkName(const std::string& name) {
StringValue network(name);
- web_ui_->CallJavascriptFunction("options.ProxyOptions.setNetworkName",
- network);
+ web_ui()->CallJavascriptFunction("options.ProxyOptions.setNetworkName",
+ network);
}
} // namespace options2
diff --git a/chrome/browser/ui/webui/options2/chromeos/stats_options_handler2.cc b/chrome/browser/ui/webui/options2/chromeos/stats_options_handler2.cc
index 838498a..6c376f9 100644
--- a/chrome/browser/ui/webui/options2/chromeos/stats_options_handler2.cc
+++ b/chrome/browser/ui/webui/options2/chromeos/stats_options_handler2.cc
@@ -28,7 +28,7 @@ void StatsOptionsHandler::Initialize() {
// WebUIMessageHandler implementation.
void StatsOptionsHandler::RegisterMessages() {
- web_ui_->RegisterMessageCallback("metricsReportingCheckboxAction",
+ web_ui()->RegisterMessageCallback("metricsReportingCheckboxAction",
base::Bind(&StatsOptionsHandler::HandleMetricsReportingCheckbox,
base::Unretained(this)));
}
diff --git a/chrome/browser/ui/webui/options2/chromeos/system_options_handler2.cc b/chrome/browser/ui/webui/options2/chromeos/system_options_handler2.cc
index 1870e6a..4dbc9b0c 100644
--- a/chrome/browser/ui/webui/options2/chromeos/system_options_handler2.cc
+++ b/chrome/browser/ui/webui/options2/chromeos/system_options_handler2.cc
@@ -129,11 +129,10 @@ void SystemOptionsHandler::GetLocalizedValues(
}
void SystemOptionsHandler::Initialize() {
- DCHECK(web_ui_);
PrefService* pref_service = g_browser_process->local_state();
bool acc_enabled = pref_service->GetBoolean(prefs::kSpokenFeedbackEnabled);
base::FundamentalValue checked(acc_enabled);
- web_ui_->CallJavascriptFunction(
+ web_ui()->CallJavascriptFunction(
"options.SystemOptions.SetAccessibilityCheckboxState", checked);
chromeos::XInputHierarchyChangedEventListener::GetInstance()
@@ -157,28 +156,27 @@ void SystemOptionsHandler::CheckMouseExists() {
void SystemOptionsHandler::TouchpadExists(bool* exists) {
base::FundamentalValue val(*exists);
- web_ui_->CallJavascriptFunction("options.SystemOptions.showTouchpadControls",
- val);
+ web_ui()->CallJavascriptFunction("options.SystemOptions.showTouchpadControls",
+ val);
delete exists;
}
void SystemOptionsHandler::MouseExists(bool* exists) {
base::FundamentalValue val(*exists);
- web_ui_->CallJavascriptFunction("options.SystemOptions.showMouseControls",
- val);
+ web_ui()->CallJavascriptFunction("options.SystemOptions.showMouseControls",
+ val);
delete exists;
}
void SystemOptionsHandler::RegisterMessages() {
- DCHECK(web_ui_);
- web_ui_->RegisterMessageCallback("accessibilityChange",
+ web_ui()->RegisterMessageCallback("accessibilityChange",
base::Bind(&SystemOptionsHandler::AccessibilityChangeCallback,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("decreaseScreenBrightness",
+ web_ui()->RegisterMessageCallback("decreaseScreenBrightness",
base::Bind(&SystemOptionsHandler::DecreaseScreenBrightnessCallback,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("increaseScreenBrightness",
+ web_ui()->RegisterMessageCallback("increaseScreenBrightness",
base::Bind(&SystemOptionsHandler::IncreaseScreenBrightnessCallback,
base::Unretained(this)));
}
diff --git a/chrome/browser/ui/webui/options2/chromeos/virtual_keyboard_manager_handler2.cc b/chrome/browser/ui/webui/options2/chromeos/virtual_keyboard_manager_handler2.cc
index ee09a4f..5b37425 100644
--- a/chrome/browser/ui/webui/options2/chromeos/virtual_keyboard_manager_handler2.cc
+++ b/chrome/browser/ui/webui/options2/chromeos/virtual_keyboard_manager_handler2.cc
@@ -55,28 +55,27 @@ void VirtualKeyboardManagerHandler::GetLocalizedValues(
RegisterTitle(localized_strings, "virtualKeyboardPage",
IDS_OPTIONS_SETTINGS_LANGUAGES_VIRTUAL_KEYBOARD_SETTINGS_TITLE);
- // Do not call GetVirtualKeyboardList() here since |web_ui_| is not ready yet.
+ // Do not call GetVirtualKeyboardList() here since |web_ui()| is not ready
+ // yet.
}
void VirtualKeyboardManagerHandler::Initialize() {
}
void VirtualKeyboardManagerHandler::RegisterMessages() {
- DCHECK(web_ui_);
// Register handler functions for chrome.send().
- web_ui_->RegisterMessageCallback("updateVirtualKeyboardList",
+ web_ui()->RegisterMessageCallback("updateVirtualKeyboardList",
base::Bind(&VirtualKeyboardManagerHandler::UpdateVirtualKeyboardList,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("setVirtualKeyboardPreference",
+ web_ui()->RegisterMessageCallback("setVirtualKeyboardPreference",
base::Bind(&VirtualKeyboardManagerHandler::SetVirtualKeyboardPreference,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("clearVirtualKeyboardPreference",
+ web_ui()->RegisterMessageCallback("clearVirtualKeyboardPreference",
base::Bind(&VirtualKeyboardManagerHandler::ClearVirtualKeyboardPreference,
base::Unretained(this)));
}
ListValue* VirtualKeyboardManagerHandler::GetVirtualKeyboardList() {
- DCHECK(web_ui_);
ime::InputMethodManager* input_method =
ime::InputMethodManager::GetInstance();
@@ -88,7 +87,7 @@ ListValue* VirtualKeyboardManagerHandler::GetVirtualKeyboardList() {
input_method->GetUrlToKeyboardMapping();
// Get the current pref values.
- PrefService* prefs = Profile::FromWebUI(web_ui_)->GetPrefs();
+ PrefService* prefs = Profile::FromWebUI(web_ui())->GetPrefs();
DCHECK(prefs);
const DictionaryValue* virtual_keyboard_pref =
prefs->GetDictionary(prefs::kLanguagePreferredVirtualKeyboard);
@@ -101,13 +100,12 @@ void VirtualKeyboardManagerHandler::UpdateVirtualKeyboardList(
const ListValue* args) {
scoped_ptr<Value> virtual_keyboards(GetVirtualKeyboardList());
DCHECK(virtual_keyboards.get());
- web_ui_->CallJavascriptFunction(
+ web_ui()->CallJavascriptFunction(
"VirtualKeyboardManager.updateVirtualKeyboardList", *virtual_keyboards);
}
void VirtualKeyboardManagerHandler::SetVirtualKeyboardPreference(
const ListValue* args) {
- DCHECK(web_ui_);
std::string layout, url;
if (!args || !args->GetString(0, &layout) || !args->GetString(1, &url)) {
LOG(ERROR) << "SetVirtualKeyboardPreference: Invalid argument";
@@ -123,7 +121,7 @@ void VirtualKeyboardManagerHandler::SetVirtualKeyboardPreference(
return;
}
- PrefService* prefs = Profile::FromWebUI(web_ui_)->GetPrefs();
+ PrefService* prefs = Profile::FromWebUI(web_ui())->GetPrefs();
DCHECK(prefs);
{
DictionaryPrefUpdate updater(
@@ -136,7 +134,6 @@ void VirtualKeyboardManagerHandler::SetVirtualKeyboardPreference(
void VirtualKeyboardManagerHandler::ClearVirtualKeyboardPreference(
const ListValue* args) {
- DCHECK(web_ui_);
std::string layout;
if (!args || !args->GetString(0, &layout)) {
LOG(ERROR) << "ClearVirtualKeyboardPreference: Invalid argument";
@@ -151,7 +148,7 @@ void VirtualKeyboardManagerHandler::ClearVirtualKeyboardPreference(
return;
}
- PrefService* prefs = Profile::FromWebUI(web_ui_)->GetPrefs();
+ PrefService* prefs = Profile::FromWebUI(web_ui())->GetPrefs();
DCHECK(prefs);
{
DictionaryPrefUpdate updater(
diff --git a/chrome/browser/ui/webui/options2/clear_browser_data_handler2.cc b/chrome/browser/ui/webui/options2/clear_browser_data_handler2.cc
index 5fb263c..d6bb121 100644
--- a/chrome/browser/ui/webui/options2/clear_browser_data_handler2.cc
+++ b/chrome/browser/ui/webui/options2/clear_browser_data_handler2.cc
@@ -31,7 +31,7 @@ ClearBrowserDataHandler::~ClearBrowserDataHandler() {
void ClearBrowserDataHandler::Initialize() {
clear_plugin_lso_data_enabled_.Init(prefs::kClearPluginLSODataEnabled,
- Profile::FromWebUI(web_ui_)->GetPrefs(),
+ Profile::FromWebUI(web_ui())->GetPrefs(),
NULL);
}
@@ -88,14 +88,13 @@ void ClearBrowserDataHandler::GetLocalizedValues(
void ClearBrowserDataHandler::RegisterMessages() {
// Setup handlers specific to this panel.
- DCHECK(web_ui_);
- web_ui_->RegisterMessageCallback("performClearBrowserData",
+ web_ui()->RegisterMessageCallback("performClearBrowserData",
base::Bind(&ClearBrowserDataHandler::HandleClearBrowserData,
base::Unretained(this)));
}
void ClearBrowserDataHandler::HandleClearBrowserData(const ListValue* value) {
- Profile* profile = Profile::FromWebUI(web_ui_);
+ Profile* profile = Profile::FromWebUI(web_ui());
PrefService* prefs = profile->GetPrefs();
int remove_mask = 0;
@@ -120,8 +119,8 @@ void ClearBrowserDataHandler::HandleClearBrowserData(const ListValue* value) {
int period_selected = prefs->GetInteger(prefs::kDeleteTimePeriod);
base::FundamentalValue state(true);
- web_ui_->CallJavascriptFunction("ClearBrowserDataOverlay.setClearingState",
- state);
+ web_ui()->CallJavascriptFunction("ClearBrowserDataOverlay.setClearingState",
+ state);
// If we are still observing a previous data remover, we need to stop
// observing.
@@ -140,8 +139,7 @@ void ClearBrowserDataHandler::OnBrowsingDataRemoverDone() {
// No need to remove ourselves as an observer as BrowsingDataRemover deletes
// itself after we return.
remover_ = NULL;
- DCHECK(web_ui_);
- web_ui_->CallJavascriptFunction("ClearBrowserDataOverlay.doneClearing");
+ web_ui()->CallJavascriptFunction("ClearBrowserDataOverlay.doneClearing");
}
} // namespace options2
diff --git a/chrome/browser/ui/webui/options2/content_settings_handler2.cc b/chrome/browser/ui/webui/options2/content_settings_handler2.cc
index 888be18..4f8b5fb 100644
--- a/chrome/browser/ui/webui/options2/content_settings_handler2.cc
+++ b/chrome/browser/ui/webui/options2/content_settings_handler2.cc
@@ -306,7 +306,7 @@ void ContentSettingsHandler::Initialize() {
notification_registrar_.Add(
this, chrome::NOTIFICATION_DESKTOP_NOTIFICATION_SETTINGS_CHANGED,
content::NotificationService::AllSources());
- Profile* profile = Profile::FromWebUI(web_ui_);
+ Profile* profile = Profile::FromWebUI(web_ui());
notification_registrar_.Add(
this, chrome::NOTIFICATION_PROTOCOL_HANDLER_REGISTRY_CHANGED,
content::Source<Profile>(profile));
@@ -323,7 +323,7 @@ void ContentSettingsHandler::Observe(
switch (type) {
case chrome::NOTIFICATION_PROFILE_DESTROYED: {
if (content::Source<Profile>(source).ptr()->IsOffTheRecord()) {
- web_ui_->CallJavascriptFunction(
+ web_ui()->CallJavascriptFunction(
"ContentSettingsExceptionsArea.OTRProfileDestroyed");
}
break;
@@ -387,13 +387,13 @@ void ContentSettingsHandler::UpdateSettingDefaultFromModel(
ContentSettingsTypeToGroupName(type) + ".managedBy",
provider_id);
- web_ui_->CallJavascriptFunction(
+ web_ui()->CallJavascriptFunction(
"ContentSettings.setContentFilterSettingsValue", filter_settings);
}
std::string ContentSettingsHandler::GetSettingDefaultFromModel(
ContentSettingsType type, std::string* provider_id) {
- Profile* profile = Profile::FromWebUI(web_ui_);
+ Profile* profile = Profile::FromWebUI(web_ui());
ContentSetting default_setting;
if (type == CONTENT_SETTINGS_TYPE_NOTIFICATIONS) {
default_setting =
@@ -410,11 +410,11 @@ std::string ContentSettingsHandler::GetSettingDefaultFromModel(
void ContentSettingsHandler::UpdateHandlersEnabledRadios() {
#if defined(ENABLE_REGISTER_PROTOCOL_HANDLER)
- DCHECK(web_ui_);
base::FundamentalValue handlers_enabled(
GetProtocolHandlerRegistry()->enabled());
- web_ui_->CallJavascriptFunction("ContentSettings.updateHandlersEnabledRadios",
+ web_ui()->CallJavascriptFunction(
+ "ContentSettings.updateHandlersEnabledRadios",
handlers_enabled);
#endif // defined(ENABLE_REGISTER_PROTOCOL_HANDLER)
}
@@ -474,7 +474,7 @@ void ContentSettingsHandler::UpdateOTRExceptionsViewFromModel(
}
void ContentSettingsHandler::UpdateGeolocationExceptionsView() {
- Profile* profile = Profile::FromWebUI(web_ui_);
+ Profile* profile = Profile::FromWebUI(web_ui());
HostContentSettingsMap* map = profile->GetHostContentSettingsMap();
ContentSettingsForOneType all_settings;
@@ -531,8 +531,8 @@ void ContentSettingsHandler::UpdateGeolocationExceptionsView() {
StringValue type_string(
ContentSettingsTypeToGroupName(CONTENT_SETTINGS_TYPE_GEOLOCATION));
- web_ui_->CallJavascriptFunction("ContentSettings.setExceptions",
- type_string, exceptions);
+ web_ui()->CallJavascriptFunction("ContentSettings.setExceptions",
+ type_string, exceptions);
// This is mainly here to keep this function ideologically parallel to
// UpdateExceptionsViewFromHostContentSettingsMap().
@@ -540,7 +540,7 @@ void ContentSettingsHandler::UpdateGeolocationExceptionsView() {
}
void ContentSettingsHandler::UpdateNotificationExceptionsView() {
- Profile* profile = Profile::FromWebUI(web_ui_);
+ Profile* profile = Profile::FromWebUI(web_ui());
DesktopNotificationService* service =
DesktopNotificationServiceFactory::GetForProfile(profile);
@@ -566,8 +566,8 @@ void ContentSettingsHandler::UpdateNotificationExceptionsView() {
StringValue type_string(
ContentSettingsTypeToGroupName(CONTENT_SETTINGS_TYPE_NOTIFICATIONS));
- web_ui_->CallJavascriptFunction("ContentSettings.setExceptions",
- type_string, exceptions);
+ web_ui()->CallJavascriptFunction("ContentSettings.setExceptions",
+ type_string, exceptions);
// This is mainly here to keep this function ideologically parallel to
// UpdateExceptionsViewFromHostContentSettingsMap().
@@ -605,8 +605,8 @@ void ContentSettingsHandler::UpdateExceptionsViewFromHostContentSettingsMap(
}
StringValue type_string(ContentSettingsTypeToGroupName(type));
- web_ui_->CallJavascriptFunction("ContentSettings.setExceptions", type_string,
- exceptions);
+ web_ui()->CallJavascriptFunction("ContentSettings.setExceptions", type_string,
+ exceptions);
UpdateExceptionsViewFromOTRHostContentSettingsMap(type);
@@ -655,21 +655,21 @@ void ContentSettingsHandler::UpdateExceptionsViewFromOTRHostContentSettingsMap(
}
StringValue type_string(ContentSettingsTypeToGroupName(type));
- web_ui_->CallJavascriptFunction("ContentSettings.setOTRExceptions",
- type_string, otr_exceptions);
+ web_ui()->CallJavascriptFunction("ContentSettings.setOTRExceptions",
+ type_string, otr_exceptions);
}
void ContentSettingsHandler::RegisterMessages() {
- web_ui_->RegisterMessageCallback("setContentFilter",
+ web_ui()->RegisterMessageCallback("setContentFilter",
base::Bind(&ContentSettingsHandler::SetContentFilter,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("removeException",
+ web_ui()->RegisterMessageCallback("removeException",
base::Bind(&ContentSettingsHandler::RemoveException,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("setException",
+ web_ui()->RegisterMessageCallback("setException",
base::Bind(&ContentSettingsHandler::SetException,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("checkExceptionPatternValidity",
+ web_ui()->RegisterMessageCallback("checkExceptionPatternValidity",
base::Bind(&ContentSettingsHandler::CheckExceptionPatternValidity,
base::Unretained(this)));
}
@@ -686,7 +686,7 @@ void ContentSettingsHandler::SetContentFilter(const ListValue* args) {
ContentSetting default_setting = ContentSettingFromString(setting);
ContentSettingsType content_type = ContentSettingsTypeFromGroupName(group);
if (content_type == CONTENT_SETTINGS_TYPE_NOTIFICATIONS) {
- Profile* profile = Profile::FromWebUI(web_ui_);
+ Profile* profile = Profile::FromWebUI(web_ui());
DesktopNotificationServiceFactory::GetForProfile(profile)->
SetDefaultContentSetting(default_setting);
} else {
@@ -740,7 +740,7 @@ void ContentSettingsHandler::RemoveException(const ListValue* args) {
std::string type_string;
CHECK(args->GetString(arg_i++, &type_string));
- Profile* profile = Profile::FromWebUI(web_ui_);
+ Profile* profile = Profile::FromWebUI(web_ui());
ContentSettingsType type = ContentSettingsTypeFromGroupName(type_string);
if (type == CONTENT_SETTINGS_TYPE_GEOLOCATION) {
std::string origin;
@@ -844,7 +844,7 @@ void ContentSettingsHandler::CheckExceptionPatternValidity(
scoped_ptr<Value> pattern_value(Value::CreateStringValue(pattern_string));
scoped_ptr<Value> valid_value(Value::CreateBooleanValue(pattern.IsValid()));
- web_ui_->CallJavascriptFunction(
+ web_ui()->CallJavascriptFunction(
"ContentSettings.patternValidityCheckComplete",
*type,
*mode_value.get(),
@@ -865,16 +865,16 @@ std::string ContentSettingsHandler::ContentSettingsTypeToGroupName(
}
HostContentSettingsMap* ContentSettingsHandler::GetContentSettingsMap() {
- return Profile::FromWebUI(web_ui_)->GetHostContentSettingsMap();
+ return Profile::FromWebUI(web_ui())->GetHostContentSettingsMap();
}
ProtocolHandlerRegistry* ContentSettingsHandler::GetProtocolHandlerRegistry() {
- return Profile::FromWebUI(web_ui_)->GetProtocolHandlerRegistry();
+ return Profile::FromWebUI(web_ui())->GetProtocolHandlerRegistry();
}
HostContentSettingsMap*
ContentSettingsHandler::GetOTRContentSettingsMap() {
- Profile* profile = Profile::FromWebUI(web_ui_);
+ Profile* profile = Profile::FromWebUI(web_ui());
if (profile->HasOffTheRecordProfile())
return profile->GetOffTheRecordProfile()->GetHostContentSettingsMap();
return NULL;
diff --git a/chrome/browser/ui/webui/options2/cookies_view_handler2.cc b/chrome/browser/ui/webui/options2/cookies_view_handler2.cc
index 8375ed4..63dfc1d 100644
--- a/chrome/browser/ui/webui/options2/cookies_view_handler2.cc
+++ b/chrome/browser/ui/webui/options2/cookies_view_handler2.cc
@@ -80,16 +80,16 @@ void CookiesViewHandler::GetLocalizedValues(
}
void CookiesViewHandler::RegisterMessages() {
- web_ui_->RegisterMessageCallback("updateCookieSearchResults",
+ web_ui()->RegisterMessageCallback("updateCookieSearchResults",
base::Bind(&CookiesViewHandler::UpdateSearchResults,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("removeAllCookies",
+ web_ui()->RegisterMessageCallback("removeAllCookies",
base::Bind(&CookiesViewHandler::RemoveAll,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("removeCookie",
+ web_ui()->RegisterMessageCallback("removeCookie",
base::Bind(&CookiesViewHandler::Remove,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("loadCookie",
+ web_ui()->RegisterMessageCallback("loadCookie",
base::Bind(&CookiesViewHandler::LoadChildren,
base::Unretained(this)));
}
@@ -115,7 +115,7 @@ void CookiesViewHandler::TreeNodesAdded(ui::TreeModel* model,
cookies_tree_model_util::GetTreeNodeId(parent_node)));
args.Append(Value::CreateIntegerValue(start));
args.Append(children);
- web_ui_->CallJavascriptFunction("CookiesView.onTreeItemAdded", args);
+ web_ui()->CallJavascriptFunction("CookiesView.onTreeItemAdded", args);
}
void CookiesViewHandler::TreeNodesRemoved(ui::TreeModel* model,
@@ -133,7 +133,7 @@ void CookiesViewHandler::TreeNodesRemoved(ui::TreeModel* model,
cookies_tree_model_->AsNode(parent))));
args.Append(Value::CreateIntegerValue(start));
args.Append(Value::CreateIntegerValue(count));
- web_ui_->CallJavascriptFunction("CookiesView.onTreeItemRemoved", args);
+ web_ui()->CallJavascriptFunction("CookiesView.onTreeItemRemoved", args);
}
void CookiesViewHandler::TreeModelBeginBatch(CookiesTreeModel* model) {
@@ -150,7 +150,7 @@ void CookiesViewHandler::TreeModelEndBatch(CookiesTreeModel* model) {
void CookiesViewHandler::EnsureCookiesTreeModelCreated() {
if (!cookies_tree_model_.get()) {
- Profile* profile = Profile::FromWebUI(web_ui_);
+ Profile* profile = Profile::FromWebUI(web_ui());
cookies_tree_model_.reset(new CookiesTreeModel(
new BrowsingDataCookieHelper(profile),
new BrowsingDataDatabaseHelper(profile),
@@ -220,7 +220,7 @@ void CookiesViewHandler::SendChildren(CookieTreeNode* parent) {
Value::CreateStringValue(cookies_tree_model_util::GetTreeNodeId(parent)));
args.Append(children);
- web_ui_->CallJavascriptFunction("CookiesView.loadChildren", args);
+ web_ui()->CallJavascriptFunction("CookiesView.loadChildren", args);
}
} // namespace options2
diff --git a/chrome/browser/ui/webui/options2/core_options_handler2.cc b/chrome/browser/ui/webui/options2/core_options_handler2.cc
index 9e0fc25..8fe2afc 100644
--- a/chrome/browser/ui/webui/options2/core_options_handler2.cc
+++ b/chrome/browser/ui/webui/options2/core_options_handler2.cc
@@ -41,7 +41,7 @@ CoreOptionsHandler::~CoreOptionsHandler() {}
void CoreOptionsHandler::Initialize() {
clear_plugin_lso_data_enabled_.Init(prefs::kClearPluginLSODataEnabled,
- Profile::FromWebUI(web_ui_),
+ Profile::FromWebUI(web_ui()),
this);
UpdateClearPluginLSOData();
}
@@ -115,13 +115,6 @@ void CoreOptionsHandler::Uninitialize() {
}
}
-WebUIMessageHandler* CoreOptionsHandler::Attach(WebUI* web_ui) {
- WebUIMessageHandler* result = WebUIMessageHandler::Attach(web_ui);
- DCHECK(web_ui_);
- registrar_.Init(Profile::FromWebUI(web_ui_)->GetPrefs());
- return result;
-}
-
void CoreOptionsHandler::Observe(int type,
const content::NotificationSource& source,
const content::NotificationDetails& details) {
@@ -137,37 +130,39 @@ void CoreOptionsHandler::Observe(int type,
}
void CoreOptionsHandler::RegisterMessages() {
- web_ui_->RegisterMessageCallback("coreOptionsInitialize",
+ registrar_.Init(Profile::FromWebUI(web_ui())->GetPrefs());
+
+ web_ui()->RegisterMessageCallback("coreOptionsInitialize",
base::Bind(&CoreOptionsHandler::HandleInitialize,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("fetchPrefs",
+ web_ui()->RegisterMessageCallback("fetchPrefs",
base::Bind(&CoreOptionsHandler::HandleFetchPrefs,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("observePrefs",
+ web_ui()->RegisterMessageCallback("observePrefs",
base::Bind(&CoreOptionsHandler::HandleObservePrefs,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("setBooleanPref",
+ web_ui()->RegisterMessageCallback("setBooleanPref",
base::Bind(&CoreOptionsHandler::HandleSetBooleanPref,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("setIntegerPref",
+ web_ui()->RegisterMessageCallback("setIntegerPref",
base::Bind(&CoreOptionsHandler::HandleSetIntegerPref,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("setDoublePref",
+ web_ui()->RegisterMessageCallback("setDoublePref",
base::Bind(&CoreOptionsHandler::HandleSetDoublePref,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("setStringPref",
+ web_ui()->RegisterMessageCallback("setStringPref",
base::Bind(&CoreOptionsHandler::HandleSetStringPref,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("setURLPref",
+ web_ui()->RegisterMessageCallback("setURLPref",
base::Bind(&CoreOptionsHandler::HandleSetURLPref,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("setListPref",
+ web_ui()->RegisterMessageCallback("setListPref",
base::Bind(&CoreOptionsHandler::HandleSetListPref,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("clearPref",
+ web_ui()->RegisterMessageCallback("clearPref",
base::Bind(&CoreOptionsHandler::HandleClearPref,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("coreOptionsUserMetricsAction",
+ web_ui()->RegisterMessageCallback("coreOptionsUserMetricsAction",
base::Bind(&CoreOptionsHandler::HandleUserMetricsAction,
base::Unretained(this)));
}
@@ -178,7 +173,7 @@ void CoreOptionsHandler::HandleInitialize(const ListValue* args) {
}
base::Value* CoreOptionsHandler::FetchPref(const std::string& pref_name) {
- PrefService* pref_service = Profile::FromWebUI(web_ui_)->GetPrefs();
+ PrefService* pref_service = Profile::FromWebUI(web_ui())->GetPrefs();
const PrefService::Preference* pref =
pref_service->FindPreference(pref_name.c_str());
@@ -195,7 +190,7 @@ void CoreOptionsHandler::ObservePref(const std::string& pref_name) {
void CoreOptionsHandler::SetPref(const std::string& pref_name,
const base::Value* value,
const std::string& metric) {
- PrefService* pref_service = Profile::FromWebUI(web_ui_)->GetPrefs();
+ PrefService* pref_service = Profile::FromWebUI(web_ui())->GetPrefs();
switch (value->GetType()) {
case base::Value::TYPE_BOOLEAN:
@@ -215,7 +210,7 @@ void CoreOptionsHandler::SetPref(const std::string& pref_name,
void CoreOptionsHandler::ClearPref(const std::string& pref_name,
const std::string& metric) {
- PrefService* pref_service = Profile::FromWebUI(web_ui_)->GetPrefs();
+ PrefService* pref_service = Profile::FromWebUI(web_ui())->GetPrefs();
pref_service->ClearPref(pref_name.c_str());
if (!metric.empty())
@@ -240,7 +235,7 @@ void CoreOptionsHandler::ProcessUserMetric(const base::Value* value,
void CoreOptionsHandler::NotifyPrefChanged(
const std::string& pref_name,
const std::string& controlling_pref_name) {
- const PrefService* pref_service = Profile::FromWebUI(web_ui_)->GetPrefs();
+ const PrefService* pref_service = Profile::FromWebUI(web_ui())->GetPrefs();
const PrefService::Preference* pref =
pref_service->FindPreference(pref_name.c_str());
if (!pref)
@@ -257,8 +252,8 @@ void CoreOptionsHandler::NotifyPrefChanged(
ListValue result_value;
result_value.Append(base::Value::CreateStringValue(pref_name.c_str()));
result_value.Append(CreateValueForPref(pref, controlling_pref));
- web_ui_->CallJavascriptFunction(WideToASCII(callback_function),
- result_value);
+ web_ui()->CallJavascriptFunction(WideToASCII(callback_function),
+ result_value);
}
}
@@ -315,8 +310,8 @@ void CoreOptionsHandler::HandleFetchPrefs(const ListValue* args) {
result_value.Set(pref_name.c_str(), FetchPref(pref_name));
}
- web_ui_->CallJavascriptFunction(UTF16ToASCII(callback_function),
- result_value);
+ web_ui()->CallJavascriptFunction(UTF16ToASCII(callback_function),
+ result_value);
}
void CoreOptionsHandler::HandleObservePrefs(const ListValue* args) {
@@ -462,7 +457,7 @@ void CoreOptionsHandler::UpdateClearPluginLSOData() {
scoped_ptr<base::Value> enabled(
base::Value::CreateBooleanValue(
clear_plugin_lso_data_enabled_.GetValue()));
- web_ui_->CallJavascriptFunction(
+ web_ui()->CallJavascriptFunction(
"OptionsPage.setClearPluginLSODataEnabled", *enabled);
}
diff --git a/chrome/browser/ui/webui/options2/core_options_handler2.h b/chrome/browser/ui/webui/options2/core_options_handler2.h
index 4f0fb97..2ba6314 100644
--- a/chrome/browser/ui/webui/options2/core_options_handler2.h
+++ b/chrome/browser/ui/webui/options2/core_options_handler2.h
@@ -36,7 +36,6 @@ class CoreOptionsHandler : public OptionsPageUIHandler {
// WebUIMessageHandler implementation.
virtual void RegisterMessages() OVERRIDE;
- virtual WebUIMessageHandler* Attach(WebUI* web_ui) OVERRIDE;
void set_handlers_host(OptionsPageUIHandlerHost* handlers_host) {
handlers_host_ = handlers_host;
diff --git a/chrome/browser/ui/webui/options2/font_settings_handler2.cc b/chrome/browser/ui/webui/options2/font_settings_handler2.cc
index 8122a63..7875f7a 100644
--- a/chrome/browser/ui/webui/options2/font_settings_handler2.cc
+++ b/chrome/browser/ui/webui/options2/font_settings_handler2.cc
@@ -67,7 +67,7 @@ void FontSettingsHandler::GetLocalizedValues(
}
void FontSettingsHandler::Initialize() {
- DCHECK(web_ui_);
+ DCHECK(web_ui());
SetUpStandardFontSample();
SetUpSerifFontSample();
SetUpSansSerifFontSample();
@@ -75,13 +75,9 @@ void FontSettingsHandler::Initialize() {
SetUpMinimumFontSample();
}
-WebUIMessageHandler* FontSettingsHandler::Attach(WebUI* web_ui) {
- // Call through to superclass.
- WebUIMessageHandler* handler = OptionsPageUIHandler::Attach(web_ui);
-
+void FontSettingsHandler::RegisterMessages() {
// Perform validation for saved fonts.
- DCHECK(web_ui_);
- PrefService* pref_service = Profile::FromWebUI(web_ui_)->GetPrefs();
+ PrefService* pref_service = Profile::FromWebUI(web_ui())->GetPrefs();
FontSettingsUtilities::ValidateSavedFonts(pref_service);
// Register for preferences that we need to observe manually.
@@ -95,12 +91,7 @@ WebUIMessageHandler* FontSettingsHandler::Attach(WebUI* web_ui) {
pref_service, this);
minimum_font_size_.Init(prefs::kWebKitMinimumFontSize, pref_service, this);
- // Return result from the superclass.
- return handler;
-}
-
-void FontSettingsHandler::RegisterMessages() {
- web_ui_->RegisterMessageCallback("fetchFontsData",
+ web_ui()->RegisterMessageCallback("fetchFontsData",
base::Bind(&FontSettingsHandler::HandleFetchFontsData,
base::Unretained(this)));
}
@@ -115,7 +106,7 @@ void FontSettingsHandler::FontsListHasLoaded(
scoped_refptr<content::FontListResult> list) {
ListValue encoding_list;
const std::vector<CharacterEncoding::EncodingInfo>* encodings;
- PrefService* pref_service = Profile::FromWebUI(web_ui_)->GetPrefs();
+ PrefService* pref_service = Profile::FromWebUI(web_ui())->GetPrefs();
encodings = CharacterEncoding::GetCurrentDisplayEncodings(
g_browser_process->GetApplicationLocale(),
pref_service->GetString(prefs::kStaticEncodings),
@@ -149,9 +140,9 @@ void FontSettingsHandler::FontsListHasLoaded(
selected_values.Append(Value::CreateStringValue(fixed_font_.GetValue()));
selected_values.Append(Value::CreateStringValue(font_encoding_.GetValue()));
- web_ui_->CallJavascriptFunction("FontSettings.setFontsData",
- *list->list.get(), encoding_list,
- selected_values);
+ web_ui()->CallJavascriptFunction("FontSettings.setFontsData",
+ *list->list.get(), encoding_list,
+ selected_values);
}
void FontSettingsHandler::Observe(int type,
@@ -181,35 +172,35 @@ void FontSettingsHandler::Observe(int type,
void FontSettingsHandler::SetUpStandardFontSample() {
base::StringValue font_value(standard_font_.GetValue());
base::FundamentalValue size_value(default_font_size_.GetValue());
- web_ui_->CallJavascriptFunction(
+ web_ui()->CallJavascriptFunction(
"FontSettings.setUpStandardFontSample", font_value, size_value);
}
void FontSettingsHandler::SetUpSerifFontSample() {
base::StringValue font_value(serif_font_.GetValue());
base::FundamentalValue size_value(default_font_size_.GetValue());
- web_ui_->CallJavascriptFunction(
+ web_ui()->CallJavascriptFunction(
"FontSettings.setUpSerifFontSample", font_value, size_value);
}
void FontSettingsHandler::SetUpSansSerifFontSample() {
base::StringValue font_value(sans_serif_font_.GetValue());
base::FundamentalValue size_value(default_font_size_.GetValue());
- web_ui_->CallJavascriptFunction(
+ web_ui()->CallJavascriptFunction(
"FontSettings.setUpSansSerifFontSample", font_value, size_value);
}
void FontSettingsHandler::SetUpFixedFontSample() {
base::StringValue font_value(fixed_font_.GetValue());
base::FundamentalValue size_value(default_fixed_font_size_.GetValue());
- web_ui_->CallJavascriptFunction(
+ web_ui()->CallJavascriptFunction(
"FontSettings.setUpFixedFontSample", font_value, size_value);
}
void FontSettingsHandler::SetUpMinimumFontSample() {
base::FundamentalValue size_value(minimum_font_size_.GetValue());
- web_ui_->CallJavascriptFunction("FontSettings.setUpMinimumFontSample",
- size_value);
+ web_ui()->CallJavascriptFunction("FontSettings.setUpMinimumFontSample",
+ size_value);
}
} // namespace options2
diff --git a/chrome/browser/ui/webui/options2/font_settings_handler2.h b/chrome/browser/ui/webui/options2/font_settings_handler2.h
index e93ab58..243486e 100644
--- a/chrome/browser/ui/webui/options2/font_settings_handler2.h
+++ b/chrome/browser/ui/webui/options2/font_settings_handler2.h
@@ -23,7 +23,6 @@ class FontSettingsHandler : public OptionsPageUIHandler {
virtual void Initialize() OVERRIDE;
// WebUIMessageHandler implementation.
- virtual WebUIMessageHandler* Attach(WebUI* web_ui) OVERRIDE;
virtual void RegisterMessages() OVERRIDE;
// content::NotificationObserver implementation.
diff --git a/chrome/browser/ui/webui/options2/handler_options_handler2.cc b/chrome/browser/ui/webui/options2/handler_options_handler2.cc
index 141e840..484f286 100644
--- a/chrome/browser/ui/webui/options2/handler_options_handler2.cc
+++ b/chrome/browser/ui/webui/options2/handler_options_handler2.cc
@@ -48,31 +48,29 @@ void HandlerOptionsHandler::Initialize() {
UpdateHandlerList();
notification_registrar_.Add(
this, chrome::NOTIFICATION_PROTOCOL_HANDLER_REGISTRY_CHANGED,
- content::Source<Profile>(Profile::FromWebUI(web_ui_)));
+ content::Source<Profile>(Profile::FromWebUI(web_ui())));
}
void HandlerOptionsHandler::RegisterMessages() {
- DCHECK(web_ui_);
- web_ui_->RegisterMessageCallback("clearDefault",
+ web_ui()->RegisterMessageCallback("clearDefault",
base::Bind(&HandlerOptionsHandler::ClearDefault,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("removeHandler",
+ web_ui()->RegisterMessageCallback("removeHandler",
base::Bind(&HandlerOptionsHandler::RemoveHandler,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("setHandlersEnabled",
+ web_ui()->RegisterMessageCallback("setHandlersEnabled",
base::Bind(&HandlerOptionsHandler::SetHandlersEnabled,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("setDefault",
+ web_ui()->RegisterMessageCallback("setDefault",
base::Bind(&HandlerOptionsHandler::SetDefault,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("removeIgnoredHandler",
+ web_ui()->RegisterMessageCallback("removeIgnoredHandler",
base::Bind(&HandlerOptionsHandler::RemoveIgnoredHandler,
base::Unretained(this)));
}
ProtocolHandlerRegistry* HandlerOptionsHandler::GetProtocolHandlerRegistry() {
- DCHECK(web_ui_);
- return Profile::FromWebUI(web_ui_)->GetProtocolHandlerRegistry();
+ return Profile::FromWebUI(web_ui())->GetProtocolHandlerRegistry();
}
static void GetHandlersAsListValue(
@@ -124,9 +122,9 @@ void HandlerOptionsHandler::UpdateHandlerList() {
scoped_ptr<ListValue> ignored_handlers(new ListValue());
GetIgnoredHandlers(ignored_handlers.get());
- web_ui_->CallJavascriptFunction("HandlerOptions.setHandlers", handlers);
- web_ui_->CallJavascriptFunction("HandlerOptions.setIgnoredHandlers",
- *ignored_handlers);
+ web_ui()->CallJavascriptFunction("HandlerOptions.setHandlers", handlers);
+ web_ui()->CallJavascriptFunction("HandlerOptions.setIgnoredHandlers",
+ *ignored_handlers);
#endif // defined(ENABLE_REGISTER_PROTOCOL_HANDLER)
}
diff --git a/chrome/browser/ui/webui/options2/import_data_handler2.cc b/chrome/browser/ui/webui/options2/import_data_handler2.cc
index 5e5b22b..3cad73c 100644
--- a/chrome/browser/ui/webui/options2/import_data_handler2.cc
+++ b/chrome/browser/ui/webui/options2/import_data_handler2.cc
@@ -61,13 +61,13 @@ void ImportDataHandler::GetLocalizedValues(DictionaryValue* localized_strings) {
}
void ImportDataHandler::Initialize() {
- Profile* profile = Profile::FromWebUI(web_ui_);
+ Profile* profile = Profile::FromWebUI(web_ui());
importer_list_ = new ImporterList(profile->GetRequestContext());
importer_list_->DetectSourceProfiles(this);
}
void ImportDataHandler::RegisterMessages() {
- web_ui_->RegisterMessageCallback("importData",
+ web_ui()->RegisterMessageCallback("importData",
base::Bind(&ImportDataHandler::ImportData, base::Unretained(this)));
}
@@ -102,8 +102,8 @@ void ImportDataHandler::ImportData(const ListValue* args) {
uint16 import_services = (selected_items & supported_items);
if (import_services) {
base::FundamentalValue state(true);
- web_ui_->CallJavascriptFunction("ImportDataOverlay.setImportingState",
- state);
+ web_ui()->CallJavascriptFunction("ImportDataOverlay.setImportingState",
+ state);
import_did_succeed_ = false;
// TODO(csilv): Out-of-process import has only been qualified on MacOS X,
@@ -116,7 +116,7 @@ void ImportDataHandler::ImportData(const ListValue* args) {
importer_host_ = new ImporterHost;
#endif
importer_host_->SetObserver(this);
- Profile* profile = Profile::FromWebUI(web_ui_);
+ Profile* profile = Profile::FromWebUI(web_ui());
importer_host_->StartImportSettings(source_profile, profile,
import_services,
new ProfileWriter(profile), false);
@@ -148,8 +148,8 @@ void ImportDataHandler::OnSourceProfilesLoaded() {
browser_profiles.Append(browser_profile);
}
- web_ui_->CallJavascriptFunction("ImportDataOverlay.updateSupportedBrowsers",
- browser_profiles);
+ web_ui()->CallJavascriptFunction("ImportDataOverlay.updateSupportedBrowsers",
+ browser_profiles);
}
void ImportDataHandler::ImportStarted() {
@@ -169,12 +169,12 @@ void ImportDataHandler::ImportEnded() {
importer_host_ = NULL;
if (import_did_succeed_) {
- web_ui_->CallJavascriptFunction("ImportDataOverlay.confirmSuccess");
+ web_ui()->CallJavascriptFunction("ImportDataOverlay.confirmSuccess");
} else {
base::FundamentalValue state(false);
- web_ui_->CallJavascriptFunction("ImportDataOverlay.setImportingState",
- state);
- web_ui_->CallJavascriptFunction("ImportDataOverlay.dismiss");
+ web_ui()->CallJavascriptFunction("ImportDataOverlay.setImportingState",
+ state);
+ web_ui()->CallJavascriptFunction("ImportDataOverlay.dismiss");
}
}
diff --git a/chrome/browser/ui/webui/options2/language_options_handler2.cc b/chrome/browser/ui/webui/options2/language_options_handler2.cc
index 8269191..6f47589 100644
--- a/chrome/browser/ui/webui/options2/language_options_handler2.cc
+++ b/chrome/browser/ui/webui/options2/language_options_handler2.cc
@@ -50,7 +50,7 @@ void LanguageOptionsHandler::GetLocalizedValues(
void LanguageOptionsHandler::RegisterMessages() {
LanguageOptionsHandlerCommon::RegisterMessages();
- web_ui_->RegisterMessageCallback("uiLanguageRestart",
+ web_ui()->RegisterMessageCallback("uiLanguageRestart",
base::Bind(&LanguageOptionsHandler::RestartCallback,
base::Unretained(this)));
}
diff --git a/chrome/browser/ui/webui/options2/language_options_handler_common2.cc b/chrome/browser/ui/webui/options2/language_options_handler_common2.cc
index 341b1a9..8fe816d 100644
--- a/chrome/browser/ui/webui/options2/language_options_handler_common2.cc
+++ b/chrome/browser/ui/webui/options2/language_options_handler_common2.cc
@@ -109,16 +109,15 @@ void LanguageOptionsHandlerCommon::GetLocalizedValues(
}
void LanguageOptionsHandlerCommon::RegisterMessages() {
- DCHECK(web_ui_);
- web_ui_->RegisterMessageCallback("languageOptionsOpen",
+ web_ui()->RegisterMessageCallback("languageOptionsOpen",
base::Bind(
&LanguageOptionsHandlerCommon::LanguageOptionsOpenCallback,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("spellCheckLanguageChange",
+ web_ui()->RegisterMessageCallback("spellCheckLanguageChange",
base::Bind(
&LanguageOptionsHandlerCommon::SpellCheckLanguageChangeCallback,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("uiLanguageChange",
+ web_ui()->RegisterMessageCallback("uiLanguageChange",
base::Bind(
&LanguageOptionsHandlerCommon::UiLanguageChangeCallback,
base::Unretained(this)));
@@ -157,7 +156,7 @@ void LanguageOptionsHandlerCommon::UiLanguageChangeCallback(
"LanguageOptions_UiLanguageChange_%s", language_code.c_str());
content::RecordComputedAction(action);
SetApplicationLocale(language_code);
- web_ui_->CallJavascriptFunction("options.LanguageOptions.uiLanguageSaved");
+ web_ui()->CallJavascriptFunction("options.LanguageOptions.uiLanguageSaved");
}
void LanguageOptionsHandlerCommon::SpellCheckLanguageChangeCallback(
diff --git a/chrome/browser/ui/webui/options2/manage_profile_handler2.cc b/chrome/browser/ui/webui/options2/manage_profile_handler2.cc
index ada5fb9..1ba7740 100644
--- a/chrome/browser/ui/webui/options2/manage_profile_handler2.cc
+++ b/chrome/browser/ui/webui/options2/manage_profile_handler2.cc
@@ -55,19 +55,19 @@ void ManageProfileHandler::Initialize() {
}
void ManageProfileHandler::RegisterMessages() {
- web_ui_->RegisterMessageCallback("setProfileNameAndIcon",
+ web_ui()->RegisterMessageCallback("setProfileNameAndIcon",
base::Bind(&ManageProfileHandler::SetProfileNameAndIcon,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("deleteProfile",
+ web_ui()->RegisterMessageCallback("deleteProfile",
base::Bind(&ManageProfileHandler::DeleteProfile,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("requestDefaultProfileIcons",
+ web_ui()->RegisterMessageCallback("requestDefaultProfileIcons",
base::Bind(&ManageProfileHandler::RequestDefaultProfileIcons,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("requestProfileInfo",
+ web_ui()->RegisterMessageCallback("requestProfileInfo",
base::Bind(&ManageProfileHandler::RequestProfileInfo,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("profileIconSelectionChanged",
+ web_ui()->RegisterMessageCallback("profileIconSelectionChanged",
base::Bind(&ManageProfileHandler::ProfileIconSelectionChanged,
base::Unretained(this)));
}
@@ -94,7 +94,7 @@ void ManageProfileHandler::SendProfileIcons() {
// First add the GAIA picture if it's available.
ProfileInfoCache& cache =
g_browser_process->profile_manager()->GetProfileInfoCache();
- Profile* profile = Profile::FromWebUI(web_ui_);
+ Profile* profile = Profile::FromWebUI(web_ui());
size_t profile_index = cache.GetIndexOfProfileWithPath(profile->GetPath());
if (profile_index != std::string::npos) {
const gfx::Image* icon =
@@ -112,7 +112,7 @@ void ManageProfileHandler::SendProfileIcons() {
image_url_list.Append(Value::CreateStringValue(url));
}
- web_ui_->CallJavascriptFunction(
+ web_ui()->CallJavascriptFunction(
"ManageProfileOverlay.receiveDefaultProfileIcons",
image_url_list);
}
@@ -125,8 +125,8 @@ void ManageProfileHandler::SendProfileNames() {
profile_name_dict.SetBoolean(UTF16ToUTF8(cache.GetNameOfProfileAtIndex(i)),
true);
- web_ui_->CallJavascriptFunction("ManageProfileOverlay.receiveProfileNames",
- profile_name_dict);
+ web_ui()->CallJavascriptFunction("ManageProfileOverlay.receiveProfileNames",
+ profile_name_dict);
}
void ManageProfileHandler::SetProfileNameAndIcon(const ListValue* args) {
@@ -229,9 +229,9 @@ void ManageProfileHandler::RequestProfileInfo(const ListValue* args) {
return;
FilePath profile_path = cache.GetPathOfProfileAtIndex(index);
- FilePath current_profile_path = Profile::FromWebUI(web_ui_)->GetPath();
+ FilePath current_profile_path = Profile::FromWebUI(web_ui())->GetPath();
bool is_current_profile =
- profile_path == Profile::FromWebUI(web_ui_)->GetPath();
+ profile_path == Profile::FromWebUI(web_ui())->GetPath();
DictionaryValue profile_value;
profile_value.SetString("name", cache.GetNameOfProfileAtIndex(index));
@@ -251,13 +251,13 @@ void ManageProfileHandler::RequestProfileInfo(const ListValue* args) {
cache.GetDefaultAvatarIconUrl(icon_index));
}
- web_ui_->CallJavascriptFunction("ManageProfileOverlay.setProfileInfo",
- profile_value);
+ web_ui()->CallJavascriptFunction("ManageProfileOverlay.setProfileInfo",
+ profile_value);
// Ensure that we have the most up to date GAIA picture.
if (is_current_profile) {
GAIAInfoUpdateService* service =
- Profile::FromWebUI(web_ui_)->GetGAIAInfoUpdateService();
+ Profile::FromWebUI(web_ui())->GetGAIAInfoUpdateService();
if (service)
service->Update();
}
@@ -275,7 +275,7 @@ void ManageProfileHandler::ProfileIconSelectionChanged(
}
// Currently this only supports editing the current profile's info.
- if (file_path != Profile::FromWebUI(web_ui_)->GetPath())
+ if (file_path != Profile::FromWebUI(web_ui())->GetPath())
return;
std::string icon_url;
@@ -297,8 +297,8 @@ void ManageProfileHandler::ProfileIconSelectionChanged(
return;
StringValue gaia_name_value(gaia_name);
- web_ui_->CallJavascriptFunction("ManageProfileOverlay.setProfileName",
- gaia_name_value);
+ web_ui()->CallJavascriptFunction("ManageProfileOverlay.setProfileName",
+ gaia_name_value);
}
} // namespace options2
diff --git a/chrome/browser/ui/webui/options2/options_sync_setup_handler2.cc b/chrome/browser/ui/webui/options2/options_sync_setup_handler2.cc
index 9e622dc..5273218 100644
--- a/chrome/browser/ui/webui/options2/options_sync_setup_handler2.cc
+++ b/chrome/browser/ui/webui/options2/options_sync_setup_handler2.cc
@@ -18,7 +18,7 @@ OptionsSyncSetupHandler::~OptionsSyncSetupHandler() {
void OptionsSyncSetupHandler::StepWizardForShowSetupUI() {
ProfileSyncService* service =
- Profile::FromWebUI(web_ui_)->GetProfileSyncService();
+ Profile::FromWebUI(web_ui())->GetProfileSyncService();
DCHECK(service);
// We should bring up either a login or a configure flow based on the state of
@@ -36,7 +36,7 @@ void OptionsSyncSetupHandler::StepWizardForShowSetupUI() {
void OptionsSyncSetupHandler::ShowSetupUI() {
ProfileSyncService* service =
- Profile::FromWebUI(web_ui_)->GetProfileSyncService();
+ Profile::FromWebUI(web_ui())->GetProfileSyncService();
DCHECK(service);
// The user is trying to manually load a syncSetup URL. We should bring up
@@ -53,7 +53,7 @@ void OptionsSyncSetupHandler::ShowSetupUI() {
// Show the Sync Setup page.
scoped_ptr<Value> page(Value::CreateStringValue("syncSetup"));
- web_ui_->CallJavascriptFunction("OptionsPage.navigateToPage", *page);
+ web_ui()->CallJavascriptFunction("OptionsPage.navigateToPage", *page);
}
} // namespace options2
diff --git a/chrome/browser/ui/webui/options2/options_ui2.cc b/chrome/browser/ui/webui/options2/options_ui2.cc
index 0439ff8..38d7968 100644
--- a/chrome/browser/ui/webui/options2/options_ui2.cc
+++ b/chrome/browser/ui/webui/options2/options_ui2.cc
@@ -350,7 +350,7 @@ void OptionsUI::AddOptionsPageUIHandler(DictionaryValue* localized_strings,
if (handler->IsEnabled()) {
handler->GetLocalizedValues(localized_strings);
// Add handler to the list and also pass the ownership.
- AddMessageHandler(handler.release()->Attach(this));
+ AddMessageHandler(handler.release());
}
}
diff --git a/chrome/browser/ui/webui/options2/password_manager_handler2.cc b/chrome/browser/ui/webui/options2/password_manager_handler2.cc
index 4951962e..8ae31e0 100644
--- a/chrome/browser/ui/webui/options2/password_manager_handler2.cc
+++ b/chrome/browser/ui/webui/options2/password_manager_handler2.cc
@@ -86,29 +86,27 @@ void PasswordManagerHandler::Initialize() {
return;
show_passwords_.Init(prefs::kPasswordManagerAllowShowPasswords,
- Profile::FromWebUI(web_ui_)->GetPrefs(), this);
- // We should not cache web_ui_->GetProfile(). See crosbug.com/6304.
+ Profile::FromWebUI(web_ui())->GetPrefs(), this);
+ // We should not cache web_ui()->GetProfile(). See crosbug.com/6304.
PasswordStore* store = GetPasswordStore();
if (store)
store->AddObserver(this);
}
void PasswordManagerHandler::RegisterMessages() {
- DCHECK(web_ui_);
-
- web_ui_->RegisterMessageCallback("updatePasswordLists",
+ web_ui()->RegisterMessageCallback("updatePasswordLists",
base::Bind(&PasswordManagerHandler::UpdatePasswordLists,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("removeSavedPassword",
+ web_ui()->RegisterMessageCallback("removeSavedPassword",
base::Bind(&PasswordManagerHandler::RemoveSavedPassword,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("removePasswordException",
+ web_ui()->RegisterMessageCallback("removePasswordException",
base::Bind(&PasswordManagerHandler::RemovePasswordException,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("removeAllSavedPasswords",
+ web_ui()->RegisterMessageCallback("removeAllSavedPasswords",
base::Bind(&PasswordManagerHandler::RemoveAllSavedPasswords,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("removeAllPasswordExceptions",
+ web_ui()->RegisterMessageCallback("removeAllPasswordExceptions",
base::Bind(&PasswordManagerHandler::RemoveAllPasswordExceptions,
base::Unretained(this)));
}
@@ -118,7 +116,7 @@ void PasswordManagerHandler::OnLoginsChanged() {
}
PasswordStore* PasswordManagerHandler::GetPasswordStore() {
- return Profile::FromWebUI(web_ui_)->
+ return Profile::FromWebUI(web_ui())->
GetPasswordStore(Profile::EXPLICIT_ACCESS);
}
@@ -141,7 +139,7 @@ void PasswordManagerHandler::UpdatePasswordLists(const ListValue* args) {
password_list_.reset();
password_exception_list_.reset();
- languages_ = Profile::FromWebUI(web_ui_)->GetPrefs()->
+ languages_ = Profile::FromWebUI(web_ui())->GetPrefs()->
GetString(prefs::kAcceptLanguages);
populater_.Populate();
exception_populater_.Populate();
@@ -211,8 +209,8 @@ void PasswordManagerHandler::SetPasswordList() {
entries.Append(entry);
}
- web_ui_->CallJavascriptFunction("PasswordManager.setSavedPasswordsList",
- entries);
+ web_ui()->CallJavascriptFunction("PasswordManager.setSavedPasswordsList",
+ entries);
}
void PasswordManagerHandler::SetPasswordExceptionList() {
@@ -222,8 +220,8 @@ void PasswordManagerHandler::SetPasswordExceptionList() {
net::FormatUrl(password_exception_list_[i]->origin, languages_)));
}
- web_ui_->CallJavascriptFunction("PasswordManager.setPasswordExceptionsList",
- entries);
+ web_ui()->CallJavascriptFunction("PasswordManager.setPasswordExceptionsList",
+ entries);
}
PasswordManagerHandler::ListPopulater::ListPopulater(
diff --git a/chrome/browser/ui/webui/options2/personal_options_handler2.cc b/chrome/browser/ui/webui/options2/personal_options_handler2.cc
index 64d5093..3f8e6e1 100644
--- a/chrome/browser/ui/webui/options2/personal_options_handler2.cc
+++ b/chrome/browser/ui/webui/options2/personal_options_handler2.cc
@@ -68,7 +68,7 @@ PersonalOptionsHandler::PersonalOptionsHandler() {
PersonalOptionsHandler::~PersonalOptionsHandler() {
ProfileSyncService* sync_service =
- Profile::FromWebUI(web_ui_)->GetProfileSyncService();
+ Profile::FromWebUI(web_ui())->GetProfileSyncService();
if (sync_service)
sync_service->RemoveObserver(this);
}
@@ -216,18 +216,17 @@ void PersonalOptionsHandler::GetLocalizedValues(
}
void PersonalOptionsHandler::RegisterMessages() {
- DCHECK(web_ui_);
- web_ui_->RegisterMessageCallback(
+ web_ui()->RegisterMessageCallback(
"themesReset",
base::Bind(&PersonalOptionsHandler::ThemesReset,
base::Unretained(this)));
#if defined(TOOLKIT_GTK)
- web_ui_->RegisterMessageCallback(
+ web_ui()->RegisterMessageCallback(
"themesSetGTK",
base::Bind(&PersonalOptionsHandler::ThemesSetGTK,
base::Unretained(this)));
#endif
- web_ui_->RegisterMessageCallback(
+ web_ui()->RegisterMessageCallback(
"createProfile",
base::Bind(&PersonalOptionsHandler::CreateProfile,
base::Unretained(this)));
@@ -255,7 +254,7 @@ void PersonalOptionsHandler::OnStateChanged() {
string16 status_label;
string16 link_label;
ProfileSyncService* service =
- Profile::FromWebUI(web_ui_)->GetProfileSyncService();
+ Profile::FromWebUI(web_ui())->GetProfileSyncService();
DCHECK(service);
bool managed = service->IsManaged();
bool sync_setup_completed = service->HasSyncSetupCompleted();
@@ -289,66 +288,66 @@ void PersonalOptionsHandler::OnStateChanged() {
}
scoped_ptr<Value> completed(Value::CreateBooleanValue(sync_setup_completed));
- web_ui_->CallJavascriptFunction("PersonalOptions.setSyncSetupCompleted",
- *completed);
+ web_ui()->CallJavascriptFunction("PersonalOptions.setSyncSetupCompleted",
+ *completed);
scoped_ptr<Value> label(Value::CreateStringValue(status_label));
- web_ui_->CallJavascriptFunction("PersonalOptions.setSyncStatus", *label);
+ web_ui()->CallJavascriptFunction("PersonalOptions.setSyncStatus", *label);
scoped_ptr<Value> enabled(
Value::CreateBooleanValue(is_start_stop_button_enabled));
- web_ui_->CallJavascriptFunction("PersonalOptions.setStartStopButtonEnabled",
- *enabled);
+ web_ui()->CallJavascriptFunction("PersonalOptions.setStartStopButtonEnabled",
+ *enabled);
scoped_ptr<Value> visible(
Value::CreateBooleanValue(is_start_stop_button_visible));
- web_ui_->CallJavascriptFunction("PersonalOptions.setStartStopButtonVisible",
- *visible);
+ web_ui()->CallJavascriptFunction("PersonalOptions.setStartStopButtonVisible",
+ *visible);
label.reset(Value::CreateStringValue(start_stop_button_label));
- web_ui_->CallJavascriptFunction("PersonalOptions.setStartStopButtonLabel",
- *label);
+ web_ui()->CallJavascriptFunction("PersonalOptions.setStartStopButtonLabel",
+ *label);
label.reset(Value::CreateStringValue(link_label));
- web_ui_->CallJavascriptFunction("PersonalOptions.setSyncActionLinkLabel",
- *label);
+ web_ui()->CallJavascriptFunction("PersonalOptions.setSyncActionLinkLabel",
+ *label);
enabled.reset(Value::CreateBooleanValue(!managed));
- web_ui_->CallJavascriptFunction("PersonalOptions.setSyncActionLinkEnabled",
- *enabled);
+ web_ui()->CallJavascriptFunction("PersonalOptions.setSyncActionLinkEnabled",
+ *enabled);
visible.reset(Value::CreateBooleanValue(status_has_error));
- web_ui_->CallJavascriptFunction("PersonalOptions.setSyncStatusErrorVisible",
- *visible);
+ web_ui()->CallJavascriptFunction("PersonalOptions.setSyncStatusErrorVisible",
+ *visible);
enabled.reset(Value::CreateBooleanValue(
!service->unrecoverable_error_detected()));
- web_ui_->CallJavascriptFunction(
+ web_ui()->CallJavascriptFunction(
"PersonalOptions.setCustomizeSyncButtonEnabled",
*enabled);
if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnableAutologin)) {
visible.reset(Value::CreateBooleanValue(
service->AreCredentialsAvailable()));
- web_ui_->CallJavascriptFunction("PersonalOptions.setAutoLoginVisible",
- *visible);
+ web_ui()->CallJavascriptFunction("PersonalOptions.setAutoLoginVisible",
+ *visible);
}
// Set profile creation text and button if multi-profiles switch is on.
visible.reset(Value::CreateBooleanValue(multiprofile_));
- web_ui_->CallJavascriptFunction("PersonalOptions.setProfilesSectionVisible",
- *visible);
+ web_ui()->CallJavascriptFunction("PersonalOptions.setProfilesSectionVisible",
+ *visible);
if (multiprofile_)
SendProfilesInfo();
}
void PersonalOptionsHandler::ObserveThemeChanged() {
- Profile* profile = Profile::FromWebUI(web_ui_);
+ Profile* profile = Profile::FromWebUI(web_ui());
#if defined(TOOLKIT_GTK)
GtkThemeService* theme_service = GtkThemeService::GetFrom(profile);
bool is_gtk_theme = theme_service->UsingNativeTheme();
base::FundamentalValue gtk_enabled(!is_gtk_theme);
- web_ui_->CallJavascriptFunction(
+ web_ui()->CallJavascriptFunction(
"options.PersonalOptions.setGtkThemeButtonEnabled", gtk_enabled);
#else
ThemeService* theme_service = ThemeServiceFactory::GetForProfile(profile);
@@ -357,12 +356,12 @@ void PersonalOptionsHandler::ObserveThemeChanged() {
bool is_classic_theme = !is_gtk_theme && theme_service->UsingDefaultTheme();
base::FundamentalValue enabled(!is_classic_theme);
- web_ui_->CallJavascriptFunction(
+ web_ui()->CallJavascriptFunction(
"options.PersonalOptions.setThemesResetButtonEnabled", enabled);
}
void PersonalOptionsHandler::Initialize() {
- Profile* profile = Profile::FromWebUI(web_ui_);
+ Profile* profile = Profile::FromWebUI(web_ui());
// Listen for theme installation.
registrar_.Add(this, chrome::NOTIFICATION_BROWSER_THEME_CHANGED,
@@ -377,20 +376,20 @@ void PersonalOptionsHandler::Initialize() {
sync_service->AddObserver(this);
OnStateChanged();
} else {
- web_ui_->CallJavascriptFunction("options.PersonalOptions.hideSyncSection");
+ web_ui()->CallJavascriptFunction("options.PersonalOptions.hideSyncSection");
}
}
void PersonalOptionsHandler::ThemesReset(const ListValue* args) {
content::RecordAction(UserMetricsAction("Options_ThemesReset"));
- Profile* profile = Profile::FromWebUI(web_ui_);
+ Profile* profile = Profile::FromWebUI(web_ui());
ThemeServiceFactory::GetForProfile(profile)->UseDefaultTheme();
}
#if defined(TOOLKIT_GTK)
void PersonalOptionsHandler::ThemesSetGTK(const ListValue* args) {
content::RecordAction(UserMetricsAction("Options_GtkThemeSet"));
- Profile* profile = Profile::FromWebUI(web_ui_);
+ Profile* profile = Profile::FromWebUI(web_ui());
ThemeServiceFactory::GetForProfile(profile)->SetNativeTheme();
}
#endif
@@ -399,10 +398,10 @@ void PersonalOptionsHandler::ThemesSetGTK(const ListValue* args) {
void PersonalOptionsHandler::UpdateAccountPicture() {
std::string email = chromeos::UserManager::Get()->logged_in_user().email();
if (!email.empty()) {
- web_ui_->CallJavascriptFunction("PersonalOptions.updateAccountPicture");
+ web_ui()->CallJavascriptFunction("PersonalOptions.updateAccountPicture");
base::StringValue email_value(email);
- web_ui_->CallJavascriptFunction("AccountsOptions.updateAccountPicture",
- email_value);
+ web_ui()->CallJavascriptFunction("AccountsOptions.updateAccountPicture",
+ email_value);
}
}
#endif
@@ -412,7 +411,7 @@ void PersonalOptionsHandler::SendProfilesInfo() {
g_browser_process->profile_manager()->GetProfileInfoCache();
ListValue profile_info_list;
FilePath current_profile_path =
- web_ui_->tab_contents()->GetBrowserContext()->GetPath();
+ web_ui()->tab_contents()->GetBrowserContext()->GetPath();
for (size_t i = 0, e = cache.GetNumberOfProfiles(); i < e; ++i) {
DictionaryValue* profile_value = new DictionaryValue();
FilePath profile_path = cache.GetPathOfProfileAtIndex(i);
@@ -437,8 +436,8 @@ void PersonalOptionsHandler::SendProfilesInfo() {
profile_info_list.Append(profile_value);
}
- web_ui_->CallJavascriptFunction("PersonalOptions.setProfilesInfo",
- profile_info_list);
+ web_ui()->CallJavascriptFunction("PersonalOptions.setProfilesInfo",
+ profile_info_list);
}
void PersonalOptionsHandler::CreateProfile(const ListValue* args) {
diff --git a/chrome/browser/ui/webui/options2/search_engine_manager_handler2.cc b/chrome/browser/ui/webui/options2/search_engine_manager_handler2.cc
index d3b7be9..2669112 100644
--- a/chrome/browser/ui/webui/options2/search_engine_manager_handler2.cc
+++ b/chrome/browser/ui/webui/options2/search_engine_manager_handler2.cc
@@ -42,7 +42,7 @@ SearchEngineManagerHandler::~SearchEngineManagerHandler() {
void SearchEngineManagerHandler::Initialize() {
list_controller_.reset(
- new KeywordEditorController(Profile::FromWebUI(web_ui_)));
+ new KeywordEditorController(Profile::FromWebUI(web_ui())));
if (list_controller_.get()) {
list_controller_->table_model()->SetObserver(this);
OnModelChanged();
@@ -87,27 +87,27 @@ void SearchEngineManagerHandler::GetLocalizedValues(
}
void SearchEngineManagerHandler::RegisterMessages() {
- web_ui_->RegisterMessageCallback(
+ web_ui()->RegisterMessageCallback(
"managerSetDefaultSearchEngine",
base::Bind(&SearchEngineManagerHandler::SetDefaultSearchEngine,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback(
+ web_ui()->RegisterMessageCallback(
"removeSearchEngine",
base::Bind(&SearchEngineManagerHandler::RemoveSearchEngine,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback(
+ web_ui()->RegisterMessageCallback(
"editSearchEngine",
base::Bind(&SearchEngineManagerHandler::EditSearchEngine,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback(
+ web_ui()->RegisterMessageCallback(
"checkSearchEngineInfoValidity",
base::Bind(&SearchEngineManagerHandler::CheckSearchEngineInfoValidity,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback(
+ web_ui()->RegisterMessageCallback(
"searchEngineEditCancelled",
base::Bind(&SearchEngineManagerHandler::EditCancelled,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback(
+ web_ui()->RegisterMessageCallback(
"searchEngineEditCompleted",
base::Bind(&SearchEngineManagerHandler::EditCompleted,
base::Unretained(this)));
@@ -143,7 +143,7 @@ void SearchEngineManagerHandler::OnModelChanged() {
// Build the extension keywords list.
ListValue keyword_list;
ExtensionService* extension_service =
- Profile::FromWebUI(web_ui_)->GetExtensionService();
+ Profile::FromWebUI(web_ui())->GetExtensionService();
if (extension_service) {
const ExtensionSet* extensions = extension_service->extensions();
for (ExtensionSet::const_iterator it = extensions->begin();
@@ -153,8 +153,8 @@ void SearchEngineManagerHandler::OnModelChanged() {
}
}
- web_ui_->CallJavascriptFunction("SearchEngineManager.updateSearchEngineList",
- defaults_list, others_list, keyword_list);
+ web_ui()->CallJavascriptFunction("SearchEngineManager.updateSearchEngineList",
+ defaults_list, others_list, keyword_list);
}
void SearchEngineManagerHandler::OnItemsChanged(int start, int length) {
@@ -250,7 +250,7 @@ void SearchEngineManagerHandler::EditSearchEngine(const ListValue* args) {
if (index != -1)
edit_url = list_controller_->GetTemplateURL(index);
edit_controller_.reset(new EditSearchEngineController(
- edit_url, this, Profile::FromWebUI(web_ui_)));
+ edit_url, this, Profile::FromWebUI(web_ui())));
}
void SearchEngineManagerHandler::OnEditedKeyword(
@@ -288,8 +288,8 @@ void SearchEngineManagerHandler::CheckSearchEngineInfoValidity(
validity.SetBoolean("keyword", edit_controller_->IsKeywordValid(keyword));
validity.SetBoolean("url", edit_controller_->IsURLValid(url));
StringValue indexValue(modelIndex);
- web_ui_->CallJavascriptFunction("SearchEngineManager.validityCheckCallback",
- validity, indexValue);
+ web_ui()->CallJavascriptFunction("SearchEngineManager.validityCheckCallback",
+ validity, indexValue);
}
void SearchEngineManagerHandler::EditCancelled(const ListValue* args) {
diff --git a/chrome/browser/ui/webui/options2/stop_syncing_handler2.cc b/chrome/browser/ui/webui/options2/stop_syncing_handler2.cc
index 3e67b8ee..6032cbc 100644
--- a/chrome/browser/ui/webui/options2/stop_syncing_handler2.cc
+++ b/chrome/browser/ui/webui/options2/stop_syncing_handler2.cc
@@ -41,14 +41,13 @@ void StopSyncingHandler::GetLocalizedValues(
}
void StopSyncingHandler::RegisterMessages() {
- DCHECK(web_ui_);
- web_ui_->RegisterMessageCallback("stopSyncing",
+ web_ui()->RegisterMessageCallback("stopSyncing",
base::Bind(&StopSyncingHandler::StopSyncing, base::Unretained(this)));
}
void StopSyncingHandler::StopSyncing(const ListValue* args){
ProfileSyncService* service =
- Profile::FromWebUI(web_ui_)->GetProfileSyncService();
+ Profile::FromWebUI(web_ui())->GetProfileSyncService();
if (service != NULL && ProfileSyncService::IsSyncEnabled()) {
service->DisableForUser();
ProfileSyncService::SyncEvent(ProfileSyncService::STOP_FROM_OPTIONS);
diff --git a/chrome/browser/ui/webui/options2/web_intents_settings_handler2.cc b/chrome/browser/ui/webui/options2/web_intents_settings_handler2.cc
index c6f7a21..355c1e0 100644
--- a/chrome/browser/ui/webui/options2/web_intents_settings_handler2.cc
+++ b/chrome/browser/ui/webui/options2/web_intents_settings_handler2.cc
@@ -48,10 +48,10 @@ void WebIntentsSettingsHandler::GetLocalizedValues(
}
void WebIntentsSettingsHandler::RegisterMessages() {
- web_ui_->RegisterMessageCallback("removeIntent",
+ web_ui()->RegisterMessageCallback("removeIntent",
base::Bind(&WebIntentsSettingsHandler::RemoveIntent,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("loadIntents",
+ web_ui()->RegisterMessageCallback("loadIntents",
base::Bind(&WebIntentsSettingsHandler::LoadChildren,
base::Unretained(this)));
}
@@ -83,7 +83,7 @@ void WebIntentsSettingsHandler::TreeModelEndBatch(WebIntentsModel* model) {
void WebIntentsSettingsHandler::EnsureWebIntentsModelCreated() {
if (intents_tree_model_.get()) return;
- Profile* profile = Profile::FromWebUI(web_ui_);
+ Profile* profile = Profile::FromWebUI(web_ui());
web_intents_registry_ = WebIntentsRegistryFactory::GetForProfile(profile);
intents_tree_model_.reset(new WebIntentsModel(web_intents_registry_));
intents_tree_model_->AddWebIntentsTreeObserver(this);
@@ -158,7 +158,7 @@ void WebIntentsSettingsHandler::SendChildren(WebIntentsTreeNode* parent) {
Value::CreateStringValue(intents_tree_model_->GetTreeNodeId(parent)));
args.Append(children);
- web_ui_->CallJavascriptFunction("IntentsView.loadChildren", args);
+ web_ui()->CallJavascriptFunction("IntentsView.loadChildren", args);
}
} // namespace options2
diff --git a/chrome/browser/ui/webui/plugins_ui.cc b/chrome/browser/ui/webui/plugins_ui.cc
index 6f49abd..1c7f045 100644
--- a/chrome/browser/ui/webui/plugins_ui.cc
+++ b/chrome/browser/ui/webui/plugins_ui.cc
@@ -118,7 +118,6 @@ class PluginsDOMHandler : public WebUIMessageHandler,
virtual ~PluginsDOMHandler() {}
// WebUIMessageHandler implementation.
- virtual WebUIMessageHandler* Attach(WebUI* web_ui) OVERRIDE;
virtual void RegisterMessages() OVERRIDE;
// Callback for the "requestPluginsData" message.
@@ -160,8 +159,8 @@ PluginsDOMHandler::PluginsDOMHandler()
: ALLOW_THIS_IN_INITIALIZER_LIST(weak_ptr_factory_(this)) {
}
-WebUIMessageHandler* PluginsDOMHandler::Attach(WebUI* web_ui) {
- Profile* profile = Profile::FromWebUI(web_ui);
+void PluginsDOMHandler::RegisterMessages() {
+ Profile* profile = Profile::FromWebUI(web_ui());
PrefService* prefs = profile->GetPrefs();
show_details_.Init(prefs::kPluginsShowDetails, prefs, NULL);
@@ -170,20 +169,16 @@ WebUIMessageHandler* PluginsDOMHandler::Attach(WebUI* web_ui) {
chrome::NOTIFICATION_PLUGIN_ENABLE_STATUS_CHANGED,
content::Source<Profile>(profile));
- return WebUIMessageHandler::Attach(web_ui);
-}
-
-void PluginsDOMHandler::RegisterMessages() {
- web_ui_->RegisterMessageCallback("requestPluginsData",
+ web_ui()->RegisterMessageCallback("requestPluginsData",
base::Bind(&PluginsDOMHandler::HandleRequestPluginsData,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("enablePlugin",
+ web_ui()->RegisterMessageCallback("enablePlugin",
base::Bind(&PluginsDOMHandler::HandleEnablePluginMessage,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("saveShowDetailsToPrefs",
+ web_ui()->RegisterMessageCallback("saveShowDetailsToPrefs",
base::Bind(&PluginsDOMHandler::HandleSaveShowDetailsToPrefs,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("getShowDetails",
+ web_ui()->RegisterMessageCallback("getShowDetails",
base::Bind(&PluginsDOMHandler::HandleGetShowDetails,
base::Unretained(this)));
}
@@ -193,7 +188,7 @@ void PluginsDOMHandler::HandleRequestPluginsData(const ListValue* args) {
}
void PluginsDOMHandler::HandleEnablePluginMessage(const ListValue* args) {
- Profile* profile = Profile::FromWebUI(web_ui_);
+ Profile* profile = Profile::FromWebUI(web_ui());
// Be robust in accepting badness since plug-ins display HTML (hence
// JavaScript).
@@ -244,7 +239,7 @@ void PluginsDOMHandler::HandleSaveShowDetailsToPrefs(const ListValue* args) {
void PluginsDOMHandler::HandleGetShowDetails(const ListValue* args) {
base::FundamentalValue show_details(show_details_.GetValue());
- web_ui_->CallJavascriptFunction("loadShowDetailsFromPrefs", show_details);
+ web_ui()->CallJavascriptFunction("loadShowDetailsFromPrefs", show_details);
}
void PluginsDOMHandler::Observe(int type,
@@ -265,7 +260,7 @@ void PluginsDOMHandler::LoadPlugins() {
void PluginsDOMHandler::PluginsLoaded(const std::vector<PluginGroup>& groups) {
PluginPrefs* plugin_prefs =
- PluginPrefs::GetForProfile(Profile::FromWebUI(web_ui_));
+ PluginPrefs::GetForProfile(Profile::FromWebUI(web_ui()));
// Construct DictionaryValues to return to the UI
ListValue* plugin_groups_data = new ListValue();
@@ -365,7 +360,7 @@ void PluginsDOMHandler::PluginsLoaded(const std::vector<PluginGroup>& groups) {
}
DictionaryValue results;
results.Set("plugins", plugin_groups_data);
- web_ui_->CallJavascriptFunction("returnPluginsData", results);
+ web_ui()->CallJavascriptFunction("returnPluginsData", results);
}
} // namespace
@@ -377,7 +372,7 @@ void PluginsDOMHandler::PluginsLoaded(const std::vector<PluginGroup>& groups) {
///////////////////////////////////////////////////////////////////////////////
PluginsUI::PluginsUI(TabContents* contents) : ChromeWebUI(contents) {
- AddMessageHandler((new PluginsDOMHandler())->Attach(this));
+ AddMessageHandler(new PluginsDOMHandler());
// Set up the chrome://plugins/ source.
Profile* profile = Profile::FromBrowserContext(contents->GetBrowserContext());
diff --git a/chrome/browser/ui/webui/policy_ui.cc b/chrome/browser/ui/webui/policy_ui.cc
index 4bd7ade..a5ae5a8 100644
--- a/chrome/browser/ui/webui/policy_ui.cc
+++ b/chrome/browser/ui/webui/policy_ui.cc
@@ -96,11 +96,11 @@ PolicyUIHandler::~PolicyUIHandler() {
}
void PolicyUIHandler::RegisterMessages() {
- web_ui_->RegisterMessageCallback(
+ web_ui()->RegisterMessageCallback(
"requestData",
base::Bind(&PolicyUIHandler::HandleRequestData,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback(
+ web_ui()->RegisterMessageCallback(
"fetchPolicy",
base::Bind(&PolicyUIHandler::HandleFetchPolicy,
base::Unretained(this)));
@@ -128,7 +128,7 @@ void PolicyUIHandler::SendDataToUI(bool is_policy_update) {
results.Set("status", dict);
results.SetBoolean("isPolicyUpdate", is_policy_update);
- web_ui_->CallJavascriptFunction("Policy.returnData", results);
+ web_ui()->CallJavascriptFunction("Policy.returnData", results);
}
DictionaryValue* PolicyUIHandler::GetStatusData() {
@@ -231,7 +231,7 @@ string16 PolicyUIHandler::CreateStatusMessageString(
////////////////////////////////////////////////////////////////////////////////
PolicyUI::PolicyUI(TabContents* contents) : ChromeWebUI(contents) {
- AddMessageHandler((new PolicyUIHandler)->Attach(this));
+ AddMessageHandler(new PolicyUIHandler);
// Set up the chrome://policy/ source.
Profile* profile = Profile::FromBrowserContext(contents->GetBrowserContext());
diff --git a/chrome/browser/ui/webui/print_preview_handler.cc b/chrome/browser/ui/webui/print_preview_handler.cc
index 88bdc2d..3a7e61e 100644
--- a/chrome/browser/ui/webui/print_preview_handler.cc
+++ b/chrome/browser/ui/webui/print_preview_handler.cc
@@ -217,43 +217,43 @@ PrintPreviewHandler::~PrintPreviewHandler() {
}
void PrintPreviewHandler::RegisterMessages() {
- web_ui_->RegisterMessageCallback("getPrinters",
+ web_ui()->RegisterMessageCallback("getPrinters",
base::Bind(&PrintPreviewHandler::HandleGetPrinters,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("getPreview",
+ web_ui()->RegisterMessageCallback("getPreview",
base::Bind(&PrintPreviewHandler::HandleGetPreview,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("print",
+ web_ui()->RegisterMessageCallback("print",
base::Bind(&PrintPreviewHandler::HandlePrint,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("getPrinterCapabilities",
+ web_ui()->RegisterMessageCallback("getPrinterCapabilities",
base::Bind(&PrintPreviewHandler::HandleGetPrinterCapabilities,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("showSystemDialog",
+ web_ui()->RegisterMessageCallback("showSystemDialog",
base::Bind(&PrintPreviewHandler::HandleShowSystemDialog,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("signIn",
+ web_ui()->RegisterMessageCallback("signIn",
base::Bind(&PrintPreviewHandler::HandleSignin,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("manageCloudPrinters",
+ web_ui()->RegisterMessageCallback("manageCloudPrinters",
base::Bind(&PrintPreviewHandler::HandleManageCloudPrint,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("manageLocalPrinters",
+ web_ui()->RegisterMessageCallback("manageLocalPrinters",
base::Bind(&PrintPreviewHandler::HandleManagePrinters,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("closePrintPreviewTab",
+ web_ui()->RegisterMessageCallback("closePrintPreviewTab",
base::Bind(&PrintPreviewHandler::HandleClosePreviewTab,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("hidePreview",
+ web_ui()->RegisterMessageCallback("hidePreview",
base::Bind(&PrintPreviewHandler::HandleHidePreview,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("cancelPendingPrintRequest",
+ web_ui()->RegisterMessageCallback("cancelPendingPrintRequest",
base::Bind(&PrintPreviewHandler::HandleCancelPendingPrintRequest,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("saveLastPrinter",
+ web_ui()->RegisterMessageCallback("saveLastPrinter",
base::Bind(&PrintPreviewHandler::HandleSaveLastPrinter,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("getInitialSettings",
+ web_ui()->RegisterMessageCallback("getInitialSettings",
base::Bind(&PrintPreviewHandler::HandleGetInitialSettings,
base::Unretained(this)));
}
@@ -262,7 +262,7 @@ TabContentsWrapper* PrintPreviewHandler::preview_tab_wrapper() const {
return TabContentsWrapper::GetCurrentWrapperForContents(preview_tab());
}
TabContents* PrintPreviewHandler::preview_tab() const {
- return web_ui_->tab_contents();
+ return web_ui()->tab_contents();
}
void PrintPreviewHandler::HandleGetPrinters(const ListValue* /*args*/) {
@@ -286,7 +286,7 @@ void PrintPreviewHandler::HandleGetPreview(const ListValue* args) {
if (!settings->GetInteger(printing::kPreviewRequestID, &request_id))
return;
- PrintPreviewUI* print_preview_ui = static_cast<PrintPreviewUI*>(web_ui_);
+ PrintPreviewUI* print_preview_ui = static_cast<PrintPreviewUI*>(web_ui());
print_preview_ui->OnPrintPreviewRequest(request_id);
// Add an additional key in order to identify |print_preview_ui| later on
// when calling PrintPreviewUI::GetCurrentPrintPreviewStatus() on the IO
@@ -417,7 +417,7 @@ void PrintPreviewHandler::HandlePrint(const ListValue* args) {
// This tries to activate the initiator tab as well, so do not clear the
// association with the initiator tab yet.
- PrintPreviewUI* print_preview_ui = static_cast<PrintPreviewUI*>(web_ui_);
+ PrintPreviewUI* print_preview_ui = static_cast<PrintPreviewUI*>(web_ui());
print_preview_ui->OnHidePreviewTab();
// Do this so the initiator tab can open a new print preview tab.
@@ -426,7 +426,7 @@ void PrintPreviewHandler::HandlePrint(const ListValue* args) {
// The PDF being printed contains only the pages that the user selected,
// so ignore the page range and print all pages.
settings->Remove(printing::kSettingPageRange, NULL);
- RenderViewHost* rvh = web_ui_->tab_contents()->GetRenderViewHost();
+ RenderViewHost* rvh = web_ui()->tab_contents()->GetRenderViewHost();
rvh->Send(new PrintMsg_PrintForPrintPreview(rvh->routing_id(), *settings));
}
initiator_tab->print_view_manager()->PrintPreviewDone();
@@ -444,7 +444,7 @@ void PrintPreviewHandler::HandlePrintToPdf(
GetPageCountFromSettingsDictionary(settings));
// Pre-populating select file dialog with print job title.
- PrintPreviewUI* print_preview_ui = static_cast<PrintPreviewUI*>(web_ui_);
+ PrintPreviewUI* print_preview_ui = static_cast<PrintPreviewUI*>(web_ui());
string16 print_job_title_utf16 = print_preview_ui->initiator_tab_title();
#if defined(OS_WIN)
@@ -463,7 +463,7 @@ void PrintPreviewHandler::HandlePrintToPdf(
}
void PrintPreviewHandler::HandleHidePreview(const ListValue* /*args*/) {
- PrintPreviewUI* print_preview_ui = static_cast<PrintPreviewUI*>(web_ui_);
+ PrintPreviewUI* print_preview_ui = static_cast<PrintPreviewUI*>(web_ui());
print_preview_ui->OnHidePreviewTab();
}
@@ -525,7 +525,7 @@ void PrintPreviewHandler::HandlePrintWithCloudPrint() {
ReportStats();
ReportUserActionHistogram(PRINT_WITH_CLOUD_PRINT);
- PrintPreviewUI* print_preview_ui = static_cast<PrintPreviewUI*>(web_ui_);
+ PrintPreviewUI* print_preview_ui = static_cast<PrintPreviewUI*>(web_ui());
scoped_refptr<RefCountedBytes> data;
print_preview_ui->GetPrintPreviewDataForIndex(
printing::COMPLETE_PREVIEW_DOCUMENT_INDEX, &data);
@@ -567,7 +567,7 @@ void PrintPreviewHandler::HandleShowSystemDialog(const ListValue* /*args*/) {
manager->PrintForSystemDialogNow();
// Cancel the pending preview request if exists.
- PrintPreviewUI* print_preview_ui = static_cast<PrintPreviewUI*>(web_ui_);
+ PrintPreviewUI* print_preview_ui = static_cast<PrintPreviewUI*>(web_ui());
print_preview_ui->OnCancelPendingPreviewRequest();
}
@@ -636,7 +636,7 @@ void PrintPreviewHandler::HandleGetInitialSettings(const ListValue* /*args*/) {
void PrintPreviewHandler::SendInitialSettings(
const std::string& default_printer,
const std::string& cloud_print_data) {
- PrintPreviewUI* print_preview_ui = static_cast<PrintPreviewUI*>(web_ui_);
+ PrintPreviewUI* print_preview_ui = static_cast<PrintPreviewUI*>(web_ui());
base::DictionaryValue initial_settings;
initial_settings.SetString(kInitiatorTabTitle,
@@ -660,7 +660,7 @@ void PrintPreviewHandler::SendInitialSettings(
GetLastUsedMarginSettings(&initial_settings);
GetNumberFormatAndMeasurementSystem(&initial_settings);
}
- web_ui_->CallJavascriptFunction("setInitialSettings", initial_settings);
+ web_ui()->CallJavascriptFunction("setInitialSettings", initial_settings);
}
void PrintPreviewHandler::ActivateInitiatorTabAndClosePreviewTab() {
@@ -669,20 +669,20 @@ void PrintPreviewHandler::ActivateInitiatorTabAndClosePreviewTab() {
static_cast<RenderViewHostDelegate*>(
initiator_tab->tab_contents())->Activate();
}
- PrintPreviewUI* print_preview_ui = static_cast<PrintPreviewUI*>(web_ui_);
+ PrintPreviewUI* print_preview_ui = static_cast<PrintPreviewUI*>(web_ui());
print_preview_ui->OnClosePrintPreviewTab();
}
void PrintPreviewHandler::SendPrinterCapabilities(
const DictionaryValue& settings_info) {
VLOG(1) << "Get printer capabilities finished";
- web_ui_->CallJavascriptFunction("updateWithPrinterCapabilities",
- settings_info);
+ web_ui()->CallJavascriptFunction("updateWithPrinterCapabilities",
+ settings_info);
}
void PrintPreviewHandler::SetupPrinterList(const ListValue& printers) {
SendCloudPrintEnabled();
- web_ui_->CallJavascriptFunction("setPrinters", printers);
+ web_ui()->CallJavascriptFunction("setPrinters", printers);
}
void PrintPreviewHandler::SendCloudPrintEnabled() {
@@ -691,14 +691,14 @@ void PrintPreviewHandler::SendCloudPrintEnabled() {
if (prefs->GetBoolean(prefs::kCloudPrintSubmitEnabled)) {
GURL gcp_url(CloudPrintURL(profile).GetCloudPrintServiceURL());
base::StringValue gcp_url_value(gcp_url.spec());
- web_ui_->CallJavascriptFunction("setUseCloudPrint", gcp_url_value);
+ web_ui()->CallJavascriptFunction("setUseCloudPrint", gcp_url_value);
}
}
void PrintPreviewHandler::SendCloudPrintJob(const DictionaryValue& settings,
std::string print_ticket) {
scoped_refptr<RefCountedBytes> data;
- PrintPreviewUI* print_preview_ui = static_cast<PrintPreviewUI*>(web_ui_);
+ PrintPreviewUI* print_preview_ui = static_cast<PrintPreviewUI*>(web_ui());
print_preview_ui->GetPrintPreviewDataForIndex(
printing::COMPLETE_PREVIEW_DOCUMENT_INDEX, &data);
CHECK(data.get());
@@ -749,8 +749,7 @@ void PrintPreviewHandler::SendCloudPrintJob(const DictionaryValue& settings,
StringValue data_value(final_data);
- web_ui_->CallJavascriptFunction("printToCloud",
- data_value);
+ web_ui()->CallJavascriptFunction("printToCloud", data_value);
}
TabContentsWrapper* PrintPreviewHandler::GetInitiatorTab() const {
@@ -819,7 +818,7 @@ void PrintPreviewHandler::FileSelected(const FilePath& path,
// Updating last_saved_path_ to the newly selected folder.
*last_saved_path_ = path.DirName();
- PrintPreviewUI* print_preview_ui = static_cast<PrintPreviewUI*>(web_ui_);
+ PrintPreviewUI* print_preview_ui = static_cast<PrintPreviewUI*>(web_ui());
print_preview_ui->CallJavascriptFunction("fileSelectionCompleted");
scoped_refptr<RefCountedBytes> data;
print_preview_ui->GetPrintPreviewDataForIndex(
@@ -830,7 +829,7 @@ void PrintPreviewHandler::FileSelected(const FilePath& path,
}
void PrintPreviewHandler::PostPrintToPdfTask() {
- PrintPreviewUI* print_preview_ui = static_cast<PrintPreviewUI*>(web_ui_);
+ PrintPreviewUI* print_preview_ui = static_cast<PrintPreviewUI*>(web_ui());
scoped_refptr<RefCountedBytes> data;
print_preview_ui->GetPrintPreviewDataForIndex(
printing::COMPLETE_PREVIEW_DOCUMENT_INDEX, &data);
@@ -846,7 +845,7 @@ void PrintPreviewHandler::PostPrintToPdfTask() {
}
void PrintPreviewHandler::FileSelectionCanceled(void* params) {
- PrintPreviewUI* print_preview_ui = static_cast<PrintPreviewUI*>(web_ui_);
+ PrintPreviewUI* print_preview_ui = static_cast<PrintPreviewUI*>(web_ui());
print_preview_ui->OnFileSelectionCancelled();
}
diff --git a/chrome/browser/ui/webui/print_preview_ui.cc b/chrome/browser/ui/webui/print_preview_ui.cc
index 49d8010..15aadec 100644
--- a/chrome/browser/ui/webui/print_preview_ui.cc
+++ b/chrome/browser/ui/webui/print_preview_ui.cc
@@ -90,7 +90,7 @@ PrintPreviewUI::PrintPreviewUI(TabContents* contents)
// WebUI owns |handler_|.
handler_ = new PrintPreviewHandler();
- AddMessageHandler(handler_->Attach(this));
+ AddMessageHandler(handler_);
preview_ui_addr_str_ = GetPrintPreviewUIAddress();
g_print_preview_request_id_map.Get().Set(preview_ui_addr_str_, -1);
diff --git a/chrome/browser/ui/webui/profiler_ui.cc b/chrome/browser/ui/webui/profiler_ui.cc
index 594ad5b..dc37d44 100644
--- a/chrome/browser/ui/webui/profiler_ui.cc
+++ b/chrome/browser/ui/webui/profiler_ui.cc
@@ -110,7 +110,6 @@ class ProfilerMessageHandler : public WebUIMessageHandler {
ProfilerMessageHandler() {}
// WebUIMessageHandler implementation.
- virtual WebUIMessageHandler* Attach(WebUI* web_ui) OVERRIDE;
virtual void RegisterMessages() OVERRIDE;
// Messages.
@@ -121,24 +120,18 @@ class ProfilerMessageHandler : public WebUIMessageHandler {
DISALLOW_COPY_AND_ASSIGN(ProfilerMessageHandler);
};
-WebUIMessageHandler* ProfilerMessageHandler::Attach(WebUI* web_ui) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
- WebUIMessageHandler* result = WebUIMessageHandler::Attach(web_ui);
- return result;
-}
-
void ProfilerMessageHandler::RegisterMessages() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
- web_ui_->RegisterMessageCallback("getData",
+ web_ui()->RegisterMessageCallback("getData",
base::Bind(&ProfilerMessageHandler::OnGetData,base::Unretained(this)));
- web_ui_->RegisterMessageCallback("resetData",
+ web_ui()->RegisterMessageCallback("resetData",
base::Bind(&ProfilerMessageHandler::OnResetData,
base::Unretained(this)));
}
void ProfilerMessageHandler::OnGetData(const ListValue* list) {
- ProfilerUI* profiler_ui = reinterpret_cast<ProfilerUI*>(web_ui_);
+ ProfilerUI* profiler_ui = reinterpret_cast<ProfilerUI*>(web_ui());
profiler_ui->GetData();
}
@@ -152,7 +145,7 @@ ProfilerUI::ProfilerUI(TabContents* contents) : ChromeWebUI(contents) {
ui_weak_ptr_factory_.reset(new base::WeakPtrFactory<ProfilerUI>(this));
ui_weak_ptr_ = ui_weak_ptr_factory_->GetWeakPtr();
- AddMessageHandler((new ProfilerMessageHandler())->Attach(this));
+ AddMessageHandler(new ProfilerMessageHandler());
// Set up the chrome://profiler/ source.
Profile::FromBrowserContext(contents->GetBrowserContext())->
diff --git a/chrome/browser/ui/webui/quota_internals_handler.cc b/chrome/browser/ui/webui/quota_internals_handler.cc
index 7657ab1..2c68c5d 100644
--- a/chrome/browser/ui/webui/quota_internals_handler.cc
+++ b/chrome/browser/ui/webui/quota_internals_handler.cc
@@ -24,8 +24,7 @@ QuotaInternalsHandler::~QuotaInternalsHandler() {
}
void QuotaInternalsHandler::RegisterMessages() {
- DCHECK(web_ui_);
- web_ui_->RegisterMessageCallback("requestInfo",
+ web_ui()->RegisterMessageCallback("requestInfo",
base::Bind(&QuotaInternalsHandler::OnRequestInfo,
base::Unretained(this)));
}
@@ -76,15 +75,15 @@ void QuotaInternalsHandler::ReportStatistics(const Statistics& stats) {
void QuotaInternalsHandler::SendMessage(const std::string& message,
const base::Value& value) {
scoped_ptr<base::Value> message_data(base::Value::CreateStringValue(message));
- web_ui_->CallJavascriptFunction("cr.quota.messageHandler",
- *message_data,
- value);
+ web_ui()->CallJavascriptFunction("cr.quota.messageHandler",
+ *message_data,
+ value);
}
void QuotaInternalsHandler::OnRequestInfo(const base::ListValue*) {
if (!proxy_)
proxy_ = new QuotaInternalsProxy(this);
- proxy_->RequestInfo(Profile::FromWebUI(web_ui_)->GetQuotaManager());
+ proxy_->RequestInfo(Profile::FromWebUI(web_ui())->GetQuotaManager());
}
} // namespace quota_internals
diff --git a/chrome/browser/ui/webui/quota_internals_ui.cc b/chrome/browser/ui/webui/quota_internals_ui.cc
index b91ed18..d22d2a6 100644
--- a/chrome/browser/ui/webui/quota_internals_ui.cc
+++ b/chrome/browser/ui/webui/quota_internals_ui.cc
@@ -37,8 +37,7 @@ ChromeWebUIDataSource* CreateQuotaInternalsHTMLSource() {
QuotaInternalsUI::QuotaInternalsUI(TabContents* contents)
: ChromeWebUI(contents) {
- WebUIMessageHandler* handler = new quota_internals::QuotaInternalsHandler;
- AddMessageHandler(handler->Attach(this));
+ AddMessageHandler(new quota_internals::QuotaInternalsHandler);
Profile* profile = Profile::FromBrowserContext(contents->GetBrowserContext());
profile->GetChromeURLDataManager()->AddDataSource(
CreateQuotaInternalsHTMLSource());
diff --git a/chrome/browser/ui/webui/sessions_ui.cc b/chrome/browser/ui/webui/sessions_ui.cc
index fcc7709..5d9699f 100644
--- a/chrome/browser/ui/webui/sessions_ui.cc
+++ b/chrome/browser/ui/webui/sessions_ui.cc
@@ -63,7 +63,6 @@ class SessionsDOMHandler : public WebUIMessageHandler {
virtual ~SessionsDOMHandler();
// WebUIMessageHandler implementation.
- virtual WebUIMessageHandler* Attach(WebUI* web_ui) OVERRIDE;
virtual void RegisterMessages() OVERRIDE;
private:
@@ -108,12 +107,8 @@ SessionsDOMHandler::SessionsDOMHandler() {
SessionsDOMHandler::~SessionsDOMHandler() {
}
-WebUIMessageHandler* SessionsDOMHandler::Attach(WebUI* web_ui) {
- return WebUIMessageHandler::Attach(web_ui);
-}
-
void SessionsDOMHandler::RegisterMessages() {
- web_ui_->RegisterMessageCallback("requestSessionList",
+ web_ui()->RegisterMessageCallback("requestSessionList",
base::Bind(&SessionsDOMHandler::HandleRequestSessions,
base::Unretained(this)));
}
@@ -125,7 +120,7 @@ void SessionsDOMHandler::HandleRequestSessions(const ListValue* args) {
browser_sync::SessionModelAssociator* SessionsDOMHandler::GetModelAssociator() {
// We only want to get the model associator if there is one, and it is done
// syncing sessions.
- Profile* profile = Profile::FromWebUI(web_ui_);
+ Profile* profile = Profile::FromWebUI(web_ui());
if (!profile->HasProfileSyncService())
return NULL;
ProfileSyncService* service = profile->GetProfileSyncService();
@@ -245,9 +240,9 @@ void SessionsDOMHandler::UpdateUI() {
// Send the results to JavaScript, even if the lists are empty, so that the
// UI can show a message that there is nothing.
- web_ui_->CallJavascriptFunction("updateSessionList",
- session_list,
- magic_list);
+ web_ui()->CallJavascriptFunction("updateSessionList",
+ session_list,
+ magic_list);
}
} // namespace
@@ -259,7 +254,7 @@ void SessionsDOMHandler::UpdateUI() {
///////////////////////////////////////////////////////////////////////////////
SessionsUI::SessionsUI(TabContents* contents) : ChromeWebUI(contents) {
- AddMessageHandler((new SessionsDOMHandler())->Attach(this));
+ AddMessageHandler(new SessionsDOMHandler());
// Set up the chrome://sessions/ source.
Profile* profile = Profile::FromBrowserContext(contents->GetBrowserContext());
diff --git a/chrome/browser/ui/webui/ssl_client_certificate_selector_webui.cc b/chrome/browser/ui/webui/ssl_client_certificate_selector_webui.cc
index 94a000a..7cedfaf 100644
--- a/chrome/browser/ui/webui/ssl_client_certificate_selector_webui.cc
+++ b/chrome/browser/ui/webui/ssl_client_certificate_selector_webui.cc
@@ -233,10 +233,10 @@ bool SSLClientCertificateSelectorWebUI::ShouldShowDialogTitle() const {
// WebUIMessageHandler methods
void SSLClientCertificateSelectorWebUI::RegisterMessages() {
- web_ui_->RegisterMessageCallback("requestDetails",
+ web_ui()->RegisterMessageCallback("requestDetails",
base::Bind(&SSLClientCertificateSelectorWebUI::RequestDetails,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("viewCertificate",
+ web_ui()->RegisterMessageCallback("viewCertificate",
base::Bind(&SSLClientCertificateSelectorWebUI::ViewCertificate,
base::Unretained(this)));
}
@@ -269,7 +269,7 @@ void SSLClientCertificateSelectorWebUI::RequestDetails(
dict.Set("certificates", certificates);
dict.Set("details", details);
// Send list of tab contents details to javascript.
- web_ui_->CallJavascriptFunction(
+ web_ui()->CallJavascriptFunction(
"sslClientCertificateSelector.setDetails",
dict);
}
diff --git a/chrome/browser/ui/webui/sync_promo/sync_promo_handler.cc b/chrome/browser/ui/webui/sync_promo/sync_promo_handler.cc
index 3c3d085..37ddc04 100644
--- a/chrome/browser/ui/webui/sync_promo/sync_promo_handler.cc
+++ b/chrome/browser/ui/webui/sync_promo/sync_promo_handler.cc
@@ -79,47 +79,43 @@ void SyncPromoHandler::RegisterUserPrefs(PrefService* prefs) {
PrefService::UNSYNCABLE_PREF);
}
-WebUIMessageHandler* SyncPromoHandler::Attach(WebUI* web_ui) {
- DCHECK(web_ui);
+void SyncPromoHandler::RegisterMessages() {
// Keep a reference to the preferences service for convenience and it's
// probably a little faster that getting it via Profile::FromWebUI() every
// time we need to interact with preferences.
- prefs_ = Profile::FromWebUI(web_ui)->GetPrefs();
+ prefs_ = Profile::FromWebUI(web_ui())->GetPrefs();
DCHECK(prefs_);
// Ignore events from view-source:chrome://syncpromo.
- if (!web_ui->tab_contents()->GetController().GetActiveEntry()->
+ if (!web_ui()->tab_contents()->GetController().GetActiveEntry()->
IsViewSourceMode()) {
// Listen to see if the tab we're in gets closed.
registrar_.Add(this, content::NOTIFICATION_TAB_CLOSING,
content::Source<NavigationController>(
- &web_ui->tab_contents()->GetController()));
+ &web_ui()->tab_contents()->GetController()));
// Listen to see if the window we're in gets closed.
registrar_.Add(this, chrome::NOTIFICATION_BROWSER_CLOSING,
content::NotificationService::AllSources());
}
- return SyncSetupHandler::Attach(web_ui);
-}
-void SyncPromoHandler::RegisterMessages() {
- web_ui_->RegisterMessageCallback("SyncPromo:Close",
+ web_ui()->RegisterMessageCallback("SyncPromo:Close",
base::Bind(&SyncPromoHandler::HandleCloseSyncPromo,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("SyncPromo:Initialize",
+ web_ui()->RegisterMessageCallback("SyncPromo:Initialize",
base::Bind(&SyncPromoHandler::HandleInitializeSyncPromo,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("SyncPromo:RecordSignInAttempts",
+ web_ui()->RegisterMessageCallback("SyncPromo:RecordSignInAttempts",
base::Bind(&SyncPromoHandler::HandleRecordSignInAttempts,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("SyncPromo:RecordThrobberTime",
+ web_ui()->RegisterMessageCallback("SyncPromo:RecordThrobberTime",
base::Bind(&SyncPromoHandler::HandleRecordThrobberTime,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("SyncPromo:ShowAdvancedSettings",
+ web_ui()->RegisterMessageCallback("SyncPromo:ShowAdvancedSettings",
base::Bind(&SyncPromoHandler::HandleShowAdvancedSettings,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("SyncPromo:UserFlowAction",
+ web_ui()->RegisterMessageCallback("SyncPromo:UserFlowAction",
base::Bind(&SyncPromoHandler::HandleUserFlowAction,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("SyncPromo:UserSkipped",
+ web_ui()->RegisterMessageCallback("SyncPromo:UserSkipped",
base::Bind(&SyncPromoHandler::HandleUserSkipped,
base::Unretained(this)));
SyncSetupHandler::RegisterMessages();
@@ -167,7 +163,7 @@ void SyncPromoHandler::Observe(int type,
// Make sure we're in the tab strip of the closing window.
Browser* browser = content::Source<Browser>(source).ptr();
if (browser->tabstrip_model()->GetWrapperIndex(
- web_ui_->tab_contents()) != TabStripModel::kNoTab) {
+ web_ui()->tab_contents()) != TabStripModel::kNoTab) {
RecordUserFlowAction(SYNC_PROMO_CLOSED_WINDOW);
window_already_closed_ = true;
}
@@ -189,7 +185,7 @@ void SyncPromoHandler::ShowSetupUI() {
// StepWizardForShowSetupUI and ShowSetupUI.
// TODO(binji): Move this function back and fix the focus the right way.
ProfileSyncService* service =
- Profile::FromWebUI(web_ui_)->GetProfileSyncService();
+ Profile::FromWebUI(web_ui())->GetProfileSyncService();
service->get_wizard().Step(SyncSetupWizard::GetLoginState());
}
@@ -203,22 +199,22 @@ void SyncPromoHandler::HandleCloseSyncPromo(const base::ListValue* args) {
prefs_->SetBoolean(prefs::kSyncPromoShowNTPBubble, true);
GURL url = SyncPromoUI::GetNextPageURLForSyncPromoURL(
- web_ui_->tab_contents()->GetURL());
+ web_ui()->tab_contents()->GetURL());
OpenURLParams params(
url, Referrer(), CURRENT_TAB, content::PAGE_TRANSITION_LINK, false);
- web_ui_->tab_contents()->OpenURL(params);
+ web_ui()->tab_contents()->OpenURL(params);
}
void SyncPromoHandler::HandleInitializeSyncPromo(const base::ListValue* args) {
// If the promo is also the Chrome launch page, we want to show the title and
// log an event if we are running an experiment.
bool is_launch_page = SyncPromoUI::GetIsLaunchPageForSyncPromoURL(
- web_ui_->tab_contents()->GetURL());
+ web_ui()->tab_contents()->GetURL());
if (is_launch_page && sync_promo_trial::IsExperimentActive())
sync_promo_trial::RecordUserSawMessage();
base::FundamentalValue visible(is_launch_page);
- web_ui_->CallJavascriptFunction("SyncSetupOverlay.setPromoTitleVisible",
- visible);
+ web_ui()->CallJavascriptFunction("SyncSetupOverlay.setPromoTitleVisible",
+ visible);
OpenSyncSetup();
// We don't need to compute anything for this, just do this every time.
@@ -238,7 +234,7 @@ void SyncPromoHandler::HandleShowAdvancedSettings(
url += chrome::kSyncSetupSubPage;
OpenURLParams params(
GURL(url), Referrer(), CURRENT_TAB, content::PAGE_TRANSITION_LINK, false);
- web_ui_->tab_contents()->OpenURL(params);
+ web_ui()->tab_contents()->OpenURL(params);
RecordUserFlowAction(SYNC_PROMO_ADVANCED_CLICKED);
}
@@ -269,7 +265,7 @@ void SyncPromoHandler::HandleUserFlowAction(const base::ListValue* args) {
}
void SyncPromoHandler::HandleUserSkipped(const base::ListValue* args) {
- SyncPromoUI::SetUserSkippedSyncPromo(Profile::FromWebUI(web_ui_));
+ SyncPromoUI::SetUserSkippedSyncPromo(Profile::FromWebUI(web_ui()));
RecordUserFlowAction(SYNC_PROMO_SKIP_CLICKED);
}
@@ -291,8 +287,8 @@ void SyncPromoHandler::RecordExperimentOutcomesOnSignIn() {
sync_promo_trial::RecordUserSignedIn();
if (sync_promo_trial::IsPartOfBrandTrialToEnable()) {
bool is_start_up = SyncPromoUI::GetIsLaunchPageForSyncPromoURL(
- web_ui_->tab_contents()->GetURL());
- Profile* profile = Profile::FromWebUI(web_ui_);
+ web_ui()->tab_contents()->GetURL());
+ Profile* profile = Profile::FromWebUI(web_ui());
sync_promo_trial::RecordUserSignedInWithTrialBrand(is_start_up, profile);
}
}
diff --git a/chrome/browser/ui/webui/sync_promo/sync_promo_handler.h b/chrome/browser/ui/webui/sync_promo/sync_promo_handler.h
index c1f4737..97a3baf 100644
--- a/chrome/browser/ui/webui/sync_promo/sync_promo_handler.h
+++ b/chrome/browser/ui/webui/sync_promo/sync_promo_handler.h
@@ -21,7 +21,6 @@ class SyncPromoHandler : public SyncSetupHandler {
static void RegisterUserPrefs(PrefService* prefs);
// WebUIMessageHandler implementation.
- virtual WebUIMessageHandler* Attach(WebUI* web_ui) OVERRIDE;
virtual void RegisterMessages() OVERRIDE;
// SyncSetupFlowHandler implementation.
diff --git a/chrome/browser/ui/webui/sync_promo/sync_promo_ui.cc b/chrome/browser/ui/webui/sync_promo/sync_promo_ui.cc
index db0104b..290737e 100644
--- a/chrome/browser/ui/webui/sync_promo/sync_promo_ui.cc
+++ b/chrome/browser/ui/webui/sync_promo/sync_promo_ui.cc
@@ -109,7 +109,6 @@ SyncPromoUI::SyncPromoUI(TabContents* contents) : ChromeWebUI(contents) {
SyncPromoHandler* handler = new SyncPromoHandler(
g_browser_process->profile_manager());
AddMessageHandler(handler);
- handler->Attach(this);
// Set up the chrome://theme/ source.
Profile* profile = Profile::FromBrowserContext(contents->GetBrowserContext());
diff --git a/chrome/browser/ui/webui/sync_setup_handler.cc b/chrome/browser/ui/webui/sync_setup_handler.cc
index 2f7fae1..68aced3 100644
--- a/chrome/browser/ui/webui/sync_setup_handler.cc
+++ b/chrome/browser/ui/webui/sync_setup_handler.cc
@@ -186,7 +186,7 @@ SyncSetupHandler::~SyncSetupHandler() {
}
void SyncSetupHandler::GetLocalizedValues(DictionaryValue* localized_strings) {
- GetStaticLocalizedValues(localized_strings, web_ui_);
+ GetStaticLocalizedValues(localized_strings, web_ui());
}
void SyncSetupHandler::GetStaticLocalizedValues(
@@ -354,28 +354,28 @@ void SyncSetupHandler::OnGetOAuthTokenFailure(
}
void SyncSetupHandler::RegisterMessages() {
- web_ui_->RegisterMessageCallback("SyncSetupDidClosePage",
+ web_ui()->RegisterMessageCallback("SyncSetupDidClosePage",
base::Bind(&SyncSetupHandler::OnDidClosePage,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("SyncSetupSubmitAuth",
+ web_ui()->RegisterMessageCallback("SyncSetupSubmitAuth",
base::Bind(&SyncSetupHandler::HandleSubmitAuth,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("SyncSetupConfigure",
+ web_ui()->RegisterMessageCallback("SyncSetupConfigure",
base::Bind(&SyncSetupHandler::HandleConfigure,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("SyncSetupPassphrase",
+ web_ui()->RegisterMessageCallback("SyncSetupPassphrase",
base::Bind(&SyncSetupHandler::HandlePassphraseEntry,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("SyncSetupPassphraseCancel",
+ web_ui()->RegisterMessageCallback("SyncSetupPassphraseCancel",
base::Bind(&SyncSetupHandler::HandlePassphraseCancel,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("SyncSetupAttachHandler",
+ web_ui()->RegisterMessageCallback("SyncSetupAttachHandler",
base::Bind(&SyncSetupHandler::HandleAttachHandler,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("SyncSetupShowErrorUI",
+ web_ui()->RegisterMessageCallback("SyncSetupShowErrorUI",
base::Bind(&SyncSetupHandler::HandleShowErrorUI,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("SyncSetupShowSetupUI",
+ web_ui()->RegisterMessageCallback("SyncSetupShowSetupUI",
base::Bind(&SyncSetupHandler::HandleShowSetupUI,
base::Unretained(this)));
}
@@ -387,7 +387,7 @@ void SyncSetupHandler::RegisterMessages() {
void SyncSetupHandler::ShowOAuthLogin() {
DCHECK(browser_sync::IsUsingOAuth());
- Profile* profile = Profile::FromWebUI(web_ui_);
+ Profile* profile = Profile::FromWebUI(web_ui());
oauth_login_.reset(new GaiaOAuthFetcher(this,
profile->GetRequestContext(),
profile,
@@ -399,46 +399,46 @@ void SyncSetupHandler::ShowOAuthLogin() {
void SyncSetupHandler::ShowGaiaLogin(const DictionaryValue& args) {
DCHECK(!browser_sync::IsUsingOAuth());
StringValue page("login");
- web_ui_->CallJavascriptFunction(
+ web_ui()->CallJavascriptFunction(
"SyncSetupOverlay.showSyncSetupPage", page, args);
}
void SyncSetupHandler::ShowGaiaSuccessAndClose() {
- web_ui_->CallJavascriptFunction("SyncSetupOverlay.showSuccessAndClose");
+ web_ui()->CallJavascriptFunction("SyncSetupOverlay.showSuccessAndClose");
}
void SyncSetupHandler::ShowGaiaSuccessAndSettingUp() {
- web_ui_->CallJavascriptFunction("SyncSetupOverlay.showSuccessAndSettingUp");
+ web_ui()->CallJavascriptFunction("SyncSetupOverlay.showSuccessAndSettingUp");
}
void SyncSetupHandler::ShowConfigure(const DictionaryValue& args) {
StringValue page("configure");
- web_ui_->CallJavascriptFunction(
+ web_ui()->CallJavascriptFunction(
"SyncSetupOverlay.showSyncSetupPage", page, args);
}
void SyncSetupHandler::ShowPassphraseEntry(const DictionaryValue& args) {
StringValue page("passphrase");
- web_ui_->CallJavascriptFunction(
+ web_ui()->CallJavascriptFunction(
"SyncSetupOverlay.showSyncSetupPage", page, args);
}
void SyncSetupHandler::ShowSettingUp() {
StringValue page("settingUp");
- web_ui_->CallJavascriptFunction(
+ web_ui()->CallJavascriptFunction(
"SyncSetupOverlay.showSyncSetupPage", page);
}
void SyncSetupHandler::ShowSetupDone(const string16& user) {
StringValue page("done");
- web_ui_->CallJavascriptFunction(
+ web_ui()->CallJavascriptFunction(
"SyncSetupOverlay.showSyncSetupPage", page);
// Suppress the sync promo once the user signs into sync. This way the user
// doesn't see the sync promo even if they sign out of sync later on.
- SyncPromoUI::SetUserSkippedSyncPromo(Profile::FromWebUI(web_ui_));
+ SyncPromoUI::SetUserSkippedSyncPromo(Profile::FromWebUI(web_ui()));
- Profile* profile = Profile::FromWebUI(web_ui_);
+ Profile* profile = Profile::FromWebUI(web_ui());
ProfileSyncService* service = profile->GetProfileSyncService();
if (!service->HasSyncSetupCompleted()) {
FilePath profile_file_path = profile->GetPath();
@@ -451,7 +451,7 @@ void SyncSetupHandler::SetFlow(SyncSetupFlow* flow) {
}
void SyncSetupHandler::Focus() {
- static_cast<RenderViewHostDelegate*>(web_ui_->tab_contents())->Activate();
+ static_cast<RenderViewHostDelegate*>(web_ui()->tab_contents())->Activate();
}
void SyncSetupHandler::OnDidClosePage(const ListValue* args) {
@@ -553,7 +553,7 @@ void SyncSetupHandler::HandleAttachHandler(const ListValue* args) {
void SyncSetupHandler::HandleShowErrorUI(const ListValue* args) {
DCHECK(!flow_);
- Profile* profile = Profile::FromWebUI(web_ui_);
+ Profile* profile = Profile::FromWebUI(web_ui());
ProfileSyncService* service = profile->GetProfileSyncService();
DCHECK(service);
@@ -579,10 +579,9 @@ void SyncSetupHandler::CloseSyncSetup() {
}
void SyncSetupHandler::OpenSyncSetup() {
- DCHECK(web_ui_);
DCHECK(!flow_);
- Profile* profile = Profile::FromWebUI(web_ui_);
+ Profile* profile = Profile::FromWebUI(web_ui());
ProfileSyncService* service = profile->GetProfileSyncService();
if (!service) {
// If there's no sync service, the user tried to manually invoke a syncSetup
@@ -616,7 +615,7 @@ void SyncSetupHandler::OpenSyncSetup() {
// Private member functions.
bool SyncSetupHandler::FocusExistingWizard() {
- Profile* profile = Profile::FromWebUI(web_ui_);
+ Profile* profile = Profile::FromWebUI(web_ui());
ProfileSyncService* service = profile->GetProfileSyncService();
if (!service)
return false;
@@ -630,13 +629,13 @@ bool SyncSetupHandler::FocusExistingWizard() {
}
void SyncSetupHandler::CloseOverlay() {
- web_ui_->CallJavascriptFunction("OptionsPage.closeOverlay");
+ web_ui()->CallJavascriptFunction("OptionsPage.closeOverlay");
}
bool SyncSetupHandler::IsLoginAuthDataValid(const std::string& username,
string16* error_message) {
// Happens during unit tests.
- if (!web_ui_ || !profile_manager_)
+ if (!web_ui() || !profile_manager_)
return true;
if (username.empty())
@@ -645,7 +644,7 @@ bool SyncSetupHandler::IsLoginAuthDataValid(const std::string& username,
// Check if the username is already in use by another profile.
const ProfileInfoCache& cache = profile_manager_->GetProfileInfoCache();
size_t current_profile_index = cache.GetIndexOfProfileWithPath(
- Profile::FromWebUI(web_ui_)->GetPath());
+ Profile::FromWebUI(web_ui())->GetPath());
string16 username_utf16 = UTF8ToUTF16(username);
for (size_t i = 0; i < cache.GetNumberOfProfiles(); ++i) {
@@ -662,7 +661,7 @@ bool SyncSetupHandler::IsLoginAuthDataValid(const std::string& username,
void SyncSetupHandler::ShowLoginErrorMessage(const string16& error_message) {
DictionaryValue args;
- Profile* profile = Profile::FromWebUI(web_ui_);
+ Profile* profile = Profile::FromWebUI(web_ui());
ProfileSyncService* service = profile->GetProfileSyncService();
SyncSetupFlow::GetArgsForGaiaLogin(service, &args);
args.SetString("error_message", error_message);
diff --git a/chrome/browser/ui/webui/sync_setup_handler2.cc b/chrome/browser/ui/webui/sync_setup_handler2.cc
index a0f631f..9ac8727 100644
--- a/chrome/browser/ui/webui/sync_setup_handler2.cc
+++ b/chrome/browser/ui/webui/sync_setup_handler2.cc
@@ -189,7 +189,7 @@ SyncSetupHandler2::~SyncSetupHandler2() {
}
void SyncSetupHandler2::GetLocalizedValues(DictionaryValue* localized_strings) {
- GetStaticLocalizedValues(localized_strings, web_ui_);
+ GetStaticLocalizedValues(localized_strings, web_ui());
}
void SyncSetupHandler2::GetStaticLocalizedValues(
@@ -357,28 +357,28 @@ void SyncSetupHandler2::OnGetOAuthTokenFailure(
}
void SyncSetupHandler2::RegisterMessages() {
- web_ui_->RegisterMessageCallback("SyncSetupDidClosePage",
+ web_ui()->RegisterMessageCallback("SyncSetupDidClosePage",
base::Bind(&SyncSetupHandler2::OnDidClosePage,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("SyncSetupSubmitAuth",
+ web_ui()->RegisterMessageCallback("SyncSetupSubmitAuth",
base::Bind(&SyncSetupHandler2::HandleSubmitAuth,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("SyncSetupConfigure",
+ web_ui()->RegisterMessageCallback("SyncSetupConfigure",
base::Bind(&SyncSetupHandler2::HandleConfigure,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("SyncSetupPassphrase",
+ web_ui()->RegisterMessageCallback("SyncSetupPassphrase",
base::Bind(&SyncSetupHandler2::HandlePassphraseEntry,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("SyncSetupPassphraseCancel",
+ web_ui()->RegisterMessageCallback("SyncSetupPassphraseCancel",
base::Bind(&SyncSetupHandler2::HandlePassphraseCancel,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("SyncSetupAttachHandler",
+ web_ui()->RegisterMessageCallback("SyncSetupAttachHandler",
base::Bind(&SyncSetupHandler2::HandleAttachHandler,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("SyncSetupShowErrorUI",
+ web_ui()->RegisterMessageCallback("SyncSetupShowErrorUI",
base::Bind(&SyncSetupHandler2::HandleShowErrorUI,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("SyncSetupShowSetupUI",
+ web_ui()->RegisterMessageCallback("SyncSetupShowSetupUI",
base::Bind(&SyncSetupHandler2::HandleShowSetupUI,
base::Unretained(this)));
}
@@ -390,7 +390,7 @@ void SyncSetupHandler2::RegisterMessages() {
void SyncSetupHandler2::ShowOAuthLogin() {
DCHECK(browser_sync::IsUsingOAuth());
- Profile* profile = Profile::FromWebUI(web_ui_);
+ Profile* profile = Profile::FromWebUI(web_ui());
oauth_login_.reset(new GaiaOAuthFetcher(this,
profile->GetRequestContext(),
profile,
@@ -402,46 +402,46 @@ void SyncSetupHandler2::ShowOAuthLogin() {
void SyncSetupHandler2::ShowGaiaLogin(const DictionaryValue& args) {
DCHECK(!browser_sync::IsUsingOAuth());
StringValue page("login");
- web_ui_->CallJavascriptFunction(
+ web_ui()->CallJavascriptFunction(
"SyncSetupOverlay.showSyncSetupPage", page, args);
}
void SyncSetupHandler2::ShowGaiaSuccessAndClose() {
- web_ui_->CallJavascriptFunction("SyncSetupOverlay.showSuccessAndClose");
+ web_ui()->CallJavascriptFunction("SyncSetupOverlay.showSuccessAndClose");
}
void SyncSetupHandler2::ShowGaiaSuccessAndSettingUp() {
- web_ui_->CallJavascriptFunction("SyncSetupOverlay.showSuccessAndSettingUp");
+ web_ui()->CallJavascriptFunction("SyncSetupOverlay.showSuccessAndSettingUp");
}
void SyncSetupHandler2::ShowConfigure(const DictionaryValue& args) {
StringValue page("configure");
- web_ui_->CallJavascriptFunction(
+ web_ui()->CallJavascriptFunction(
"SyncSetupOverlay.showSyncSetupPage", page, args);
}
void SyncSetupHandler2::ShowPassphraseEntry(const DictionaryValue& args) {
StringValue page("passphrase");
- web_ui_->CallJavascriptFunction(
+ web_ui()->CallJavascriptFunction(
"SyncSetupOverlay.showSyncSetupPage", page, args);
}
void SyncSetupHandler2::ShowSettingUp() {
StringValue page("settingUp");
- web_ui_->CallJavascriptFunction(
+ web_ui()->CallJavascriptFunction(
"SyncSetupOverlay.showSyncSetupPage", page);
}
void SyncSetupHandler2::ShowSetupDone(const string16& user) {
StringValue page("done");
- web_ui_->CallJavascriptFunction(
+ web_ui()->CallJavascriptFunction(
"SyncSetupOverlay.showSyncSetupPage", page);
// Suppress the sync promo once the user signs into sync. This way the user
// doesn't see the sync promo even if they sign out of sync later on.
- SyncPromoUI::SetUserSkippedSyncPromo(Profile::FromWebUI(web_ui_));
+ SyncPromoUI::SetUserSkippedSyncPromo(Profile::FromWebUI(web_ui()));
- Profile* profile = Profile::FromWebUI(web_ui_);
+ Profile* profile = Profile::FromWebUI(web_ui());
ProfileSyncService* service = profile->GetProfileSyncService();
if (!service->HasSyncSetupCompleted()) {
FilePath profile_file_path = profile->GetPath();
@@ -454,7 +454,7 @@ void SyncSetupHandler2::SetFlow(SyncSetupFlow* flow) {
}
void SyncSetupHandler2::Focus() {
- static_cast<RenderViewHostDelegate*>(web_ui_->tab_contents())->Activate();
+ static_cast<RenderViewHostDelegate*>(web_ui()->tab_contents())->Activate();
}
void SyncSetupHandler2::OnDidClosePage(const ListValue* args) {
@@ -556,7 +556,7 @@ void SyncSetupHandler2::HandleAttachHandler(const ListValue* args) {
void SyncSetupHandler2::HandleShowErrorUI(const ListValue* args) {
DCHECK(!flow_);
- Profile* profile = Profile::FromWebUI(web_ui_);
+ Profile* profile = Profile::FromWebUI(web_ui());
ProfileSyncService* service = profile->GetProfileSyncService();
DCHECK(service);
@@ -580,10 +580,9 @@ void SyncSetupHandler2::CloseSyncSetup() {
}
void SyncSetupHandler2::OpenSyncSetup() {
- DCHECK(web_ui_);
DCHECK(!flow_);
- Profile* profile = Profile::FromWebUI(web_ui_);
+ Profile* profile = Profile::FromWebUI(web_ui());
ProfileSyncService* service = profile->GetProfileSyncService();
if (!service) {
// If there's no sync service, the user tried to manually invoke a syncSetup
@@ -613,7 +612,7 @@ void SyncSetupHandler2::OpenSyncSetup() {
// Private member functions.
bool SyncSetupHandler2::FocusExistingWizard() {
- Profile* profile = Profile::FromWebUI(web_ui_);
+ Profile* profile = Profile::FromWebUI(web_ui());
ProfileSyncService* service = profile->GetProfileSyncService();
if (!service)
return false;
@@ -627,13 +626,13 @@ bool SyncSetupHandler2::FocusExistingWizard() {
}
void SyncSetupHandler2::CloseOverlay() {
- web_ui_->CallJavascriptFunction("OptionsPage.closeOverlay");
+ web_ui()->CallJavascriptFunction("OptionsPage.closeOverlay");
}
bool SyncSetupHandler2::IsLoginAuthDataValid(const std::string& username,
string16* error_message) {
// Happens during unit tests.
- if (!web_ui_ || !profile_manager_)
+ if (!web_ui() || !profile_manager_)
return true;
if (username.empty())
@@ -642,7 +641,7 @@ bool SyncSetupHandler2::IsLoginAuthDataValid(const std::string& username,
// Check if the username is already in use by another profile.
const ProfileInfoCache& cache = profile_manager_->GetProfileInfoCache();
size_t current_profile_index = cache.GetIndexOfProfileWithPath(
- Profile::FromWebUI(web_ui_)->GetPath());
+ Profile::FromWebUI(web_ui())->GetPath());
string16 username_utf16 = UTF8ToUTF16(username);
for (size_t i = 0; i < cache.GetNumberOfProfiles(); ++i) {
@@ -659,7 +658,7 @@ bool SyncSetupHandler2::IsLoginAuthDataValid(const std::string& username,
void SyncSetupHandler2::ShowLoginErrorMessage(const string16& error_message) {
DictionaryValue args;
- Profile* profile = Profile::FromWebUI(web_ui_);
+ Profile* profile = Profile::FromWebUI(web_ui());
ProfileSyncService* service = profile->GetProfileSyncService();
SyncSetupFlow::GetArgsForGaiaLogin(service, &args);
args.SetString("error_message", error_message);
diff --git a/chrome/browser/ui/webui/task_manager_handler.cc b/chrome/browser/ui/webui/task_manager_handler.cc
index eab8ec2a..1c4a3b1 100644
--- a/chrome/browser/ui/webui/task_manager_handler.cc
+++ b/chrome/browser/ui/webui/task_manager_handler.cc
@@ -220,8 +220,8 @@ void TaskManagerHandler::OnModelChanged() {
tasks_value.Append(CreateTaskGroupValue(model_, i));
if (is_enabled_) {
- web_ui_->CallJavascriptFunction("taskChanged",
- start_value, length_value, tasks_value);
+ web_ui()->CallJavascriptFunction("taskChanged",
+ start_value, length_value, tasks_value);
}
}
@@ -303,26 +303,23 @@ void TaskManagerHandler::OnItemsRemoved(const int start, const int length) {
OnGroupRemoved(group_start, group_end - group_start + 1);
}
-void TaskManagerHandler::Init() {
-}
-
void TaskManagerHandler::RegisterMessages() {
- web_ui_->RegisterMessageCallback("killProcesses",
+ web_ui()->RegisterMessageCallback("killProcesses",
base::Bind(&TaskManagerHandler::HandleKillProcesses,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("inspect",
+ web_ui()->RegisterMessageCallback("inspect",
base::Bind(&TaskManagerHandler::HandleInspect,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("activatePage",
+ web_ui()->RegisterMessageCallback("activatePage",
base::Bind(&TaskManagerHandler::HandleActivatePage,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("openAboutMemory",
+ web_ui()->RegisterMessageCallback("openAboutMemory",
base::Bind(&TaskManagerHandler::OpenAboutMemory,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("enableTaskManager",
+ web_ui()->RegisterMessageCallback("enableTaskManager",
base::Bind(&TaskManagerHandler::EnableTaskManager,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("disableTaskManager",
+ web_ui()->RegisterMessageCallback("disableTaskManager",
base::Bind(&TaskManagerHandler::DisableTaskManager,
base::Unretained(this)));
}
@@ -405,7 +402,7 @@ void TaskManagerHandler::EnableTaskManager(const ListValue* indexes) {
}
void TaskManagerHandler::OpenAboutMemory(const ListValue* indexes) {
- RenderViewHost* rvh = web_ui_->tab_contents()->GetRenderViewHost();
+ RenderViewHost* rvh = web_ui()->tab_contents()->GetRenderViewHost();
if (rvh && rvh->delegate()) {
WebPreferences webkit_prefs = rvh->delegate()->GetWebkitPrefs();
webkit_prefs.allow_scripts_to_close_windows = true;
@@ -420,7 +417,7 @@ void TaskManagerHandler::OpenAboutMemory(const ListValue* indexes) {
// TaskManagerHandler, private: -----------------------------------------------
bool TaskManagerHandler::is_alive() {
- return web_ui_->tab_contents()->GetRenderViewHost() != NULL;
+ return web_ui()->tab_contents()->GetRenderViewHost() != NULL;
}
void TaskManagerHandler::UpdateResourceGroupTable(int start, int length) {
@@ -449,8 +446,8 @@ void TaskManagerHandler::OnGroupChanged(const int group_start,
tasks_value.Append(CreateTaskGroupValue(model_, group_start + i));
if (is_enabled_ && is_alive()) {
- web_ui_->CallJavascriptFunction("taskChanged",
- start_value, length_value, tasks_value);
+ web_ui()->CallJavascriptFunction("taskChanged",
+ start_value, length_value, tasks_value);
}
}
@@ -463,8 +460,8 @@ void TaskManagerHandler::OnGroupAdded(const int group_start,
tasks_value.Append(CreateTaskGroupValue(model_, group_start + i));
if (is_enabled_ && is_alive()) {
- web_ui_->CallJavascriptFunction("taskAdded",
- start_value, length_value, tasks_value);
+ web_ui()->CallJavascriptFunction("taskAdded",
+ start_value, length_value, tasks_value);
}
}
@@ -473,5 +470,5 @@ void TaskManagerHandler::OnGroupRemoved(const int group_start,
base::FundamentalValue start_value(group_start);
base::FundamentalValue length_value(group_length);
if (is_enabled_ && is_alive())
- web_ui_->CallJavascriptFunction("taskRemoved", start_value, length_value);
+ web_ui()->CallJavascriptFunction("taskRemoved", start_value, length_value);
}
diff --git a/chrome/browser/ui/webui/task_manager_handler.h b/chrome/browser/ui/webui/task_manager_handler.h
index 9e3d0701..6d03a0d 100644
--- a/chrome/browser/ui/webui/task_manager_handler.h
+++ b/chrome/browser/ui/webui/task_manager_handler.h
@@ -20,8 +20,6 @@ class TaskManagerHandler : public WebUIMessageHandler,
explicit TaskManagerHandler(TaskManager* tm);
virtual ~TaskManagerHandler();
- void Init();
-
// TaskManagerModelObserver implementation.
// Invoked when the model has been completely changed.
virtual void OnModelChanged() OVERRIDE;
diff --git a/chrome/browser/ui/webui/task_manager_ui.cc b/chrome/browser/ui/webui/task_manager_ui.cc
index 5252c55..7806ea1 100644
--- a/chrome/browser/ui/webui/task_manager_ui.cc
+++ b/chrome/browser/ui/webui/task_manager_ui.cc
@@ -76,12 +76,7 @@ ChromeWebUIDataSource* CreateTaskManagerUIHTMLSource() {
///////////////////////////////////////////////////////////////////////////////
TaskManagerUI::TaskManagerUI(TabContents* contents) : ChromeWebUI(contents) {
- TaskManagerHandler* handler =
- new TaskManagerHandler(TaskManager::GetInstance());
-
- handler->Attach(this);
- handler->Init();
- AddMessageHandler(handler);
+ AddMessageHandler(new TaskManagerHandler(TaskManager::GetInstance()));
// Set up the chrome://taskmanager/ source.
ChromeWebUIDataSource* html_source = CreateTaskManagerUIHTMLSource();
diff --git a/chrome/browser/ui/webui/tracing_ui.cc b/chrome/browser/ui/webui/tracing_ui.cc
index 571f9d2..d92791e 100644
--- a/chrome/browser/ui/webui/tracing_ui.cc
+++ b/chrome/browser/ui/webui/tracing_ui.cc
@@ -57,7 +57,6 @@ class TracingMessageHandler
virtual ~TracingMessageHandler();
// WebUIMessageHandler implementation.
- virtual WebUIMessageHandler* Attach(WebUI* web_ui);
virtual void RegisterMessages();
// SelectFileDialog::Listener implementation
@@ -153,31 +152,25 @@ TracingMessageHandler::~TracingMessageHandler() {
TraceController::GetInstance()->CancelSubscriber(this);
}
-WebUIMessageHandler* TracingMessageHandler::Attach(WebUI* web_ui) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
- WebUIMessageHandler* result = WebUIMessageHandler::Attach(web_ui);
- return result;
-}
-
void TracingMessageHandler::RegisterMessages() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
- web_ui_->RegisterMessageCallback("tracingControllerInitialized",
+ web_ui()->RegisterMessageCallback("tracingControllerInitialized",
base::Bind(&TracingMessageHandler::OnTracingControllerInitialized,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("beginTracing",
+ web_ui()->RegisterMessageCallback("beginTracing",
base::Bind(&TracingMessageHandler::OnBeginTracing,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("endTracingAsync",
+ web_ui()->RegisterMessageCallback("endTracingAsync",
base::Bind(&TracingMessageHandler::OnEndTracingAsync,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("beginRequestBufferPercentFull",
+ web_ui()->RegisterMessageCallback("beginRequestBufferPercentFull",
base::Bind(&TracingMessageHandler::OnBeginRequestBufferPercentFull,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("loadTraceFile",
+ web_ui()->RegisterMessageCallback("loadTraceFile",
base::Bind(&TracingMessageHandler::OnLoadTraceFile,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("saveTraceFile",
+ web_ui()->RegisterMessageCallback("saveTraceFile",
base::Bind(&TracingMessageHandler::OnSaveTraceFile,
base::Unretained(this)));
}
@@ -222,8 +215,8 @@ void TracingMessageHandler::OnTracingControllerInitialized(
dict->SetString("blacklist_version",
GpuDataManager::GetInstance()->GetBlacklistVersion());
- web_ui_->CallJavascriptFunction("tracingController.onClientInfoUpdate",
- *dict);
+ web_ui()->CallJavascriptFunction("tracingController.onClientInfoUpdate",
+ *dict);
}
}
@@ -243,7 +236,7 @@ void TracingMessageHandler::OnGpuInfoUpdate() {
gpu_info_val->Set("featureStatus", feature_status);
// Send GPU Info to javascript.
- web_ui_->CallJavascriptFunction("tracingController.onGpuInfoUpdate",
+ web_ui()->CallJavascriptFunction("tracingController.onGpuInfoUpdate",
*(gpu_info_val.get()));
}
@@ -294,10 +287,10 @@ void TracingMessageHandler::FileSelected(
void TracingMessageHandler::FileSelectionCanceled(void* params) {
select_trace_file_dialog_.release();
if (select_trace_file_dialog_type_ == SelectFileDialog::SELECT_OPEN_FILE) {
- web_ui_->CallJavascriptFunction(
+ web_ui()->CallJavascriptFunction(
"tracingController.onLoadTraceFileCanceled");
} else {
- web_ui_->CallJavascriptFunction(
+ web_ui()->CallJavascriptFunction(
"tracingController.onSaveTraceFileCanceled");
}
}
@@ -312,8 +305,8 @@ void TracingMessageHandler::OnLoadTraceFile(const ListValue* list) {
SelectFileDialog::SELECT_OPEN_FILE,
string16(),
FilePath(),
- NULL, 0, FILE_PATH_LITERAL(""), web_ui_->tab_contents(),
- web_ui_->tab_contents()->GetView()->GetTopLevelNativeWindow(), NULL);
+ NULL, 0, FILE_PATH_LITERAL(""), web_ui()->tab_contents(),
+ web_ui()->tab_contents()->GetView()->GetTopLevelNativeWindow(), NULL);
}
void TracingMessageHandler::LoadTraceFileComplete(std::string* file_contents) {
@@ -321,7 +314,7 @@ void TracingMessageHandler::LoadTraceFileComplete(std::string* file_contents) {
std::string javascript = "tracingController.onLoadTraceFileComplete("
+ *file_contents + ");";
- web_ui_->tab_contents()->GetRenderViewHost()->
+ web_ui()->tab_contents()->GetRenderViewHost()->
ExecuteJavascriptInWebFrame(string16(), UTF8ToUTF16(javascript));
}
@@ -343,13 +336,13 @@ void TracingMessageHandler::OnSaveTraceFile(const ListValue* list) {
SelectFileDialog::SELECT_SAVEAS_FILE,
string16(),
FilePath(),
- NULL, 0, FILE_PATH_LITERAL(""), web_ui_->tab_contents(),
- web_ui_->tab_contents()->GetView()->GetTopLevelNativeWindow(), NULL);
+ NULL, 0, FILE_PATH_LITERAL(""), web_ui()->tab_contents(),
+ web_ui()->tab_contents()->GetView()->GetTopLevelNativeWindow(), NULL);
}
void TracingMessageHandler::SaveTraceFileComplete() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
- web_ui_->CallJavascriptFunction("tracingController.onSaveTraceFileComplete");
+ web_ui()->CallJavascriptFunction("tracingController.onSaveTraceFileComplete");
}
void TracingMessageHandler::OnBeginTracing(const ListValue* args) {
@@ -379,7 +372,7 @@ void TracingMessageHandler::OnEndTracingAsync(const ListValue* list) {
void TracingMessageHandler::OnEndTracingComplete() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
trace_enabled_ = false;
- web_ui_->CallJavascriptFunction("tracingController.onEndTracingComplete");
+ web_ui()->CallJavascriptFunction("tracingController.onEndTracingComplete");
}
void TracingMessageHandler::OnTraceDataCollected(
@@ -395,13 +388,13 @@ void TracingMessageHandler::OnTraceDataCollected(
trace_buffer.Finish();
output.Append(");");
- web_ui_->tab_contents()->GetRenderViewHost()->
+ web_ui()->tab_contents()->GetRenderViewHost()->
ExecuteJavascriptInWebFrame(string16(), UTF8ToUTF16(output.json_output));
}
void TracingMessageHandler::OnTraceBufferPercentFullReply(float percent_full) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
- web_ui_->CallJavascriptFunction(
+ web_ui()->CallJavascriptFunction(
"tracingController.onRequestBufferPercentFullComplete",
*scoped_ptr<Value>(Value::CreateDoubleValue(percent_full)));
}
@@ -416,7 +409,7 @@ void TracingMessageHandler::OnTraceBufferPercentFullReply(float percent_full) {
////////////////////////////////////////////////////////////////////////////////
TracingUI::TracingUI(TabContents* contents) : ChromeWebUI(contents) {
- AddMessageHandler((new TracingMessageHandler())->Attach(this));
+ AddMessageHandler(new TracingMessageHandler());
// Set up the chrome://tracing/ source.
Profile::FromBrowserContext(contents->GetBrowserContext())->
diff --git a/chrome/browser/ui/webui/web_ui_browsertest.cc b/chrome/browser/ui/webui/web_ui_browsertest.cc
index d94e5b7..181b363 100644
--- a/chrome/browser/ui/webui/web_ui_browsertest.cc
+++ b/chrome/browser/ui/webui/web_ui_browsertest.cc
@@ -408,10 +408,13 @@ void WebUIBrowserTest::SetupHandlers() {
browser()->GetSelectedTabContents()->GetWebUI();
ASSERT_TRUE(web_ui_instance != NULL);
web_ui_instance->set_register_callback_overwrites(true);
- test_handler_->Attach(web_ui_instance);
+ test_handler_->set_web_ui(web_ui_instance);
+ test_handler_->RegisterMessages();
- if (GetMockMessageHandler())
- GetMockMessageHandler()->Attach(web_ui_instance);
+ if (GetMockMessageHandler()) {
+ GetMockMessageHandler()->set_web_ui(web_ui_instance);
+ GetMockMessageHandler()->RegisterMessages();
+ }
}
// According to the interface for EXPECT_FATAL_FAILURE
@@ -507,16 +510,16 @@ class WebUIBrowserAsyncTest : public WebUIBrowserTest {
private:
virtual void RegisterMessages() OVERRIDE {
- web_ui_->RegisterMessageCallback("startAsyncTest",
+ web_ui()->RegisterMessageCallback("startAsyncTest",
base::Bind(&AsyncWebUIMessageHandler::HandleStartAsyncTest,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("testContinues",
+ web_ui()->RegisterMessageCallback("testContinues",
base::Bind(&AsyncWebUIMessageHandler::HandleTestContinues,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("testFails",
+ web_ui()->RegisterMessageCallback("testFails",
base::Bind(&AsyncWebUIMessageHandler::HandleTestFails,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("testPasses",
+ web_ui()->RegisterMessageCallback("testPasses",
base::Bind(&AsyncWebUIMessageHandler::HandleTestPasses,
base::Unretained(this)));
}
@@ -525,7 +528,7 @@ class WebUIBrowserAsyncTest : public WebUIBrowserTest {
void HandleStartAsyncTest(const ListValue* list_value) {
Value* test_name;
ASSERT_TRUE(list_value->Get(0, &test_name));
- web_ui_->CallJavascriptFunction("runAsync", *test_name);
+ web_ui()->CallJavascriptFunction("runAsync", *test_name);
}
DISALLOW_COPY_AND_ASSIGN(AsyncWebUIMessageHandler);
diff --git a/chrome/browser/ui/webui/web_ui_test_handler.cc b/chrome/browser/ui/webui/web_ui_test_handler.cc
index 69efe4c..155fb79 100644
--- a/chrome/browser/ui/webui/web_ui_test_handler.cc
+++ b/chrome/browser/ui/webui/web_ui_test_handler.cc
@@ -33,14 +33,14 @@ void WebUITestHandler::PreloadJavaScript(const string16& js_text,
}
void WebUITestHandler::RunJavaScript(const string16& js_text) {
- web_ui_->tab_contents()->GetRenderViewHost()->ExecuteJavascriptInWebFrame(
+ web_ui()->tab_contents()->GetRenderViewHost()->ExecuteJavascriptInWebFrame(
string16(), js_text);
}
bool WebUITestHandler::RunJavaScriptTestWithResult(const string16& js_text) {
test_succeeded_ = false;
run_test_succeeded_ = false;
- RenderViewHost* rvh = web_ui_->tab_contents()->GetRenderViewHost();
+ RenderViewHost* rvh = web_ui()->tab_contents()->GetRenderViewHost();
content::NotificationRegistrar notification_registrar;
notification_registrar.Add(
this, content::NOTIFICATION_EXECUTE_JAVASCRIPT_RESULT,
@@ -50,7 +50,7 @@ bool WebUITestHandler::RunJavaScriptTestWithResult(const string16& js_text) {
}
void WebUITestHandler::RegisterMessages() {
- web_ui_->RegisterMessageCallback("testResult",
+ web_ui()->RegisterMessageCallback("testResult",
base::Bind(&WebUITestHandler::HandleTestResult, base::Unretained(this)));
}
diff --git a/chrome/browser/ui/webui/web_ui_test_handler.h b/chrome/browser/ui/webui/web_ui_test_handler.h
index 64593a6..0c46221 100644
--- a/chrome/browser/ui/webui/web_ui_test_handler.h
+++ b/chrome/browser/ui/webui/web_ui_test_handler.h
@@ -34,11 +34,11 @@ class WebUITestHandler : public WebUIMessageHandler,
// error message on failure. Returns test pass/fail.
bool RunJavaScriptTestWithResult(const string16& js_text);
- private:
// WebUIMessageHandler overrides.
// Add test handlers to the current WebUI object.
virtual void RegisterMessages() OVERRIDE;
+ private:
// Receives testResult messages.
void HandleTestResult(const base::ListValue* test_result);
diff --git a/chrome/browser/ui/webui/workers_ui.cc b/chrome/browser/ui/webui/workers_ui.cc
index 9a702e3..53237a3 100644
--- a/chrome/browser/ui/webui/workers_ui.cc
+++ b/chrome/browser/ui/webui/workers_ui.cc
@@ -123,10 +123,10 @@ class WorkersDOMHandler : public WebUIMessageHandler {
};
void WorkersDOMHandler::RegisterMessages() {
- web_ui_->RegisterMessageCallback(kOpenDevToolsCommand,
+ web_ui()->RegisterMessageCallback(kOpenDevToolsCommand,
base::Bind(&WorkersDOMHandler::HandleOpenDevTools,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback(kTerminateWorkerCommand,
+ web_ui()->RegisterMessageCallback(kTerminateWorkerCommand,
base::Bind(&WorkersDOMHandler::HandleTerminateWorker,
base::Unretained(this)));
}
@@ -143,7 +143,7 @@ void WorkersDOMHandler::HandleOpenDevTools(const ListValue* args) {
&worker_process_host_id));
CHECK(base::StringToInt(worker_route_id_str, &worker_route_id));
- Profile* profile = Profile::FromWebUI(web_ui_);
+ Profile* profile = Profile::FromWebUI(web_ui());
if (!profile)
return;
DevToolsAgentHost* agent_host =
@@ -252,9 +252,7 @@ class WorkersUI::WorkerCreationDestructionListener
WorkersUI::WorkersUI(TabContents* contents)
: ChromeWebUI(contents),
observer_(new WorkerCreationDestructionListener(this)){
- WorkersDOMHandler* handler = new WorkersDOMHandler();
- AddMessageHandler(handler);
- handler->Attach(this);
+ AddMessageHandler(new WorkersDOMHandler());
WorkersUIHTMLSource* html_source = new WorkersUIHTMLSource();
diff --git a/chrome/test/data/webui/async_gen.cc b/chrome/test/data/webui/async_gen.cc
index 1291bbd..d69fe6f 100644
--- a/chrome/test/data/webui/async_gen.cc
+++ b/chrome/test/data/webui/async_gen.cc
@@ -22,14 +22,14 @@ void WebUIBrowserAsyncGenTest::AsyncWebUIMessageHandler::HandleCallJS(
const base::ListValue* list_value) {
std::string call_js;
ASSERT_TRUE(list_value->GetString(0, &call_js));
- web_ui_->CallJavascriptFunction(call_js);
+ web_ui()->CallJavascriptFunction(call_js);
}
void WebUIBrowserAsyncGenTest::AsyncWebUIMessageHandler::RegisterMessages() {
- web_ui_->RegisterMessageCallback(
+ web_ui()->RegisterMessageCallback(
"callJS", base::Bind(&AsyncWebUIMessageHandler::HandleCallJS,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback(
+ web_ui()->RegisterMessageCallback(
"tearDown", base::Bind(&AsyncWebUIMessageHandler::HandleTearDown,
base::Unretained(this)));
}
diff --git a/chrome/test/data/webui/chrome_send_browsertest.cc b/chrome/test/data/webui/chrome_send_browsertest.cc
index b835d98..0c29554 100644
--- a/chrome/test/data/webui/chrome_send_browsertest.cc
+++ b/chrome/test/data/webui/chrome_send_browsertest.cc
@@ -20,7 +20,7 @@ ChromeSendWebUITest::ChromeSendWebUIMessageHandler::
~ChromeSendWebUIMessageHandler() {}
void ChromeSendWebUITest::ChromeSendWebUIMessageHandler::RegisterMessages() {
- web_ui_->RegisterMessageCallback(
+ web_ui()->RegisterMessageCallback(
"checkSend",
base::Bind(&ChromeSendWebUIMessageHandler::HandleCheckSend,
base::Unretained(this)));