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 <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <set> | 9 #include <set> |
10 | 10 |
(...skipping 995 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1006 base::Unretained(this))); | 1006 base::Unretained(this))); |
1007 policy_registrar_->Observe( | 1007 policy_registrar_->Observe( |
1008 policy::key::kWallpaperImage, | 1008 policy::key::kWallpaperImage, |
1009 base::Bind(&BrowserOptionsHandler::OnWallpaperPolicyChanged, | 1009 base::Bind(&BrowserOptionsHandler::OnWallpaperPolicyChanged, |
1010 base::Unretained(this))); | 1010 base::Unretained(this))); |
1011 } | 1011 } |
1012 chromeos::CrosSettings::Get()->AddSettingsObserver( | 1012 chromeos::CrosSettings::Get()->AddSettingsObserver( |
1013 chromeos::kSystemTimezonePolicy, | 1013 chromeos::kSystemTimezonePolicy, |
1014 base::Bind(&BrowserOptionsHandler::OnSystemTimezonePolicyChanged, | 1014 base::Bind(&BrowserOptionsHandler::OnSystemTimezonePolicyChanged, |
1015 weak_ptr_factory_.GetWeakPtr())); | 1015 weak_ptr_factory_.GetWeakPtr())); |
| 1016 local_state_pref_change_registrar_.Init(g_browser_process->local_state()); |
| 1017 local_state_pref_change_registrar_.Add( |
| 1018 prefs::kSystemTimezoneAutomaticDetectionPolicy, |
| 1019 base::Bind(&BrowserOptionsHandler:: |
| 1020 OnSystemTimezoneAutomaticDetectionPolicyChanged, |
| 1021 base::Unretained(this))); |
| 1022 |
1016 #else // !defined(OS_CHROMEOS) | 1023 #else // !defined(OS_CHROMEOS) |
1017 profile_pref_registrar_.Add( | 1024 profile_pref_registrar_.Add( |
1018 proxy_config::prefs::kProxy, | 1025 proxy_config::prefs::kProxy, |
1019 base::Bind(&BrowserOptionsHandler::SetupProxySettingsSection, | 1026 base::Bind(&BrowserOptionsHandler::SetupProxySettingsSection, |
1020 base::Unretained(this))); | 1027 base::Unretained(this))); |
1021 #endif // !defined(OS_CHROMEOS) | 1028 #endif // !defined(OS_CHROMEOS) |
1022 } | 1029 } |
1023 | 1030 |
1024 void BrowserOptionsHandler::InitializePage() { | 1031 void BrowserOptionsHandler::InitializePage() { |
1025 page_initialized_ = true; | 1032 page_initialized_ = true; |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1074 OnConsumerManagementStatusChanged(); | 1081 OnConsumerManagementStatusChanged(); |
1075 consumer_management->AddObserver(this); | 1082 consumer_management->AddObserver(this); |
1076 } | 1083 } |
1077 | 1084 |
1078 if (!arc::ArcBridgeService::GetEnabled( | 1085 if (!arc::ArcBridgeService::GetEnabled( |
1079 base::CommandLine::ForCurrentProcess()) || | 1086 base::CommandLine::ForCurrentProcess()) || |
1080 arc::ArcAuthService::IsOptInVerificationDisabled() || | 1087 arc::ArcAuthService::IsOptInVerificationDisabled() || |
1081 profile->IsLegacySupervised()) { | 1088 profile->IsLegacySupervised()) { |
1082 web_ui()->CallJavascriptFunction("BrowserOptions.hideAndroidAppsSection"); | 1089 web_ui()->CallJavascriptFunction("BrowserOptions.hideAndroidAppsSection"); |
1083 } | 1090 } |
| 1091 OnSystemTimezoneAutomaticDetectionPolicyChanged(); |
1084 #endif | 1092 #endif |
1085 } | 1093 } |
1086 | 1094 |
1087 bool BrowserOptionsHandler::ShouldShowSetDefaultBrowser() { | 1095 bool BrowserOptionsHandler::ShouldShowSetDefaultBrowser() { |
1088 #if defined(OS_CHROMEOS) | 1096 #if defined(OS_CHROMEOS) |
1089 // We're always the default browser on ChromeOS. | 1097 // We're always the default browser on ChromeOS. |
1090 return false; | 1098 return false; |
1091 #else | 1099 #else |
1092 Profile* profile = Profile::FromWebUI(web_ui()); | 1100 Profile* profile = Profile::FromWebUI(web_ui()); |
1093 return !profile->IsGuestSession(); | 1101 return !profile->IsGuestSession(); |
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1433 void BrowserOptionsHandler::OnWallpaperManagedChanged(bool managed) { | 1441 void BrowserOptionsHandler::OnWallpaperManagedChanged(bool managed) { |
1434 web_ui()->CallJavascriptFunction("BrowserOptions.setWallpaperManaged", | 1442 web_ui()->CallJavascriptFunction("BrowserOptions.setWallpaperManaged", |
1435 base::FundamentalValue(managed)); | 1443 base::FundamentalValue(managed)); |
1436 } | 1444 } |
1437 | 1445 |
1438 void BrowserOptionsHandler::OnSystemTimezonePolicyChanged() { | 1446 void BrowserOptionsHandler::OnSystemTimezonePolicyChanged() { |
1439 web_ui()->CallJavascriptFunction( | 1447 web_ui()->CallJavascriptFunction( |
1440 "BrowserOptions.setSystemTimezoneManaged", | 1448 "BrowserOptions.setSystemTimezoneManaged", |
1441 base::FundamentalValue(chromeos::system::HasSystemTimezonePolicy())); | 1449 base::FundamentalValue(chromeos::system::HasSystemTimezonePolicy())); |
1442 } | 1450 } |
| 1451 |
| 1452 void BrowserOptionsHandler::OnSystemTimezoneAutomaticDetectionPolicyChanged() { |
| 1453 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 1454 chromeos::switches::kEnableSystemTimezoneAutomaticDetectionPolicy)) { |
| 1455 return; |
| 1456 } |
| 1457 |
| 1458 PrefService* prefs = g_browser_process->local_state(); |
| 1459 const bool is_managed = prefs->IsManagedPreference( |
| 1460 prefs::kSystemTimezoneAutomaticDetectionPolicy); |
| 1461 const int value = |
| 1462 prefs->GetInteger(prefs::kSystemTimezoneAutomaticDetectionPolicy); |
| 1463 web_ui()->CallJavascriptFunction( |
| 1464 "BrowserOptions.setSystemTimezoneAutomaticDetectionManaged", |
| 1465 base::FundamentalValue(is_managed), base::FundamentalValue(value)); |
| 1466 } |
1443 #endif | 1467 #endif |
1444 | 1468 |
1445 scoped_ptr<base::DictionaryValue> | 1469 scoped_ptr<base::DictionaryValue> |
1446 BrowserOptionsHandler::GetSyncStateDictionary() { | 1470 BrowserOptionsHandler::GetSyncStateDictionary() { |
1447 // The items which are to be written into |sync_status| are also described in | 1471 // The items which are to be written into |sync_status| are also described in |
1448 // chrome/browser/resources/options/browser_options.js in @typedef | 1472 // chrome/browser/resources/options/browser_options.js in @typedef |
1449 // for SyncStatus. Please update it whenever you add or remove any keys here. | 1473 // for SyncStatus. Please update it whenever you add or remove any keys here. |
1450 scoped_ptr<base::DictionaryValue> sync_status(new base::DictionaryValue); | 1474 scoped_ptr<base::DictionaryValue> sync_status(new base::DictionaryValue); |
1451 Profile* profile = Profile::FromWebUI(web_ui()); | 1475 Profile* profile = Profile::FromWebUI(web_ui()); |
1452 if (profile->IsGuestSession()) { | 1476 if (profile->IsGuestSession()) { |
(...skipping 689 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2142 | 2166 |
2143 bool BrowserOptionsHandler::IsDeviceOwnerProfile() { | 2167 bool BrowserOptionsHandler::IsDeviceOwnerProfile() { |
2144 #if defined(OS_CHROMEOS) | 2168 #if defined(OS_CHROMEOS) |
2145 return chromeos::ProfileHelper::IsOwnerProfile(Profile::FromWebUI(web_ui())); | 2169 return chromeos::ProfileHelper::IsOwnerProfile(Profile::FromWebUI(web_ui())); |
2146 #else | 2170 #else |
2147 return true; | 2171 return true; |
2148 #endif | 2172 #endif |
2149 } | 2173 } |
2150 | 2174 |
2151 } // namespace options | 2175 } // namespace options |
OLD | NEW |