| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_UTIL_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_SYSTEM_TIMEZONE_UTIL_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_SYSTEM_TIMEZONE_UTIL_H_ | 6 #define CHROME_BROWSER_CHROMEOS_SYSTEM_TIMEZONE_UTIL_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/strings/string16.h" | 10 #include "base/strings/string16.h" |
| 11 | 11 |
| 12 class Profile; |
| 13 |
| 12 namespace base { | 14 namespace base { |
| 13 class ListValue; | 15 class ListValue; |
| 14 } | 16 } |
| 15 | 17 |
| 16 namespace chromeos { | 18 namespace chromeos { |
| 17 | 19 |
| 18 struct TimeZoneResponseData; | 20 struct TimeZoneResponseData; |
| 19 | 21 |
| 20 namespace system { | 22 namespace system { |
| 21 | 23 |
| 22 // Gets the current timezone's display name. | 24 // Gets the current timezone's display name. |
| 23 base::string16 GetCurrentTimezoneName(); | 25 base::string16 GetCurrentTimezoneName(); |
| 24 | 26 |
| 25 // Creates a list of pairs of each timezone's ID and name. | 27 // Creates a list of pairs of each timezone's ID and name. |
| 26 std::unique_ptr<base::ListValue> GetTimezoneList(); | 28 std::unique_ptr<base::ListValue> GetTimezoneList(); |
| 27 | 29 |
| 28 // Returns true if device is managed and has SystemTimezonePolicy set. | 30 // Returns true if device is managed and has SystemTimezonePolicy set. |
| 29 bool HasSystemTimezonePolicy(); | 31 bool HasSystemTimezonePolicy(); |
| 30 | 32 |
| 31 // Apply TimeZone update from TimeZoneProvider. | 33 // Apply TimeZone update from TimeZoneProvider. |
| 32 void ApplyTimeZone(const TimeZoneResponseData* timezone); | 34 void ApplyTimeZone(const TimeZoneResponseData* timezone); |
| 33 | 35 |
| 36 // Returns true if given timezone preference is enterprise-managed. |
| 37 // Works for: |
| 38 // - prefs::kUserTimezone |
| 39 // - prefs::kResolveTimezoneByGeolocation |
| 40 bool IsTimezonePrefsManaged(const std::string& pref_name); |
| 41 |
| 42 // Updates system timezone from user profile data if needed. |
| 43 // This is called from chromeos::Preferences after updating profile |
| 44 // preferences to apply new value to system time zone. |
| 45 void UpdateSystemTimezone(Profile* profile); |
| 46 |
| 47 // Updates Local State preference prefs::kSigninScreenTimezone AND |
| 48 // also immediately sets system timezone (chromeos::system::TimezoneSettings). |
| 49 // This is called when there is no user session (i.e. OOBE and signin screen), |
| 50 // or when device policies are updated. |
| 51 void SetSystemAndSigninScreenTimezone(const std::string& timezone); |
| 52 |
| 53 // Returns true if per-user timezone preferences are enabled. |
| 54 bool PerUserTimezoneEnabled(); |
| 55 |
| 56 // This is called from UI code to apply user-selected time zone. |
| 57 void SetTimezoneFromUI(Profile* profile, const std::string& timezone_id); |
| 58 |
| 34 } // namespace system | 59 } // namespace system |
| 35 } // namespace chromeos | 60 } // namespace chromeos |
| 36 | 61 |
| 37 #endif // CHROME_BROWSER_CHROMEOS_SYSTEM_TIMEZONE_UTIL_H_ | 62 #endif // CHROME_BROWSER_CHROMEOS_SYSTEM_TIMEZONE_UTIL_H_ |
| OLD | NEW |