OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_UI_WEBUI_OPTIONS_CHROMEOS_SYSTEM_SETTINGS_PROVIDER_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_OPTIONS_CHROMEOS_SYSTEM_SETTINGS_PROVIDER_H_ |
6 #define CHROME_BROWSER_UI_WEBUI_OPTIONS_CHROMEOS_SYSTEM_SETTINGS_PROVIDER_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_OPTIONS_CHROMEOS_SYSTEM_SETTINGS_PROVIDER_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/string16.h" | 10 #include "base/string16.h" |
11 #include "chrome/browser/chromeos/cros_settings_provider.h" | 11 #include "chrome/browser/chromeos/cros_settings_provider.h" |
12 #include "chrome/browser/chromeos/system/timezone_settings.h" | 12 #include "chrome/browser/chromeos/system/timezone_settings.h" |
13 #include "third_party/icu/public/i18n/unicode/timezone.h" | 13 #include "third_party/icu/public/i18n/unicode/timezone.h" |
14 | 14 |
| 15 namespace base { |
15 class Value; | 16 class Value; |
16 class ListValue; | 17 class ListValue; |
| 18 } |
17 | 19 |
18 namespace chromeos { | 20 namespace chromeos { |
19 | 21 |
20 class SystemSettingsProvider : public CrosSettingsProvider, | 22 class SystemSettingsProvider : public CrosSettingsProvider, |
21 public system::TimezoneSettings::Observer { | 23 public system::TimezoneSettings::Observer { |
22 public: | 24 public: |
23 SystemSettingsProvider(); | 25 SystemSettingsProvider(); |
24 virtual ~SystemSettingsProvider(); | 26 virtual ~SystemSettingsProvider(); |
25 | 27 |
26 // CrosSettingsProvider overrides. | 28 // CrosSettingsProvider overrides. |
27 virtual bool Get(const std::string& path, Value** out_value) const; | 29 virtual bool Get(const std::string& path, base::Value** out_value) const; |
28 virtual bool HandlesSetting(const std::string& path); | 30 virtual bool HandlesSetting(const std::string& path); |
29 | 31 |
30 // Overridden from TimezoneSettings::Observer: | 32 // Overridden from TimezoneSettings::Observer: |
31 virtual void TimezoneChanged(const icu::TimeZone& timezone); | 33 virtual void TimezoneChanged(const icu::TimeZone& timezone); |
32 | 34 |
33 // Creates the map of timezones used by the options page. | 35 // Creates the map of timezones used by the options page. |
34 ListValue* GetTimezoneList(); | 36 base::ListValue* GetTimezoneList(); |
35 | 37 |
36 private: | 38 private: |
37 // CrosSettingsProvider overrides. | 39 // CrosSettingsProvider overrides. |
38 virtual void DoSet(const std::string& path, Value* in_value); | 40 virtual void DoSet(const std::string& path, base::Value* in_value); |
39 | 41 |
40 // Gets timezone name. | 42 // Gets timezone name. |
41 static string16 GetTimezoneName(const icu::TimeZone& timezone); | 43 static string16 GetTimezoneName(const icu::TimeZone& timezone); |
42 | 44 |
43 // Gets timezone ID which is also used as timezone pref value. | 45 // Gets timezone ID which is also used as timezone pref value. |
44 static string16 GetTimezoneID(const icu::TimeZone& timezone); | 46 static string16 GetTimezoneID(const icu::TimeZone& timezone); |
45 | 47 |
46 // Gets timezone object from its id. | 48 // Gets timezone object from its id. |
47 const icu::TimeZone* GetTimezone(const string16& timezone_id); | 49 const icu::TimeZone* GetTimezone(const string16& timezone_id); |
48 | 50 |
49 // Gets a timezone id from a timezone in |timezones_| that has the same | 51 // Gets a timezone id from a timezone in |timezones_| that has the same |
50 // rule of given |timezone|. | 52 // rule of given |timezone|. |
51 // One timezone could have multiple timezones, | 53 // One timezone could have multiple timezones, |
52 // e.g. | 54 // e.g. |
53 // US/Pacific == America/Los_Angeles | 55 // US/Pacific == America/Los_Angeles |
54 // We should always use the known timezone id when passing back as | 56 // We should always use the known timezone id when passing back as |
55 // pref values. | 57 // pref values. |
56 string16 GetKnownTimezoneID(const icu::TimeZone& timezone) const; | 58 string16 GetKnownTimezoneID(const icu::TimeZone& timezone) const; |
57 | 59 |
58 // Timezones. | 60 // Timezones. |
59 std::vector<icu::TimeZone*> timezones_; | 61 std::vector<icu::TimeZone*> timezones_; |
60 | 62 |
61 DISALLOW_COPY_AND_ASSIGN(SystemSettingsProvider); | 63 DISALLOW_COPY_AND_ASSIGN(SystemSettingsProvider); |
62 }; | 64 }; |
63 | 65 |
64 } // namespace chromeos | 66 } // namespace chromeos |
65 | 67 |
66 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_CHROMEOS_SYSTEM_SETTINGS_PROVIDER_H_ | 68 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_CHROMEOS_SYSTEM_SETTINGS_PROVIDER_H_ |
OLD | NEW |