| OLD | NEW |
| 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 13 matching lines...) Expand all Loading... |
| 24 enum ServiceConfiguration { | 24 enum ServiceConfiguration { |
| 25 UNSPECIFIED = 0, // Try another configuration source. | 25 UNSPECIFIED = 0, // Try another configuration source. |
| 26 SHOULD_START = 1, // This source requires service Start. | 26 SHOULD_START = 1, // This source requires service Start. |
| 27 SHOULD_STOP = 2, // This source requires service Stop. | 27 SHOULD_STOP = 2, // This source requires service Stop. |
| 28 }; | 28 }; |
| 29 | 29 |
| 30 // Starts or stops TimezoneResolver if required by | 30 // Starts or stops TimezoneResolver if required by |
| 31 // SystemTimezoneAutomaticDetectionPolicy. | 31 // SystemTimezoneAutomaticDetectionPolicy. |
| 32 // Returns SHOULD_* if timezone resolver status is controlled by this policy. | 32 // Returns SHOULD_* if timezone resolver status is controlled by this policy. |
| 33 ServiceConfiguration GetServiceConfigurationFromAutomaticDetectionPolicy() { | 33 ServiceConfiguration GetServiceConfigurationFromAutomaticDetectionPolicy() { |
| 34 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( | 34 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 35 chromeos::switches::kEnableSystemTimezoneAutomaticDetectionPolicy)) { | 35 chromeos::switches::kDisableSystemTimezoneAutomaticDetectionPolicy)) { |
| 36 return UNSPECIFIED; | 36 return UNSPECIFIED; |
| 37 } | 37 } |
| 38 | 38 |
| 39 PrefService* local_state = g_browser_process->local_state(); | 39 PrefService* local_state = g_browser_process->local_state(); |
| 40 const bool is_managed = local_state->IsManagedPreference( | 40 const bool is_managed = local_state->IsManagedPreference( |
| 41 prefs::kSystemTimezoneAutomaticDetectionPolicy); | 41 prefs::kSystemTimezoneAutomaticDetectionPolicy); |
| 42 if (!is_managed) | 42 if (!is_managed) |
| 43 return UNSPECIFIED; | 43 return UNSPECIFIED; |
| 44 | 44 |
| 45 int policy_value = | 45 int policy_value = |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 } else { | 172 } else { |
| 173 // We are on a signin page. | 173 // We are on a signin page. |
| 174 result = GetServiceConfigurationForSigninScreen(); | 174 result = GetServiceConfigurationForSigninScreen(); |
| 175 } | 175 } |
| 176 } | 176 } |
| 177 return result == SHOULD_START; | 177 return result == SHOULD_START; |
| 178 } | 178 } |
| 179 | 179 |
| 180 } // namespace system | 180 } // namespace system |
| 181 } // namespace chromeos | 181 } // namespace chromeos |
| OLD | NEW |