Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(591)

Side by Side Diff: chrome/browser/chromeos/system/timezone_settings.h

Issue 10689175: Refactored code for timezone settings. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Added missing comment. Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 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_CHROMEOS_SYSTEM_TIMEZONE_SETTINGS_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_SYSTEM_TIMEZONE_SETTINGS_H_
6 #define CHROME_BROWSER_CHROMEOS_SYSTEM_TIMEZONE_SETTINGS_H_ 6 #define CHROME_BROWSER_CHROMEOS_SYSTEM_TIMEZONE_SETTINGS_H_
7 7
8 #include <string> 8 #include <vector>
9 9
10 #include "base/string16.h"
10 #include "chrome/browser/cancelable_request.h" 11 #include "chrome/browser/cancelable_request.h"
11 #include "unicode/timezone.h" 12 #include "unicode/timezone.h"
12 13
13 namespace chromeos { 14 namespace chromeos {
14 namespace system { 15 namespace system {
15 16
16 // This interface provides access to Chrome OS timezone settings. 17 // This interface provides access to Chrome OS timezone settings.
17 class TimezoneSettings : public CancelableRequestProvider { 18 class TimezoneSettings : public CancelableRequestProvider {
18 public: 19 public:
19 class Observer { 20 class Observer {
20 public: 21 public:
21 // Called when the timezone has changed. |timezone| is non-null. 22 // Called when the timezone has changed. |timezone| is non-null.
22 virtual void TimezoneChanged(const icu::TimeZone& timezone) = 0; 23 virtual void TimezoneChanged(const icu::TimeZone& timezone) = 0;
24 protected:
25 virtual ~Observer();
23 }; 26 };
24 27
25 static TimezoneSettings* GetInstance(); 28 static TimezoneSettings* GetInstance();
26 29
27 // Returns the current timezone as an icu::Timezone object. 30 // Returns the current timezone as an icu::Timezone object.
28 virtual const icu::TimeZone& GetTimezone() = 0; 31 virtual const icu::TimeZone& GetTimezone() = 0;
32 virtual string16 GetCurrentTimezoneID() = 0;
29 33
30 // Sets the current timezone. |timezone| must be non-null. 34 // Sets the current timezone and notifies all Observers.
31 virtual void SetTimezone(const icu::TimeZone& timezone) = 0; 35 virtual void SetTimezone(const icu::TimeZone& timezone) = 0;
36 virtual void SetTimezoneFromID(const string16& timezone_id) = 0;
32 37
33 virtual void AddObserver(Observer* observer) = 0; 38 virtual void AddObserver(Observer* observer) = 0;
34 virtual void RemoveObserver(Observer* observer) = 0; 39 virtual void RemoveObserver(Observer* observer) = 0;
35 40
41 virtual const std::vector<icu::TimeZone*>& GetTimezoneList() const = 0;
42
43 // Gets timezone ID which is also used as timezone pref value.
44 static string16 GetTimezoneID(const icu::TimeZone& timezone);
45
36 protected: 46 protected:
37 virtual ~TimezoneSettings() {} 47 virtual ~TimezoneSettings() {}
38 }; 48 };
39 49
40 } // namespace system 50 } // namespace system
41 } // namespace chromeos 51 } // namespace chromeos
42 52
43 #endif // CHROME_BROWSER_CHROMEOS_SYSTEM_TIMEZONE_SETTINGS_H_ 53 #endif // CHROME_BROWSER_CHROMEOS_SYSTEM_TIMEZONE_SETTINGS_H_
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/base_login_display_host.cc ('k') | chrome/browser/chromeos/system/timezone_settings.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698