summaryrefslogtreecommitdiffstats
path: root/chrome/browser/chromeos/dom_ui/system_settings_provider.h
blob: df97c46959e0c307e21aaca8de19cce2ceb83745 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CHROME_BROWSER_CHROMEOS_DOM_UI_SYSTEM_SETTINGS_PROVIDER_H_
#define CHROME_BROWSER_CHROMEOS_DOM_UI_SYSTEM_SETTINGS_PROVIDER_H_

#include <vector>

#include "base/string16.h"
#include "chrome/browser/chromeos/cros/system_library.h"
#include "chrome/browser/chromeos/cros_settings_provider.h"
#include "third_party/icu/public/i18n/unicode/timezone.h"

class Value;
class ListValue;

namespace chromeos {

class SystemSettingsProvider : public CrosSettingsProvider,
                               public SystemLibrary::Observer {
 public:
  SystemSettingsProvider();
  virtual ~SystemSettingsProvider();

  // CrosSettingsProvider overrides.
  virtual void Set(const std::string& path, Value* in_value);
  virtual bool Get(const std::string& path, Value** out_value) const;
  virtual bool HandlesSetting(const std::string& path);

  // Overridden from SystemLibrary::Observer:
  virtual void TimezoneChanged(const icu::TimeZone& timezone);

  // Creates the map of timezones used by the options page.
  ListValue* GetTimezoneList();

 private:

  // Gets timezone name.
  static string16 GetTimezoneName(const icu::TimeZone& timezone);

  // Gets timezone ID which is also used as timezone pref value.
  static string16 GetTimezoneID(const icu::TimeZone& timezone);

  // Gets timezone object from its id.
  const icu::TimeZone* GetTimezone(const string16& timezone_id);

  // Timezones.
  std::vector<icu::TimeZone*> timezones_;

  DISALLOW_COPY_AND_ASSIGN(SystemSettingsProvider);
};

}  // namespace chromeos

#endif  // CHROME_BROWSER_CHROMEOS_DOM_UI_SYSTEM_SETTINGS_PROVIDER_H_