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

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

Issue 1241453005: ChromeOS: Time zone setting dropdown should be grayed out once we enable the Automatically resolve … (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 5 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 664 matching lines...) Expand 10 before | Expand all | Expand 10 after
675 values->SetBoolean( 675 values->SetBoolean(
676 "showWakeOnWifi", 676 "showWakeOnWifi",
677 chromeos::WakeOnWifiManager::Get()->WakeOnWifiSupported() && 677 chromeos::WakeOnWifiManager::Get()->WakeOnWifiSupported() &&
678 chromeos::switches::WakeOnWifiEnabled()); 678 chromeos::switches::WakeOnWifiEnabled());
679 const bool have_disable_time_zone_tracking_option_switch = 679 const bool have_disable_time_zone_tracking_option_switch =
680 base::CommandLine::ForCurrentProcess()->HasSwitch( 680 base::CommandLine::ForCurrentProcess()->HasSwitch(
681 chromeos::switches::kDisableTimeZoneTrackingOption); 681 chromeos::switches::kDisableTimeZoneTrackingOption);
682 values->SetBoolean("enableTimeZoneTrackingOption", 682 values->SetBoolean("enableTimeZoneTrackingOption",
683 !have_disable_time_zone_tracking_option_switch && 683 !have_disable_time_zone_tracking_option_switch &&
684 !chromeos::system::HasSystemTimezonePolicy()); 684 !chromeos::system::HasSystemTimezonePolicy());
685 values->SetBoolean("resolveTimezoneByGeolocationInitialValue",
686 Profile::FromWebUI(web_ui())->GetPrefs()->GetBoolean(
687 prefs::kResolveTimezoneByGeolocation));
688 #endif 685 #endif
689 } 686 }
690 687
691 #if defined(ENABLE_PRINT_PREVIEW) 688 #if defined(ENABLE_PRINT_PREVIEW)
692 void BrowserOptionsHandler::RegisterCloudPrintValues( 689 void BrowserOptionsHandler::RegisterCloudPrintValues(
693 base::DictionaryValue* values) { 690 base::DictionaryValue* values) {
694 values->SetString("cloudPrintOptionLabel", 691 values->SetString("cloudPrintOptionLabel",
695 l10n_util::GetStringFUTF16( 692 l10n_util::GetStringFUTF16(
696 IDS_CLOUD_PRINT_CHROMEOS_OPTION_LABEL, 693 IDS_CLOUD_PRINT_CHROMEOS_OPTION_LABEL,
697 l10n_util::GetStringUTF16(IDS_GOOGLE_CLOUD_PRINT))); 694 l10n_util::GetStringUTF16(IDS_GOOGLE_CLOUD_PRINT)));
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
974 base::Unretained(this))); 971 base::Unretained(this)));
975 policy_registrar_->Observe( 972 policy_registrar_->Observe(
976 policy::key::kWallpaperImage, 973 policy::key::kWallpaperImage,
977 base::Bind(&BrowserOptionsHandler::OnWallpaperPolicyChanged, 974 base::Bind(&BrowserOptionsHandler::OnWallpaperPolicyChanged,
978 base::Unretained(this))); 975 base::Unretained(this)));
979 } 976 }
980 chromeos::CrosSettings::Get()->AddSettingsObserver( 977 chromeos::CrosSettings::Get()->AddSettingsObserver(
981 chromeos::kSystemTimezonePolicy, 978 chromeos::kSystemTimezonePolicy,
982 base::Bind(&BrowserOptionsHandler::OnSystemTimezonePolicyChanged, 979 base::Bind(&BrowserOptionsHandler::OnSystemTimezonePolicyChanged,
983 weak_ptr_factory_.GetWeakPtr())); 980 weak_ptr_factory_.GetWeakPtr()));
981 profile_pref_registrar_.Add(
982 prefs::kResolveTimezoneByGeolocation,
983 base::Bind(&BrowserOptionsHandler::OnResolveTimezoneByGeolocationChanged,
984 base::Unretained(this)));
984 #else // !defined(OS_CHROMEOS) 985 #else // !defined(OS_CHROMEOS)
985 profile_pref_registrar_.Add( 986 profile_pref_registrar_.Add(
986 prefs::kProxy, 987 prefs::kProxy,
987 base::Bind(&BrowserOptionsHandler::SetupProxySettingsSection, 988 base::Bind(&BrowserOptionsHandler::SetupProxySettingsSection,
988 base::Unretained(this))); 989 base::Unretained(this)));
989 #endif // !defined(OS_CHROMEOS) 990 #endif // !defined(OS_CHROMEOS)
990 } 991 }
991 992
993 #if defined(OS_CHROMEOS)
994 void BrowserOptionsHandler::OnResolveTimezoneByGeolocationChanged() {
995 PrefService* pref_service = Profile::FromWebUI(web_ui())->GetPrefs();
996 const bool resolve_timezone_by_geolocation =
997 pref_service->GetBoolean(prefs::kResolveTimezoneByGeolocation);
998 web_ui()->CallJavascriptFunction(
999 "BrowserOptions.onResolveTimezoneByGeolocationChanged",
1000 base::FundamentalValue(resolve_timezone_by_geolocation));
1001 }
1002 #endif // defined(OS_CHROMEOS)
1003
992 void BrowserOptionsHandler::InitializePage() { 1004 void BrowserOptionsHandler::InitializePage() {
993 page_initialized_ = true; 1005 page_initialized_ = true;
994 1006
995 OnTemplateURLServiceChanged(); 1007 OnTemplateURLServiceChanged();
996 1008
997 ObserveThemeChanged(); 1009 ObserveThemeChanged();
998 OnStateChanged(); 1010 OnStateChanged();
999 UpdateDefaultBrowserState(); 1011 UpdateDefaultBrowserState();
1000 1012
1001 SetupMetricsReportingSettingVisibility(); 1013 SetupMetricsReportingSettingVisibility();
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
1033 chromeos::WallpaperManager::Get()->IsPolicyControlled( 1045 chromeos::WallpaperManager::Get()->IsPolicyControlled(
1034 user_manager::UserManager::Get()->GetActiveUser()->email())); 1046 user_manager::UserManager::Get()->GetActiveUser()->email()));
1035 1047
1036 policy::ConsumerManagementService* consumer_management = 1048 policy::ConsumerManagementService* consumer_management =
1037 g_browser_process->platform_part()->browser_policy_connector_chromeos()-> 1049 g_browser_process->platform_part()->browser_policy_connector_chromeos()->
1038 GetConsumerManagementService(); 1050 GetConsumerManagementService();
1039 if (consumer_management) { 1051 if (consumer_management) {
1040 OnConsumerManagementStatusChanged(); 1052 OnConsumerManagementStatusChanged();
1041 consumer_management->AddObserver(this); 1053 consumer_management->AddObserver(this);
1042 } 1054 }
1055
1056 OnResolveTimezoneByGeolocationChanged();
1043 #endif 1057 #endif
1044 } 1058 }
1045 1059
1046 // static 1060 // static
1047 void BrowserOptionsHandler::CheckAutoLaunch( 1061 void BrowserOptionsHandler::CheckAutoLaunch(
1048 base::WeakPtr<BrowserOptionsHandler> weak_this, 1062 base::WeakPtr<BrowserOptionsHandler> weak_this,
1049 const base::FilePath& profile_path) { 1063 const base::FilePath& profile_path) {
1050 #if defined(OS_WIN) 1064 #if defined(OS_WIN)
1051 DCHECK_CURRENTLY_ON(BrowserThread::FILE); 1065 DCHECK_CURRENTLY_ON(BrowserThread::FILE);
1052 1066
(...skipping 1124 matching lines...) Expand 10 before | Expand all | Expand 10 after
2177 void BrowserOptionsHandler::OnPolicyUpdated(const policy::PolicyNamespace& ns, 2191 void BrowserOptionsHandler::OnPolicyUpdated(const policy::PolicyNamespace& ns,
2178 const policy::PolicyMap& previous, 2192 const policy::PolicyMap& previous,
2179 const policy::PolicyMap& current) { 2193 const policy::PolicyMap& current) {
2180 std::set<std::string> different_keys; 2194 std::set<std::string> different_keys;
2181 current.GetDifferingKeys(previous, &different_keys); 2195 current.GetDifferingKeys(previous, &different_keys);
2182 if (ContainsKey(different_keys, policy::key::kMetricsReportingEnabled)) 2196 if (ContainsKey(different_keys, policy::key::kMetricsReportingEnabled))
2183 SetupMetricsReportingCheckbox(); 2197 SetupMetricsReportingCheckbox();
2184 } 2198 }
2185 2199
2186 } // namespace options 2200 } // namespace options
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698