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

Side by Side Diff: chrome/browser/chromeos/system_settings_provider.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_SETTINGS_PROVIDER_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_SYSTEM_SETTINGS_PROVIDER_H_
6 #define CHROME_BROWSER_CHROMEOS_SYSTEM_SETTINGS_PROVIDER_H_ 6 #define CHROME_BROWSER_CHROMEOS_SYSTEM_SETTINGS_PROVIDER_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector>
10 9
11 #include "base/callback.h" 10 #include "base/callback.h"
12 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
13 #include "base/string16.h"
14 #include "chrome/browser/chromeos/cros_settings_provider.h" 12 #include "chrome/browser/chromeos/cros_settings_provider.h"
15 #include "chrome/browser/chromeos/system/timezone_settings.h" 13 #include "chrome/browser/chromeos/system/timezone_settings.h"
16 #include "third_party/icu/public/i18n/unicode/timezone.h" 14 #include "third_party/icu/public/i18n/unicode/timezone.h"
17 15
18 namespace base { 16 namespace base {
19 class ListValue;
20 class Value; 17 class Value;
21 } 18 }
22 19
23 namespace chromeos { 20 namespace chromeos {
24 21
25 class SystemSettingsProvider : public CrosSettingsProvider, 22 class SystemSettingsProvider : public CrosSettingsProvider,
26 public system::TimezoneSettings::Observer { 23 public system::TimezoneSettings::Observer {
27 public: 24 public:
28 explicit SystemSettingsProvider(const NotifyObserversCallback& notify_cb); 25 explicit SystemSettingsProvider(const NotifyObserversCallback& notify_cb);
29 virtual ~SystemSettingsProvider(); 26 virtual ~SystemSettingsProvider();
30 27
31 // CrosSettingsProvider implementation. 28 // CrosSettingsProvider implementation.
32 virtual const base::Value* Get(const std::string& path) const OVERRIDE; 29 virtual const base::Value* Get(const std::string& path) const OVERRIDE;
33 virtual TrustedStatus PrepareTrustedValues( 30 virtual TrustedStatus PrepareTrustedValues(
34 const base::Closure& callback) OVERRIDE; 31 const base::Closure& callback) OVERRIDE;
35 virtual bool HandlesSetting(const std::string& path) const OVERRIDE; 32 virtual bool HandlesSetting(const std::string& path) const OVERRIDE;
36 virtual void Reload() OVERRIDE; 33 virtual void Reload() OVERRIDE;
37 34
38 // TimezoneSettings::Observer implementation. 35 // TimezoneSettings::Observer implementation.
39 virtual void TimezoneChanged(const icu::TimeZone& timezone) OVERRIDE; 36 virtual void TimezoneChanged(const icu::TimeZone& timezone) OVERRIDE;
40 37
41 // Creates the map of timezones used by the options page.
42 base::ListValue* GetTimezoneList();
43
44 private: 38 private:
45 // CrosSettingsProvider implementation. 39 // CrosSettingsProvider implementation.
46 virtual void DoSet(const std::string& path, 40 virtual void DoSet(const std::string& path,
47 const base::Value& in_value) OVERRIDE; 41 const base::Value& in_value) OVERRIDE;
48 42
49 // Gets timezone name.
50 static string16 GetTimezoneName(const icu::TimeZone& timezone);
51
52 // Gets timezone ID which is also used as timezone pref value.
53 static string16 GetTimezoneID(const icu::TimeZone& timezone);
54
55 // Gets timezone object from its id.
56 const icu::TimeZone* GetTimezone(const string16& timezone_id);
57
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;
66
67 // Timezones.
68 std::vector<icu::TimeZone*> timezones_;
69
70 scoped_ptr<base::Value> timezone_value_; 43 scoped_ptr<base::Value> timezone_value_;
71 44
72 DISALLOW_COPY_AND_ASSIGN(SystemSettingsProvider); 45 DISALLOW_COPY_AND_ASSIGN(SystemSettingsProvider);
73 }; 46 };
74 47
75 } // namespace chromeos 48 } // namespace chromeos
76 49
77 #endif // CHROME_BROWSER_CHROMEOS_SYSTEM_SETTINGS_PROVIDER_H_ 50 #endif // CHROME_BROWSER_CHROMEOS_SYSTEM_SETTINGS_PROVIDER_H_
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/system/timezone_settings.cc ('k') | chrome/browser/chromeos/system_settings_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698