| 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 <set> | 7 #include <set> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 495 { "factoryResetDescription", IDS_OPTIONS_FACTORY_RESET_DESCRIPTION, | 495 { "factoryResetDescription", IDS_OPTIONS_FACTORY_RESET_DESCRIPTION, |
| 496 IDS_SHORT_PRODUCT_NAME }, | 496 IDS_SHORT_PRODUCT_NAME }, |
| 497 #endif | 497 #endif |
| 498 { "languageSectionLabel", IDS_OPTIONS_ADVANCED_LANGUAGE_LABEL, | 498 { "languageSectionLabel", IDS_OPTIONS_ADVANCED_LANGUAGE_LABEL, |
| 499 IDS_SHORT_PRODUCT_NAME }, | 499 IDS_SHORT_PRODUCT_NAME }, |
| 500 #if defined(ENABLE_SERVICE_DISCOVERY) | 500 #if defined(ENABLE_SERVICE_DISCOVERY) |
| 501 { "cloudPrintDevicesPageButton", IDS_LOCAL_DISCOVERY_DEVICES_PAGE_BUTTON }, | 501 { "cloudPrintDevicesPageButton", IDS_LOCAL_DISCOVERY_DEVICES_PAGE_BUTTON }, |
| 502 { "cloudPrintEnableNotificationsLabel", | 502 { "cloudPrintEnableNotificationsLabel", |
| 503 IDS_LOCAL_DISCOVERY_NOTIFICATIONS_ENABLE_CHECKBOX_LABEL }, | 503 IDS_LOCAL_DISCOVERY_NOTIFICATIONS_ENABLE_CHECKBOX_LABEL }, |
| 504 #endif | 504 #endif |
| 505 #if defined(OS_CHROMEOS) |
| 506 { "resolveTimezoneByGeoLocation", |
| 507 IDS_OPTIONS_RESOLVE_TIMEZONE_BY_GEOLOCATION_DESCRIPTION }, |
| 508 #endif |
| 505 }; | 509 }; |
| 506 | 510 |
| 507 #if defined(ENABLE_SETTINGS_APP) | 511 #if defined(ENABLE_SETTINGS_APP) |
| 508 static OptionsStringResource app_resources[] = { | 512 static OptionsStringResource app_resources[] = { |
| 509 { "syncOverview", IDS_SETTINGS_APP_SYNC_OVERVIEW }, | 513 { "syncOverview", IDS_SETTINGS_APP_SYNC_OVERVIEW }, |
| 510 { "syncButtonTextStart", IDS_SYNC_START_SYNC_BUTTON_LABEL, | 514 { "syncButtonTextStart", IDS_SYNC_START_SYNC_BUTTON_LABEL, |
| 511 IDS_SETTINGS_APP_LAUNCHER_PRODUCT_NAME }, | 515 IDS_SETTINGS_APP_LAUNCHER_PRODUCT_NAME }, |
| 512 { "profilesSingleUser", IDS_PROFILES_SINGLE_USER_MESSAGE, | 516 { "profilesSingleUser", IDS_PROFILES_SINGLE_USER_MESSAGE, |
| 513 IDS_SETTINGS_APP_LAUNCHER_PRODUCT_NAME }, | 517 IDS_SETTINGS_APP_LAUNCHER_PRODUCT_NAME }, |
| 514 { "languageSectionLabel", IDS_OPTIONS_ADVANCED_LANGUAGE_LABEL, | 518 { "languageSectionLabel", IDS_OPTIONS_ADVANCED_LANGUAGE_LABEL, |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 670 base::CommandLine::ForCurrentProcess()->HasSwitch( | 674 base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 671 switches::kEnableWebsiteSettingsManager)); | 675 switches::kEnableWebsiteSettingsManager)); |
| 672 | 676 |
| 673 values->SetBoolean("usingNewProfilesUI", switches::IsNewAvatarMenu()); | 677 values->SetBoolean("usingNewProfilesUI", switches::IsNewAvatarMenu()); |
| 674 | 678 |
| 675 #if defined(OS_CHROMEOS) | 679 #if defined(OS_CHROMEOS) |
| 676 values->SetBoolean( | 680 values->SetBoolean( |
| 677 "showWakeOnWifi", | 681 "showWakeOnWifi", |
| 678 chromeos::WakeOnWifiManager::Get()->WakeOnWifiSupported() && | 682 chromeos::WakeOnWifiManager::Get()->WakeOnWifiSupported() && |
| 679 chromeos::switches::WakeOnWifiEnabled()); | 683 chromeos::switches::WakeOnWifiEnabled()); |
| 684 const bool have_enable_time_zone_tracking_option_switch = |
| 685 base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 686 chromeos::switches::kEnableTimeZoneTrackingOption); |
| 687 values->SetBoolean("enableTimeZoneTrackingOption", |
| 688 have_enable_time_zone_tracking_option_switch && |
| 689 !chromeos::system::HasSystemTimezonePolicy()); |
| 680 #endif | 690 #endif |
| 681 } | 691 } |
| 682 | 692 |
| 683 #if defined(ENABLE_PRINT_PREVIEW) | 693 #if defined(ENABLE_PRINT_PREVIEW) |
| 684 void BrowserOptionsHandler::RegisterCloudPrintValues( | 694 void BrowserOptionsHandler::RegisterCloudPrintValues( |
| 685 base::DictionaryValue* values) { | 695 base::DictionaryValue* values) { |
| 686 values->SetString("cloudPrintOptionLabel", | 696 values->SetString("cloudPrintOptionLabel", |
| 687 l10n_util::GetStringFUTF16( | 697 l10n_util::GetStringFUTF16( |
| 688 IDS_CLOUD_PRINT_CHROMEOS_OPTION_LABEL, | 698 IDS_CLOUD_PRINT_CHROMEOS_OPTION_LABEL, |
| 689 l10n_util::GetStringUTF16(IDS_GOOGLE_CLOUD_PRINT))); | 699 l10n_util::GetStringUTF16(IDS_GOOGLE_CLOUD_PRINT))); |
| (...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 955 policy::PolicyNamespace(policy::POLICY_DOMAIN_CHROME, std::string()))); | 965 policy::PolicyNamespace(policy::POLICY_DOMAIN_CHROME, std::string()))); |
| 956 policy_registrar_->Observe( | 966 policy_registrar_->Observe( |
| 957 policy::key::kUserAvatarImage, | 967 policy::key::kUserAvatarImage, |
| 958 base::Bind(&BrowserOptionsHandler::OnUserImagePolicyChanged, | 968 base::Bind(&BrowserOptionsHandler::OnUserImagePolicyChanged, |
| 959 base::Unretained(this))); | 969 base::Unretained(this))); |
| 960 policy_registrar_->Observe( | 970 policy_registrar_->Observe( |
| 961 policy::key::kWallpaperImage, | 971 policy::key::kWallpaperImage, |
| 962 base::Bind(&BrowserOptionsHandler::OnWallpaperPolicyChanged, | 972 base::Bind(&BrowserOptionsHandler::OnWallpaperPolicyChanged, |
| 963 base::Unretained(this))); | 973 base::Unretained(this))); |
| 964 } | 974 } |
| 975 chromeos::CrosSettings::Get()->AddSettingsObserver( |
| 976 chromeos::kSystemTimezonePolicy, |
| 977 base::Bind(&BrowserOptionsHandler::OnSystemTimezonePolicyChanged, |
| 978 weak_ptr_factory_.GetWeakPtr())); |
| 965 #else // !defined(OS_CHROMEOS) | 979 #else // !defined(OS_CHROMEOS) |
| 966 profile_pref_registrar_.Add( | 980 profile_pref_registrar_.Add( |
| 967 prefs::kProxy, | 981 prefs::kProxy, |
| 968 base::Bind(&BrowserOptionsHandler::SetupProxySettingsSection, | 982 base::Bind(&BrowserOptionsHandler::SetupProxySettingsSection, |
| 969 base::Unretained(this))); | 983 base::Unretained(this))); |
| 970 #endif // !defined(OS_CHROMEOS) | 984 #endif // !defined(OS_CHROMEOS) |
| 971 } | 985 } |
| 972 | 986 |
| 973 void BrowserOptionsHandler::InitializePage() { | 987 void BrowserOptionsHandler::InitializePage() { |
| 974 page_initialized_ = true; | 988 page_initialized_ = true; |
| (...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1407 | 1421 |
| 1408 void BrowserOptionsHandler::OnAccountPictureManagedChanged(bool managed) { | 1422 void BrowserOptionsHandler::OnAccountPictureManagedChanged(bool managed) { |
| 1409 web_ui()->CallJavascriptFunction("BrowserOptions.setAccountPictureManaged", | 1423 web_ui()->CallJavascriptFunction("BrowserOptions.setAccountPictureManaged", |
| 1410 base::FundamentalValue(managed)); | 1424 base::FundamentalValue(managed)); |
| 1411 } | 1425 } |
| 1412 | 1426 |
| 1413 void BrowserOptionsHandler::OnWallpaperManagedChanged(bool managed) { | 1427 void BrowserOptionsHandler::OnWallpaperManagedChanged(bool managed) { |
| 1414 web_ui()->CallJavascriptFunction("BrowserOptions.setWallpaperManaged", | 1428 web_ui()->CallJavascriptFunction("BrowserOptions.setWallpaperManaged", |
| 1415 base::FundamentalValue(managed)); | 1429 base::FundamentalValue(managed)); |
| 1416 } | 1430 } |
| 1431 |
| 1432 void BrowserOptionsHandler::OnSystemTimezonePolicyChanged() { |
| 1433 web_ui()->CallJavascriptFunction( |
| 1434 "BrowserOptions.setSystemTimezoneManaged", |
| 1435 base::FundamentalValue(chromeos::system::HasSystemTimezonePolicy())); |
| 1436 } |
| 1417 #endif | 1437 #endif |
| 1418 | 1438 |
| 1419 scoped_ptr<base::DictionaryValue> | 1439 scoped_ptr<base::DictionaryValue> |
| 1420 BrowserOptionsHandler::GetSyncStateDictionary() { | 1440 BrowserOptionsHandler::GetSyncStateDictionary() { |
| 1421 // The items which are to be written into |sync_status| are also described in | 1441 // The items which are to be written into |sync_status| are also described in |
| 1422 // chrome/browser/resources/options/browser_options.js in @typedef | 1442 // chrome/browser/resources/options/browser_options.js in @typedef |
| 1423 // for SyncStatus. Please update it whenever you add or remove any keys here. | 1443 // for SyncStatus. Please update it whenever you add or remove any keys here. |
| 1424 scoped_ptr<base::DictionaryValue> sync_status(new base::DictionaryValue); | 1444 scoped_ptr<base::DictionaryValue> sync_status(new base::DictionaryValue); |
| 1425 Profile* profile = Profile::FromWebUI(web_ui()); | 1445 Profile* profile = Profile::FromWebUI(web_ui()); |
| 1426 if (profile->IsGuestSession()) { | 1446 if (profile->IsGuestSession()) { |
| (...skipping 682 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2109 void BrowserOptionsHandler::OnPolicyUpdated(const policy::PolicyNamespace& ns, | 2129 void BrowserOptionsHandler::OnPolicyUpdated(const policy::PolicyNamespace& ns, |
| 2110 const policy::PolicyMap& previous, | 2130 const policy::PolicyMap& previous, |
| 2111 const policy::PolicyMap& current) { | 2131 const policy::PolicyMap& current) { |
| 2112 std::set<std::string> different_keys; | 2132 std::set<std::string> different_keys; |
| 2113 current.GetDifferingKeys(previous, &different_keys); | 2133 current.GetDifferingKeys(previous, &different_keys); |
| 2114 if (ContainsKey(different_keys, policy::key::kMetricsReportingEnabled)) | 2134 if (ContainsKey(different_keys, policy::key::kMetricsReportingEnabled)) |
| 2115 SetupMetricsReportingCheckbox(); | 2135 SetupMetricsReportingCheckbox(); |
| 2116 } | 2136 } |
| 2117 | 2137 |
| 2118 } // namespace options | 2138 } // namespace options |
| OLD | NEW |