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

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

Issue 1836433003: ChromeOS: Add SystemTimezoneAutomaticDetection policy. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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 <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
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
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 336 matching lines...) Expand 10 before | Expand all | Expand 10 after
1430 void BrowserOptionsHandler::OnWallpaperManagedChanged(bool managed) { 1438 void BrowserOptionsHandler::OnWallpaperManagedChanged(bool managed) {
1431 web_ui()->CallJavascriptFunction("BrowserOptions.setWallpaperManaged", 1439 web_ui()->CallJavascriptFunction("BrowserOptions.setWallpaperManaged",
1432 base::FundamentalValue(managed)); 1440 base::FundamentalValue(managed));
1433 } 1441 }
1434 1442
1435 void BrowserOptionsHandler::OnSystemTimezonePolicyChanged() { 1443 void BrowserOptionsHandler::OnSystemTimezonePolicyChanged() {
1436 web_ui()->CallJavascriptFunction( 1444 web_ui()->CallJavascriptFunction(
1437 "BrowserOptions.setSystemTimezoneManaged", 1445 "BrowserOptions.setSystemTimezoneManaged",
1438 base::FundamentalValue(chromeos::system::HasSystemTimezonePolicy())); 1446 base::FundamentalValue(chromeos::system::HasSystemTimezonePolicy()));
1439 } 1447 }
1448
1449 void BrowserOptionsHandler::OnSystemTimezoneAutomaticDetectionPolicyChanged() {
1450 if (!base::CommandLine::ForCurrentProcess()->HasSwitch(
1451 chromeos::switches::kEnableSystemTimezoneAutomaticDetectionPolicy)) {
1452 return;
1453 }
1454
1455 PrefService* prefs = g_browser_process->local_state();
1456 const bool is_managed = prefs->IsManagedPreference(
1457 prefs::kSystemTimezoneAutomaticDetectionPolicy);
1458 const int value =
1459 prefs->GetInteger(prefs::kSystemTimezoneAutomaticDetectionPolicy);
1460 web_ui()->CallJavascriptFunction(
1461 "BrowserOptions.setSystemTimezoneAutomaticDetectionManaged",
1462 base::FundamentalValue(is_managed), base::FundamentalValue(value));
1463 }
1440 #endif 1464 #endif
1441 1465
1442 scoped_ptr<base::DictionaryValue> 1466 scoped_ptr<base::DictionaryValue>
1443 BrowserOptionsHandler::GetSyncStateDictionary() { 1467 BrowserOptionsHandler::GetSyncStateDictionary() {
1444 // The items which are to be written into |sync_status| are also described in 1468 // The items which are to be written into |sync_status| are also described in
1445 // chrome/browser/resources/options/browser_options.js in @typedef 1469 // chrome/browser/resources/options/browser_options.js in @typedef
1446 // for SyncStatus. Please update it whenever you add or remove any keys here. 1470 // for SyncStatus. Please update it whenever you add or remove any keys here.
1447 scoped_ptr<base::DictionaryValue> sync_status(new base::DictionaryValue); 1471 scoped_ptr<base::DictionaryValue> sync_status(new base::DictionaryValue);
1448 Profile* profile = Profile::FromWebUI(web_ui()); 1472 Profile* profile = Profile::FromWebUI(web_ui());
1449 if (profile->IsGuestSession()) { 1473 if (profile->IsGuestSession()) {
(...skipping 689 matching lines...) Expand 10 before | Expand all | Expand 10 after
2139 2163
2140 bool BrowserOptionsHandler::IsDeviceOwnerProfile() { 2164 bool BrowserOptionsHandler::IsDeviceOwnerProfile() {
2141 #if defined(OS_CHROMEOS) 2165 #if defined(OS_CHROMEOS)
2142 return chromeos::ProfileHelper::IsOwnerProfile(Profile::FromWebUI(web_ui())); 2166 return chromeos::ProfileHelper::IsOwnerProfile(Profile::FromWebUI(web_ui()));
2143 #else 2167 #else
2144 return true; 2168 return true;
2145 #endif 2169 #endif
2146 } 2170 }
2147 2171
2148 } // namespace options 2172 } // namespace options
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698