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

Side by Side Diff: chrome/browser/ui/webui/options/browser_options_handler.cc

Issue 11345008: Remove content::NotificationObserver dependency from most Prefs code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address review comments. Created 8 years, 1 month 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/webui/options/browser_options_handler.h" 5 #include "chrome/browser/ui/webui/options/browser_options_handler.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 846 matching lines...) Expand 10 before | Expand all | Expand 10 after
857 // InitializePage() will update the UI at the end of the load). 857 // InitializePage() will update the UI at the end of the load).
858 if (!page_initialized_) 858 if (!page_initialized_)
859 return; 859 return;
860 860
861 if (type == chrome::NOTIFICATION_BROWSER_THEME_CHANGED) { 861 if (type == chrome::NOTIFICATION_BROWSER_THEME_CHANGED) {
862 ObserveThemeChanged(); 862 ObserveThemeChanged();
863 #if defined(OS_CHROMEOS) 863 #if defined(OS_CHROMEOS)
864 } else if (type == chrome::NOTIFICATION_LOGIN_USER_IMAGE_CHANGED) { 864 } else if (type == chrome::NOTIFICATION_LOGIN_USER_IMAGE_CHANGED) {
865 UpdateAccountPicture(); 865 UpdateAccountPicture();
866 #endif 866 #endif
867 } else if (type == chrome::NOTIFICATION_PREF_CHANGED) {
868 std::string* pref_name = content::Details<std::string>(details).ptr();
869 if (*pref_name == prefs::kDefaultBrowserSettingEnabled) {
870 UpdateDefaultBrowserState();
871 } else if (*pref_name == prefs::kDownloadExtensionsToOpen) {
872 SetupAutoOpenFileTypes();
873 #if !defined(OS_CHROMEOS)
874 } else if (proxy_prefs_.IsObserved(*pref_name)) {
875 SetupProxySettingsSection();
876 #endif // !defined(OS_CHROMEOS)
877 } else if ((*pref_name == prefs::kCloudPrintEmail) ||
878 (*pref_name == prefs::kCloudPrintProxyEnabled)) {
879 #if !defined(OS_CHROMEOS)
880 if (cloud_print_connector_ui_enabled_)
881 SetupCloudPrintConnectorSection();
882 #endif
883 } else if (*pref_name == prefs::kWebKitDefaultFontSize) {
884 SetupFontSizeSelector();
885 } else if (*pref_name == prefs::kDefaultZoomLevel) {
886 SetupPageZoomSelector();
887 } else {
888 NOTREACHED();
889 }
890 } else if (type == chrome::NOTIFICATION_PROFILE_CACHED_INFO_CHANGED) { 867 } else if (type == chrome::NOTIFICATION_PROFILE_CACHED_INFO_CHANGED) {
891 if (multiprofile_) 868 if (multiprofile_)
892 SendProfilesInfo(); 869 SendProfilesInfo();
893 } else { 870 } else {
894 NOTREACHED(); 871 NOTREACHED();
895 } 872 }
873 }
874
875 void BrowserOptionsHandler::OnPreferenceChanged(PrefServiceBase* service,
876 const std::string& pref_name) {
877 if (pref_name == prefs::kDefaultBrowserSettingEnabled) {
878 UpdateDefaultBrowserState();
879 } else if (pref_name == prefs::kDownloadExtensionsToOpen) {
880 SetupAutoOpenFileTypes();
881 #if !defined(OS_CHROMEOS)
882 } else if (proxy_prefs_.IsObserved(pref_name)) {
883 SetupProxySettingsSection();
884 #endif // !defined(OS_CHROMEOS)
885 } else if ((pref_name == prefs::kCloudPrintEmail) ||
886 (pref_name == prefs::kCloudPrintProxyEnabled)) {
887 #if !defined(OS_CHROMEOS)
888 if (cloud_print_connector_ui_enabled_)
889 SetupCloudPrintConnectorSection();
890 #endif
891 } else if (pref_name == prefs::kWebKitDefaultFontSize) {
892 SetupFontSizeSelector();
893 } else if (pref_name == prefs::kDefaultZoomLevel) {
894 SetupPageZoomSelector();
895 } else {
896 NOTREACHED();
897 }
896 } 898 }
897 899
898 void BrowserOptionsHandler::ToggleAutoLaunch(const ListValue* args) { 900 void BrowserOptionsHandler::ToggleAutoLaunch(const ListValue* args) {
899 #if defined(OS_WIN) 901 #if defined(OS_WIN)
900 if (!auto_launch_trial::IsInAutoLaunchGroup()) 902 if (!auto_launch_trial::IsInAutoLaunchGroup())
901 return; 903 return;
902 904
903 bool enable; 905 bool enable;
904 CHECK_EQ(args->GetSize(), 1U); 906 CHECK_EQ(args->GetSize(), 1U);
905 CHECK(args->GetBoolean(0, &enable)); 907 CHECK(args->GetBoolean(0, &enable));
(...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after
1415 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)); 1417 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME));
1416 } 1418 }
1417 StringValue label(label_str); 1419 StringValue label(label_str);
1418 1420
1419 web_ui()->CallJavascriptFunction( 1421 web_ui()->CallJavascriptFunction(
1420 "BrowserOptions.setupProxySettingsSection", disabled, label); 1422 "BrowserOptions.setupProxySettingsSection", disabled, label);
1421 #endif // !defined(OS_CHROMEOS) 1423 #endif // !defined(OS_CHROMEOS)
1422 } 1424 }
1423 1425
1424 } // namespace options 1426 } // namespace options
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698