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

Side by Side Diff: chrome/browser/chromeos/system/timezone_resolver_manager.cc

Issue 2857583004: ChromeOS: Correctly handle settings.resolve_device_timezone_by_geolocation. (Closed)
Patch Set: Created 3 years, 7 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/chromeos/system/timezone_resolver_manager.h" 5 #include "chrome/browser/chromeos/system/timezone_resolver_manager.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "chrome/browser/browser_process.h" 9 #include "chrome/browser/browser_process.h"
10 #include "chrome/browser/chromeos/policy/proto/chrome_device_policy.pb.h" 10 #include "chrome/browser/chromeos/policy/proto/chrome_device_policy.pb.h"
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 const bool value = 91 const bool value =
92 user_prefs->GetBoolean(prefs::kResolveTimezoneByGeolocation); 92 user_prefs->GetBoolean(prefs::kResolveTimezoneByGeolocation);
93 if (value) 93 if (value)
94 return SHOULD_START; 94 return SHOULD_START;
95 95
96 return SHOULD_STOP; 96 return SHOULD_STOP;
97 } 97 }
98 98
99 // Returns service configuration for the signin screen. 99 // Returns service configuration for the signin screen.
100 ServiceConfiguration GetServiceConfigurationForSigninScreen() { 100 ServiceConfiguration GetServiceConfigurationForSigninScreen() {
101 if (!g_browser_process->local_state()->GetBoolean( 101 const PrefService::Preference* device_pref =
102 prefs::kResolveDeviceTimezoneByGeolocation)) { 102 g_browser_process->local_state()->FindPreference(
103 prefs::kResolveDeviceTimezoneByGeolocation);
104 bool device_pref_value;
105 if (!device_pref ||
106 !device_pref->GetValue()->GetAsBoolean(&device_pref_value)) {
103 // CfM devices default to static timezone. 107 // CfM devices default to static timezone.
104 bool keyboard_driven_oobe = 108 bool keyboard_driven_oobe =
105 system::InputDeviceSettings::Get()->ForceKeyboardDrivenUINavigation(); 109 system::InputDeviceSettings::Get()->ForceKeyboardDrivenUINavigation();
106 return keyboard_driven_oobe ? SHOULD_STOP : SHOULD_START; 110 return keyboard_driven_oobe ? SHOULD_STOP : SHOULD_START;
107 } 111 }
108 112
109 // Do not start resolver if we are inside active user session. 113 // Do not start resolver if we are inside active user session.
110 // If user preferences permit, it will be started on preferences 114 // If user preferences permit, it will be started on preferences
111 // initialization. 115 // initialization.
112 if (base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kLoginUser)) 116 if (base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kLoginUser))
113 return SHOULD_STOP; 117 return SHOULD_STOP;
114 118
115 return SHOULD_START; 119 return device_pref_value ? SHOULD_START : SHOULD_STOP;
116 } 120 }
117 121
118 } // anonymous namespace. 122 } // anonymous namespace.
119 123
120 TimeZoneResolverManager::TimeZoneResolverManager() 124 TimeZoneResolverManager::TimeZoneResolverManager()
121 : primary_user_prefs_(nullptr) { 125 : primary_user_prefs_(nullptr) {
122 local_state_pref_change_registrar_.Init(g_browser_process->local_state()); 126 local_state_pref_change_registrar_.Init(g_browser_process->local_state());
123 local_state_pref_change_registrar_.Add( 127 local_state_pref_change_registrar_.Add(
124 prefs::kSystemTimezoneAutomaticDetectionPolicy, 128 prefs::kSystemTimezoneAutomaticDetectionPolicy,
125 base::Bind( 129 base::Bind(
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 } else { 191 } else {
188 // We are on a signin page. 192 // We are on a signin page.
189 result = GetServiceConfigurationForSigninScreen(); 193 result = GetServiceConfigurationForSigninScreen();
190 } 194 }
191 } 195 }
192 return result == SHOULD_START; 196 return result == SHOULD_START;
193 } 197 }
194 198
195 } // namespace system 199 } // namespace system
196 } // namespace chromeos 200 } // namespace chromeos
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698