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