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

Unified Diff: chrome/browser/ui/webui/options/advanced_options_handler.cc

Issue 6954001: Add "Keep chrome running in background" preference. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed problem that was making UI visible on Mac. Created 9 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/webui/options/advanced_options_handler.h ('k') | chrome/common/pref_names.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/webui/options/advanced_options_handler.cc
diff --git a/chrome/browser/ui/webui/options/advanced_options_handler.cc b/chrome/browser/ui/webui/options/advanced_options_handler.cc
index 2abb4d2f547587b0ed64c4e92423d05c711475ff..2f7f0ea8583b8d5f6040b43db1fd58d1ffe7e7cb 100644
--- a/chrome/browser/ui/webui/options/advanced_options_handler.cc
+++ b/chrome/browser/ui/webui/options/advanced_options_handler.cc
@@ -162,6 +162,12 @@ void AdvancedOptionsHandler::GetLocalizedValues(
{ "cloudPrintProxyEnablingButton",
IDS_OPTIONS_CLOUD_PRINT_PROXY_ENABLING_BUTTON },
#endif
+#if !defined(OS_MACOSX) && !defined(OS_CHROMEOS)
+ { "advancedSectionTitleBackground",
+ IDS_OPTIONS_ADVANCED_SECTION_TITLE_BACKGROUND },
+ { "backgroundModeCheckbox",
+ IDS_OPTIONS_BACKGROUND_ENABLE_BACKGROUND_MODE },
+#endif
};
RegisterStrings(localized_strings, resources, arraysize(resources));
@@ -191,6 +197,9 @@ void AdvancedOptionsHandler::Initialize() {
RemoveCloudPrintProxySection();
}
#endif
+#if !defined(OS_MACOSX) && !defined(OS_CHROMEOS)
+ SetupBackgroundModeSettings();
+#endif
banner_handler_.reset(
new OptionsManagedBannerHandler(web_ui_,
@@ -220,6 +229,12 @@ WebUIMessageHandler* AdvancedOptionsHandler::Attach(WebUI* web_ui) {
tls1_enabled_.Init(prefs::kTLS1Enabled, g_browser_process->local_state(),
this);
+#if !defined(OS_MACOSX) && !defined(OS_CHROMEOS)
+ background_mode_enabled_.Init(prefs::kBackgroundModeEnabled,
+ g_browser_process->local_state(),
+ this);
+#endif
+
default_download_location_.Init(prefs::kDownloadDefaultDirectory,
prefs, this);
ask_for_save_location_.Init(prefs::kPromptForDownload, prefs, this);
@@ -283,6 +298,11 @@ void AdvancedOptionsHandler::RegisterMessages() {
web_ui_->RegisterMessageCallback("useTLS1CheckboxAction",
NewCallback(this,
&AdvancedOptionsHandler::HandleUseTLS1Checkbox));
+#if !defined(OS_MACOSX) && !defined(OS_CHROMEOS)
+ web_ui_->RegisterMessageCallback("backgroundModeAction",
+ NewCallback(this,
+ &AdvancedOptionsHandler::HandleBackgroundModeCheckbox));
+#endif
}
void AdvancedOptionsHandler::Observe(NotificationType type,
@@ -307,6 +327,10 @@ void AdvancedOptionsHandler::Observe(NotificationType type,
#endif
} else if (*pref_name == prefs::kWebKitDefaultFontSize) {
SetupFontSizeLabel();
+#if !defined(OS_MACOSX) && !defined(OS_CHROMEOS)
+ } else if (*pref_name == prefs::kBackgroundModeEnabled) {
+ SetupBackgroundModeSettings();
+#endif
}
}
}
@@ -404,6 +428,24 @@ void AdvancedOptionsHandler::HandleUseTLS1Checkbox(const ListValue* args) {
tls1_enabled_.SetValue(enabled);
}
+#if !defined(OS_MACOSX) && !defined(OS_CHROMEOS)
+void AdvancedOptionsHandler::HandleBackgroundModeCheckbox(
+ const ListValue* args) {
+ std::string checked_str = UTF16ToUTF8(ExtractStringValue(args));
+ bool enabled = checked_str == "true";
+ std::string metric = enabled ? "Options_BackgroundMode_Enable" :
+ "Options_BackgroundMode_Disable";
+ UserMetricsRecordAction(UserMetricsAction(metric.c_str()));
+ background_mode_enabled_.SetValue(enabled);
+}
+
+void AdvancedOptionsHandler::SetupBackgroundModeSettings() {
+ FundamentalValue checked(background_mode_enabled_.GetValue());
+ web_ui_->CallJavascriptFunction(
+ "options.AdvancedOptions.SetBackgroundModeCheckboxState", checked);
+}
+#endif
+
#if !defined(OS_CHROMEOS)
void AdvancedOptionsHandler::ShowNetworkProxySettings(const ListValue* args) {
UserMetricsRecordAction(UserMetricsAction("Options_ShowProxySettings"));
« no previous file with comments | « chrome/browser/ui/webui/options/advanced_options_handler.h ('k') | chrome/common/pref_names.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698