Split gdata_file_system_interface.h from gdata_file_system.h
[chromium-blink-merge.git] / chrome / browser / chromeos / system_settings_provider.h
blob2e5b3fe1ad13bea2d033e796f481374c9cf72951
1 // Copyright (c) 2012 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.
5 #ifndef CHROME_BROWSER_CHROMEOS_SYSTEM_SETTINGS_PROVIDER_H_
6 #define CHROME_BROWSER_CHROMEOS_SYSTEM_SETTINGS_PROVIDER_H_
8 #include <string>
9 #include <vector>
11 #include "base/callback.h"
12 #include "base/memory/scoped_ptr.h"
13 #include "base/string16.h"
14 #include "chrome/browser/chromeos/cros_settings_provider.h"
15 #include "chrome/browser/chromeos/system/timezone_settings.h"
16 #include "third_party/icu/public/i18n/unicode/timezone.h"
18 namespace base {
19 class ListValue;
20 class Value;
23 namespace chromeos {
25 class SystemSettingsProvider : public CrosSettingsProvider,
26 public system::TimezoneSettings::Observer {
27 public:
28 explicit SystemSettingsProvider(const NotifyObserversCallback& notify_cb);
29 virtual ~SystemSettingsProvider();
31 // CrosSettingsProvider implementation.
32 virtual const base::Value* Get(const std::string& path) const OVERRIDE;
33 virtual TrustedStatus PrepareTrustedValues(
34 const base::Closure& callback) OVERRIDE;
35 virtual bool HandlesSetting(const std::string& path) const OVERRIDE;
36 virtual void Reload() OVERRIDE;
38 // TimezoneSettings::Observer implementation.
39 virtual void TimezoneChanged(const icu::TimeZone& timezone) OVERRIDE;
41 // Creates the map of timezones used by the options page.
42 base::ListValue* GetTimezoneList();
44 private:
45 // CrosSettingsProvider implementation.
46 virtual void DoSet(const std::string& path,
47 const base::Value& in_value) OVERRIDE;
49 // Gets timezone name.
50 static string16 GetTimezoneName(const icu::TimeZone& timezone);
52 // Gets timezone ID which is also used as timezone pref value.
53 static string16 GetTimezoneID(const icu::TimeZone& timezone);
55 // Gets timezone object from its id.
56 const icu::TimeZone* GetTimezone(const string16& timezone_id);
58 // Gets a timezone id from a timezone in |timezones_| that has the same
59 // rule of given |timezone|.
60 // One timezone could have multiple timezones,
61 // e.g.
62 // US/Pacific == America/Los_Angeles
63 // We should always use the known timezone id when passing back as
64 // pref values.
65 string16 GetKnownTimezoneID(const icu::TimeZone& timezone) const;
67 // Timezones.
68 std::vector<icu::TimeZone*> timezones_;
70 scoped_ptr<base::Value> timezone_value_;
72 DISALLOW_COPY_AND_ASSIGN(SystemSettingsProvider);
75 } // namespace chromeos
77 #endif // CHROME_BROWSER_CHROMEOS_SYSTEM_SETTINGS_PROVIDER_H_