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

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

Issue 834073002: ChromeOS: Implement periodic timezone refresh on geolocation data. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Switch feature to disabled by default. Created 5 years, 10 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 unified diff | Download patch
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 <set> 7 #include <set>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after
498 { "factoryResetDescription", IDS_OPTIONS_FACTORY_RESET_DESCRIPTION, 498 { "factoryResetDescription", IDS_OPTIONS_FACTORY_RESET_DESCRIPTION,
499 IDS_SHORT_PRODUCT_NAME }, 499 IDS_SHORT_PRODUCT_NAME },
500 #endif 500 #endif
501 { "languageSectionLabel", IDS_OPTIONS_ADVANCED_LANGUAGE_LABEL, 501 { "languageSectionLabel", IDS_OPTIONS_ADVANCED_LANGUAGE_LABEL,
502 IDS_SHORT_PRODUCT_NAME }, 502 IDS_SHORT_PRODUCT_NAME },
503 #if defined(ENABLE_SERVICE_DISCOVERY) 503 #if defined(ENABLE_SERVICE_DISCOVERY)
504 { "cloudPrintDevicesPageButton", IDS_LOCAL_DISCOVERY_DEVICES_PAGE_BUTTON }, 504 { "cloudPrintDevicesPageButton", IDS_LOCAL_DISCOVERY_DEVICES_PAGE_BUTTON },
505 { "cloudPrintEnableNotificationsLabel", 505 { "cloudPrintEnableNotificationsLabel",
506 IDS_LOCAL_DISCOVERY_NOTIFICATIONS_ENABLE_CHECKBOX_LABEL }, 506 IDS_LOCAL_DISCOVERY_NOTIFICATIONS_ENABLE_CHECKBOX_LABEL },
507 #endif 507 #endif
508 #if defined(OS_CHROMEOS)
509 { "resolveTimezoneByGeoLocation",
510 IDS_OPTIONS_RESOLVE_TIMEZONE_BY_GEOLOCATION_DESCRIPTION },
511 #endif
508 }; 512 };
509 513
510 #if defined(ENABLE_SETTINGS_APP) 514 #if defined(ENABLE_SETTINGS_APP)
511 static OptionsStringResource app_resources[] = { 515 static OptionsStringResource app_resources[] = {
512 { "syncOverview", IDS_SETTINGS_APP_SYNC_OVERVIEW }, 516 { "syncOverview", IDS_SETTINGS_APP_SYNC_OVERVIEW },
513 { "syncButtonTextStart", IDS_SYNC_START_SYNC_BUTTON_LABEL, 517 { "syncButtonTextStart", IDS_SYNC_START_SYNC_BUTTON_LABEL,
514 IDS_SETTINGS_APP_LAUNCHER_PRODUCT_NAME }, 518 IDS_SETTINGS_APP_LAUNCHER_PRODUCT_NAME },
515 { "profilesSingleUser", IDS_PROFILES_SINGLE_USER_MESSAGE, 519 { "profilesSingleUser", IDS_PROFILES_SINGLE_USER_MESSAGE,
516 IDS_SETTINGS_APP_LAUNCHER_PRODUCT_NAME }, 520 IDS_SETTINGS_APP_LAUNCHER_PRODUCT_NAME },
517 { "languageSectionLabel", IDS_OPTIONS_ADVANCED_LANGUAGE_LABEL, 521 { "languageSectionLabel", IDS_OPTIONS_ADVANCED_LANGUAGE_LABEL,
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
665 base::CommandLine::ForCurrentProcess()->HasSwitch( 669 base::CommandLine::ForCurrentProcess()->HasSwitch(
666 switches::kEnableWebsiteSettingsManager)); 670 switches::kEnableWebsiteSettingsManager));
667 671
668 values->SetBoolean("usingNewProfilesUI", switches::IsNewAvatarMenu()); 672 values->SetBoolean("usingNewProfilesUI", switches::IsNewAvatarMenu());
669 673
670 #if defined(OS_CHROMEOS) 674 #if defined(OS_CHROMEOS)
671 values->SetBoolean( 675 values->SetBoolean(
672 "showWakeOnWifi", 676 "showWakeOnWifi",
673 chromeos::WakeOnWifiManager::Get()->WakeOnWifiSupported() && 677 chromeos::WakeOnWifiManager::Get()->WakeOnWifiSupported() &&
674 chromeos::switches::WakeOnWifiEnabled()); 678 chromeos::switches::WakeOnWifiEnabled());
679 const bool have_enable_time_zone_tracking_option_switch =
680 base::CommandLine::ForCurrentProcess()->HasSwitch(
681 chromeos::switches::kEnableTimeZoneTrackingOption);
682 values->SetBoolean("enableTimeZoneTrackingOption",
683 have_enable_time_zone_tracking_option_switch &&
684 !chromeos::system::HasSystemTimezonePolicy());
675 #endif 685 #endif
676 } 686 }
677 687
678 #if defined(ENABLE_PRINT_PREVIEW) 688 #if defined(ENABLE_PRINT_PREVIEW)
679 void BrowserOptionsHandler::RegisterCloudPrintValues( 689 void BrowserOptionsHandler::RegisterCloudPrintValues(
680 base::DictionaryValue* values) { 690 base::DictionaryValue* values) {
681 values->SetString("cloudPrintOptionLabel", 691 values->SetString("cloudPrintOptionLabel",
682 l10n_util::GetStringFUTF16( 692 l10n_util::GetStringFUTF16(
683 IDS_CLOUD_PRINT_CHROMEOS_OPTION_LABEL, 693 IDS_CLOUD_PRINT_CHROMEOS_OPTION_LABEL,
684 l10n_util::GetStringUTF16(IDS_GOOGLE_CLOUD_PRINT))); 694 l10n_util::GetStringUTF16(IDS_GOOGLE_CLOUD_PRINT)));
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
950 policy::PolicyNamespace(policy::POLICY_DOMAIN_CHROME, std::string()))); 960 policy::PolicyNamespace(policy::POLICY_DOMAIN_CHROME, std::string())));
951 policy_registrar_->Observe( 961 policy_registrar_->Observe(
952 policy::key::kUserAvatarImage, 962 policy::key::kUserAvatarImage,
953 base::Bind(&BrowserOptionsHandler::OnUserImagePolicyChanged, 963 base::Bind(&BrowserOptionsHandler::OnUserImagePolicyChanged,
954 base::Unretained(this))); 964 base::Unretained(this)));
955 policy_registrar_->Observe( 965 policy_registrar_->Observe(
956 policy::key::kWallpaperImage, 966 policy::key::kWallpaperImage,
957 base::Bind(&BrowserOptionsHandler::OnWallpaperPolicyChanged, 967 base::Bind(&BrowserOptionsHandler::OnWallpaperPolicyChanged,
958 base::Unretained(this))); 968 base::Unretained(this)));
959 } 969 }
970 chromeos::CrosSettings::Get()->AddSettingsObserver(
971 chromeos::kSystemTimezonePolicy,
972 base::Bind(&BrowserOptionsHandler::OnSystemTimezonePolicyChanged,
973 weak_ptr_factory_.GetWeakPtr()));
960 #else // !defined(OS_CHROMEOS) 974 #else // !defined(OS_CHROMEOS)
961 profile_pref_registrar_.Add( 975 profile_pref_registrar_.Add(
962 prefs::kProxy, 976 prefs::kProxy,
963 base::Bind(&BrowserOptionsHandler::SetupProxySettingsSection, 977 base::Bind(&BrowserOptionsHandler::SetupProxySettingsSection,
964 base::Unretained(this))); 978 base::Unretained(this)));
965 #endif // !defined(OS_CHROMEOS) 979 #endif // !defined(OS_CHROMEOS)
966 } 980 }
967 981
968 void BrowserOptionsHandler::InitializePage() { 982 void BrowserOptionsHandler::InitializePage() {
969 page_initialized_ = true; 983 page_initialized_ = true;
(...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after
1409 1423
1410 void BrowserOptionsHandler::OnWallpaperManagedChanged(bool managed) { 1424 void BrowserOptionsHandler::OnWallpaperManagedChanged(bool managed) {
1411 #if defined(USE_ATHENA) 1425 #if defined(USE_ATHENA)
1412 // In Athena, we don't allow customizing wallpaper right now. 1426 // In Athena, we don't allow customizing wallpaper right now.
1413 // TODO(mukai|bshe): remove this. http://crbug.com/408734 1427 // TODO(mukai|bshe): remove this. http://crbug.com/408734
1414 managed = true; 1428 managed = true;
1415 #endif 1429 #endif
1416 web_ui()->CallJavascriptFunction("BrowserOptions.setWallpaperManaged", 1430 web_ui()->CallJavascriptFunction("BrowserOptions.setWallpaperManaged",
1417 base::FundamentalValue(managed)); 1431 base::FundamentalValue(managed));
1418 } 1432 }
1433
1434 void BrowserOptionsHandler::OnSystemTimezonePolicyChanged() {
1435 web_ui()->CallJavascriptFunction(
1436 "BrowserOptions.setSystemTimezoneManaged",
1437 base::FundamentalValue(chromeos::system::HasSystemTimezonePolicy()));
1438 }
1419 #endif 1439 #endif
1420 1440
1421 scoped_ptr<base::DictionaryValue> 1441 scoped_ptr<base::DictionaryValue>
1422 BrowserOptionsHandler::GetSyncStateDictionary() { 1442 BrowserOptionsHandler::GetSyncStateDictionary() {
1423 // The items which are to be written into |sync_status| are also described in 1443 // The items which are to be written into |sync_status| are also described in
1424 // chrome/browser/resources/options/browser_options.js in @typedef 1444 // chrome/browser/resources/options/browser_options.js in @typedef
1425 // for SyncStatus. Please update it whenever you add or remove any keys here. 1445 // for SyncStatus. Please update it whenever you add or remove any keys here.
1426 scoped_ptr<base::DictionaryValue> sync_status(new base::DictionaryValue); 1446 scoped_ptr<base::DictionaryValue> sync_status(new base::DictionaryValue);
1427 Profile* profile = Profile::FromWebUI(web_ui()); 1447 Profile* profile = Profile::FromWebUI(web_ui());
1428 if (profile->IsGuestSession()) { 1448 if (profile->IsGuestSession()) {
(...skipping 680 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698