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

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: Comment updated. Created 5 years, 11 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 values->SetBoolean("enableTimeZoneTrackingOption",
680 base::CommandLine::ForCurrentProcess()->HasSwitch(
681 chromeos::switches::kEnableTimeZoneTracking) &&
682 !chromeos::system::HasSystemTimezonePolicy());
stevenjb 2015/01/05 17:34:21 nit: use a temporary here to improve readability.
Alexander Alekseev 2015/01/15 18:59:02 Done.
675 #endif 683 #endif
676 } 684 }
677 685
678 #if defined(ENABLE_PRINT_PREVIEW) 686 #if defined(ENABLE_PRINT_PREVIEW)
679 void BrowserOptionsHandler::RegisterCloudPrintValues( 687 void BrowserOptionsHandler::RegisterCloudPrintValues(
680 base::DictionaryValue* values) { 688 base::DictionaryValue* values) {
681 values->SetString("cloudPrintOptionLabel", 689 values->SetString("cloudPrintOptionLabel",
682 l10n_util::GetStringFUTF16( 690 l10n_util::GetStringFUTF16(
683 IDS_CLOUD_PRINT_CHROMEOS_OPTION_LABEL, 691 IDS_CLOUD_PRINT_CHROMEOS_OPTION_LABEL,
684 l10n_util::GetStringUTF16(IDS_GOOGLE_CLOUD_PRINT))); 692 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()))); 958 policy::PolicyNamespace(policy::POLICY_DOMAIN_CHROME, std::string())));
951 policy_registrar_->Observe( 959 policy_registrar_->Observe(
952 policy::key::kUserAvatarImage, 960 policy::key::kUserAvatarImage,
953 base::Bind(&BrowserOptionsHandler::OnUserImagePolicyChanged, 961 base::Bind(&BrowserOptionsHandler::OnUserImagePolicyChanged,
954 base::Unretained(this))); 962 base::Unretained(this)));
955 policy_registrar_->Observe( 963 policy_registrar_->Observe(
956 policy::key::kWallpaperImage, 964 policy::key::kWallpaperImage,
957 base::Bind(&BrowserOptionsHandler::OnWallpaperPolicyChanged, 965 base::Bind(&BrowserOptionsHandler::OnWallpaperPolicyChanged,
958 base::Unretained(this))); 966 base::Unretained(this)));
959 } 967 }
968 chromeos::CrosSettings::Get()->AddSettingsObserver(
969 chromeos::kSystemTimezonePolicy,
970 base::Bind(&BrowserOptionsHandler::OnSystemTimezonePolicyChanged,
971 weak_ptr_factory_.GetWeakPtr()));
960 #else // !defined(OS_CHROMEOS) 972 #else // !defined(OS_CHROMEOS)
961 profile_pref_registrar_.Add( 973 profile_pref_registrar_.Add(
962 prefs::kProxy, 974 prefs::kProxy,
963 base::Bind(&BrowserOptionsHandler::SetupProxySettingsSection, 975 base::Bind(&BrowserOptionsHandler::SetupProxySettingsSection,
964 base::Unretained(this))); 976 base::Unretained(this)));
965 #endif // !defined(OS_CHROMEOS) 977 #endif // !defined(OS_CHROMEOS)
966 } 978 }
967 979
968 void BrowserOptionsHandler::InitializePage() { 980 void BrowserOptionsHandler::InitializePage() {
969 page_initialized_ = true; 981 page_initialized_ = true;
(...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after
1409 1421
1410 void BrowserOptionsHandler::OnWallpaperManagedChanged(bool managed) { 1422 void BrowserOptionsHandler::OnWallpaperManagedChanged(bool managed) {
1411 #if defined(USE_ATHENA) 1423 #if defined(USE_ATHENA)
1412 // In Athena, we don't allow customizing wallpaper right now. 1424 // In Athena, we don't allow customizing wallpaper right now.
1413 // TODO(mukai|bshe): remove this. http://crbug.com/408734 1425 // TODO(mukai|bshe): remove this. http://crbug.com/408734
1414 managed = true; 1426 managed = true;
1415 #endif 1427 #endif
1416 web_ui()->CallJavascriptFunction("BrowserOptions.setWallpaperManaged", 1428 web_ui()->CallJavascriptFunction("BrowserOptions.setWallpaperManaged",
1417 base::FundamentalValue(managed)); 1429 base::FundamentalValue(managed));
1418 } 1430 }
1431
1432 void BrowserOptionsHandler::OnSystemTimezonePolicyChanged() {
1433 web_ui()->CallJavascriptFunction(
1434 "BrowserOptions.setSystemTimezoneManaged",
1435 base::FundamentalValue(chromeos::system::HasSystemTimezonePolicy()));
1436 }
1419 #endif 1437 #endif
1420 1438
1421 scoped_ptr<base::DictionaryValue> 1439 scoped_ptr<base::DictionaryValue>
1422 BrowserOptionsHandler::GetSyncStateDictionary() { 1440 BrowserOptionsHandler::GetSyncStateDictionary() {
1423 // 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
1424 // chrome/browser/resources/options/browser_options.js in @typedef 1442 // chrome/browser/resources/options/browser_options.js in @typedef
1425 // 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.
1426 scoped_ptr<base::DictionaryValue> sync_status(new base::DictionaryValue); 1444 scoped_ptr<base::DictionaryValue> sync_status(new base::DictionaryValue);
1427 Profile* profile = Profile::FromWebUI(web_ui()); 1445 Profile* profile = Profile::FromWebUI(web_ui());
1428 if (profile->IsGuestSession()) { 1446 if (profile->IsGuestSession()) {
(...skipping 680 matching lines...) Expand 10 before | Expand all | Expand 10 after
2109 void BrowserOptionsHandler::OnPolicyUpdated(const policy::PolicyNamespace& ns, 2127 void BrowserOptionsHandler::OnPolicyUpdated(const policy::PolicyNamespace& ns,
2110 const policy::PolicyMap& previous, 2128 const policy::PolicyMap& previous,
2111 const policy::PolicyMap& current) { 2129 const policy::PolicyMap& current) {
2112 std::set<std::string> different_keys; 2130 std::set<std::string> different_keys;
2113 current.GetDifferingKeys(previous, &different_keys); 2131 current.GetDifferingKeys(previous, &different_keys);
2114 if (ContainsKey(different_keys, policy::key::kMetricsReportingEnabled)) 2132 if (ContainsKey(different_keys, policy::key::kMetricsReportingEnabled))
2115 SetupMetricsReportingCheckbox(); 2133 SetupMetricsReportingCheckbox();
2116 } 2134 }
2117 2135
2118 } // namespace options 2136 } // namespace options
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698