Home | History | Annotate | Download | only in system
      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.
      4 
      5 #ifndef CHROME_BROWSER_CHROMEOS_SYSTEM_TIMEZONE_SETTINGS_H_
      6 #define CHROME_BROWSER_CHROMEOS_SYSTEM_TIMEZONE_SETTINGS_H_
      7 
      8 #include <vector>
      9 
     10 #include "base/strings/string16.h"
     11 #include "third_party/icu/source/i18n/unicode/timezone.h"
     12 
     13 namespace chromeos {
     14 namespace system {
     15 
     16 // This interface provides access to Chrome OS timezone settings.
     17 class TimezoneSettings {
     18  public:
     19   class Observer {
     20    public:
     21     // Called when the timezone has changed. |timezone| is non-null.
     22     virtual void TimezoneChanged(const icu::TimeZone& timezone) = 0;
     23    protected:
     24     virtual ~Observer();
     25   };
     26 
     27   static TimezoneSettings* GetInstance();
     28 
     29   // Returns the current timezone as an icu::Timezone object.
     30   virtual const icu::TimeZone& GetTimezone() = 0;
     31   virtual string16 GetCurrentTimezoneID() = 0;
     32 
     33   // Sets the current timezone and notifies all Observers.
     34   virtual void SetTimezone(const icu::TimeZone& timezone) = 0;
     35   virtual void SetTimezoneFromID(const string16& timezone_id) = 0;
     36 
     37   virtual void AddObserver(Observer* observer) = 0;
     38   virtual void RemoveObserver(Observer* observer) = 0;
     39 
     40   virtual const std::vector<icu::TimeZone*>& GetTimezoneList() const = 0;
     41 
     42   // Gets timezone ID which is also used as timezone pref value.
     43   static string16 GetTimezoneID(const icu::TimeZone& timezone);
     44 
     45  protected:
     46   virtual ~TimezoneSettings() {}
     47 };
     48 
     49 }  // namespace system
     50 }  // namespace chromeos
     51 
     52 #endif  // CHROME_BROWSER_CHROMEOS_SYSTEM_TIMEZONE_SETTINGS_H_
     53