| OLD | NEW |
| 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 848 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 859 // InitializePage() will update the UI at the end of the load). | 859 // InitializePage() will update the UI at the end of the load). |
| 860 if (!page_initialized_) | 860 if (!page_initialized_) |
| 861 return; | 861 return; |
| 862 | 862 |
| 863 if (type == chrome::NOTIFICATION_BROWSER_THEME_CHANGED) { | 863 if (type == chrome::NOTIFICATION_BROWSER_THEME_CHANGED) { |
| 864 ObserveThemeChanged(); | 864 ObserveThemeChanged(); |
| 865 #if defined(OS_CHROMEOS) | 865 #if defined(OS_CHROMEOS) |
| 866 } else if (type == chrome::NOTIFICATION_LOGIN_USER_IMAGE_CHANGED) { | 866 } else if (type == chrome::NOTIFICATION_LOGIN_USER_IMAGE_CHANGED) { |
| 867 UpdateAccountPicture(); | 867 UpdateAccountPicture(); |
| 868 #endif | 868 #endif |
| 869 } else if (type == chrome::NOTIFICATION_PREF_CHANGED) { | |
| 870 std::string* pref_name = content::Details<std::string>(details).ptr(); | |
| 871 if (*pref_name == prefs::kDefaultBrowserSettingEnabled) { | |
| 872 UpdateDefaultBrowserState(); | |
| 873 } else if (*pref_name == prefs::kDownloadExtensionsToOpen) { | |
| 874 SetupAutoOpenFileTypes(); | |
| 875 #if !defined(OS_CHROMEOS) | |
| 876 } else if (proxy_prefs_.IsObserved(*pref_name)) { | |
| 877 SetupProxySettingsSection(); | |
| 878 #endif // !defined(OS_CHROMEOS) | |
| 879 } else if ((*pref_name == prefs::kCloudPrintEmail) || | |
| 880 (*pref_name == prefs::kCloudPrintProxyEnabled)) { | |
| 881 #if !defined(OS_CHROMEOS) | |
| 882 if (cloud_print_connector_ui_enabled_) | |
| 883 SetupCloudPrintConnectorSection(); | |
| 884 #endif | |
| 885 } else if (*pref_name == prefs::kWebKitDefaultFontSize) { | |
| 886 SetupFontSizeSelector(); | |
| 887 } else if (*pref_name == prefs::kDefaultZoomLevel) { | |
| 888 SetupPageZoomSelector(); | |
| 889 } else { | |
| 890 NOTREACHED(); | |
| 891 } | |
| 892 } else if (type == chrome::NOTIFICATION_PROFILE_CACHED_INFO_CHANGED) { | 869 } else if (type == chrome::NOTIFICATION_PROFILE_CACHED_INFO_CHANGED) { |
| 893 if (multiprofile_) | 870 if (multiprofile_) |
| 894 SendProfilesInfo(); | 871 SendProfilesInfo(); |
| 895 } else { | 872 } else { |
| 896 NOTREACHED(); | 873 NOTREACHED(); |
| 897 } | 874 } |
| 875 } |
| 876 |
| 877 void BrowserOptionsHandler::OnPreferenceChanged(PrefServiceBase* service, |
| 878 const std::string& pref_name) { |
| 879 if (pref_name == prefs::kDefaultBrowserSettingEnabled) { |
| 880 UpdateDefaultBrowserState(); |
| 881 } else if (pref_name == prefs::kDownloadExtensionsToOpen) { |
| 882 SetupAutoOpenFileTypes(); |
| 883 #if !defined(OS_CHROMEOS) |
| 884 } else if (proxy_prefs_.IsObserved(pref_name)) { |
| 885 SetupProxySettingsSection(); |
| 886 #endif // !defined(OS_CHROMEOS) |
| 887 } else if ((pref_name == prefs::kCloudPrintEmail) || |
| 888 (pref_name == prefs::kCloudPrintProxyEnabled)) { |
| 889 #if !defined(OS_CHROMEOS) |
| 890 if (cloud_print_connector_ui_enabled_) |
| 891 SetupCloudPrintConnectorSection(); |
| 892 #endif |
| 893 } else if (pref_name == prefs::kWebKitDefaultFontSize) { |
| 894 SetupFontSizeSelector(); |
| 895 } else if (pref_name == prefs::kDefaultZoomLevel) { |
| 896 SetupPageZoomSelector(); |
| 897 } else { |
| 898 NOTREACHED(); |
| 899 } |
| 898 } | 900 } |
| 899 | 901 |
| 900 void BrowserOptionsHandler::ToggleAutoLaunch(const ListValue* args) { | 902 void BrowserOptionsHandler::ToggleAutoLaunch(const ListValue* args) { |
| 901 #if defined(OS_WIN) | 903 #if defined(OS_WIN) |
| 902 if (!auto_launch_trial::IsInAutoLaunchGroup()) | 904 if (!auto_launch_trial::IsInAutoLaunchGroup()) |
| 903 return; | 905 return; |
| 904 | 906 |
| 905 bool enable; | 907 bool enable; |
| 906 CHECK_EQ(args->GetSize(), 1U); | 908 CHECK_EQ(args->GetSize(), 1U); |
| 907 CHECK(args->GetBoolean(0, &enable)); | 909 CHECK(args->GetBoolean(0, &enable)); |
| (...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1417 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)); | 1419 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)); |
| 1418 } | 1420 } |
| 1419 StringValue label(label_str); | 1421 StringValue label(label_str); |
| 1420 | 1422 |
| 1421 web_ui()->CallJavascriptFunction( | 1423 web_ui()->CallJavascriptFunction( |
| 1422 "BrowserOptions.setupProxySettingsSection", disabled, label); | 1424 "BrowserOptions.setupProxySettingsSection", disabled, label); |
| 1423 #endif // !defined(OS_CHROMEOS) | 1425 #endif // !defined(OS_CHROMEOS) |
| 1424 } | 1426 } |
| 1425 | 1427 |
| 1426 } // namespace options | 1428 } // namespace options |
| OLD | NEW |