| 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 #ifndef CHROME_BROWSER_CHROMEOS_SYSTEM_TIMEZONE_RESOLVER_MANAGER_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_SYSTEM_TIMEZONE_RESOLVER_MANAGER_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_SYSTEM_TIMEZONE_RESOLVER_MANAGER_H_ | 6 #define CHROME_BROWSER_CHROMEOS_SYSTEM_TIMEZONE_RESOLVER_MANAGER_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "chromeos/timezone/timezone_resolver.h" | 9 #include "chromeos/timezone/timezone_resolver.h" |
| 10 #include "components/prefs/pref_change_registrar.h" | 10 #include "components/prefs/pref_change_registrar.h" |
| 11 | 11 |
| 12 class PrefService; | 12 class PrefService; |
| 13 | 13 |
| 14 namespace chromeos { | 14 namespace chromeos { |
| 15 namespace system { | 15 namespace system { |
| 16 | 16 |
| 17 class TimeZoneResolverManager : public TimeZoneResolver::Delegate { | 17 class TimeZoneResolverManager : public TimeZoneResolver::Delegate { |
| 18 public: | 18 public: |
| 19 TimeZoneResolverManager(); | 19 TimeZoneResolverManager(); |
| 20 ~TimeZoneResolverManager() override; | 20 ~TimeZoneResolverManager() override; |
| 21 | 21 |
| 22 // This sets primary_user_prefs_. | 22 // This sets primary_user_prefs_. |
| 23 void SetPrimaryUserPrefs(PrefService* pref_service); | 23 void SetPrimaryUserPrefs(PrefService* pref_service); |
| 24 | 24 |
| 25 // TimeZoneResolver::Delegate overrides: | 25 // TimeZoneResolver::Delegate overrides: |
| 26 bool ShouldSendWiFiGeolocationData() override; | 26 bool ShouldSendWiFiGeolocationData() override; |
| 27 | 27 |
| 28 // TimeZoneResolver::Delegate overrides: |
| 29 bool ShouldSendCellularGeolocationData() override; |
| 30 |
| 28 // Starts or stops TimezoneResolver according to currect settings. | 31 // Starts or stops TimezoneResolver according to currect settings. |
| 29 void UpdateTimezoneResolver(); | 32 void UpdateTimezoneResolver(); |
| 30 | 33 |
| 31 // Returns true if result of timezone resolve should be applied to | 34 // Returns true if result of timezone resolve should be applied to |
| 32 // system timezone (preferences might have changed since request was started). | 35 // system timezone (preferences might have changed since request was started). |
| 33 bool ShouldApplyResolvedTimezone(); | 36 bool ShouldApplyResolvedTimezone(); |
| 34 | 37 |
| 35 // Returns the result of the provate call for tests. | 38 // Returns the result of the provate call for tests. |
| 36 bool TimeZoneResolverShouldBeRunningForTests(); | 39 bool TimeZoneResolverShouldBeRunningForTests(); |
| 37 | 40 |
| 38 private: | 41 private: |
| 39 // Returns true if TimeZoneResolver should be running and taking in account | 42 // Returns true if TimeZoneResolver should be running and taking in account |
| 40 // all configuration data. | 43 // all configuration data. |
| 41 bool TimeZoneResolverShouldBeRunning(); | 44 bool TimeZoneResolverShouldBeRunning(); |
| 42 | 45 |
| 46 int GetTimezoneManagementSetting(); |
| 47 |
| 43 // This is non-null only after user logs in. | 48 // This is non-null only after user logs in. |
| 44 PrefService* primary_user_prefs_; | 49 PrefService* primary_user_prefs_; |
| 45 | 50 |
| 46 // This is used to subscribe to policy preference. | 51 // This is used to subscribe to policy preference. |
| 47 PrefChangeRegistrar local_state_pref_change_registrar_; | 52 PrefChangeRegistrar local_state_pref_change_registrar_; |
| 48 | 53 |
| 49 DISALLOW_COPY_AND_ASSIGN(TimeZoneResolverManager); | 54 DISALLOW_COPY_AND_ASSIGN(TimeZoneResolverManager); |
| 50 }; | 55 }; |
| 51 | 56 |
| 52 } // namespace system | 57 } // namespace system |
| 53 } // namespace chromeos | 58 } // namespace chromeos |
| 54 | 59 |
| 55 #endif // CHROME_BROWSER_CHROMEOS_SYSTEM_TIMEZONE_RESOLVER_MANAGER_H_ | 60 #endif // CHROME_BROWSER_CHROMEOS_SYSTEM_TIMEZONE_RESOLVER_MANAGER_H_ |
| OLD | NEW |