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

Side by Side Diff: chrome/common/pref_service.h

Issue 40226: Fix files with lines > 80 cols. Part 2. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 11 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « chrome/common/os_exchange_data_unittest.cc ('k') | chrome/common/render_messages.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 // This provides a way to access the application's current preferences. 5 // This provides a way to access the application's current preferences.
6 // This service has two preference stores, one for "persistent" preferences, 6 // This service has two preference stores, one for "persistent" preferences,
7 // which get serialized for use in the next session, and one for "transient" 7 // which get serialized for use in the next session, and one for "transient"
8 // preferences, which are in effect for only the current session 8 // preferences, which are in effect for only the current session
9 // (this usually encodes things like command-line switches). 9 // (this usually encodes things like command-line switches).
10 // 10 //
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 const wchar_t* name, 49 const wchar_t* name,
50 Value* default_value); 50 Value* default_value);
51 ~Preference() {} 51 ~Preference() {}
52 52
53 Value::ValueType type() const { return type_; } 53 Value::ValueType type() const { return type_; }
54 54
55 // Returns the name of the Preference (i.e., the key, e.g., 55 // Returns the name of the Preference (i.e., the key, e.g.,
56 // browser.window_placement). 56 // browser.window_placement).
57 const std::wstring name() const { return name_; } 57 const std::wstring name() const { return name_; }
58 58
59 // Returns the value of the Preference. If there is no user specified value , 59 // Returns the value of the Preference. If there is no user specified
60 // it returns the default value. 60 // value, it returns the default value.
61 const Value* GetValue() const; 61 const Value* GetValue() const;
62 62
63 // Returns true if the current value matches the default value. 63 // Returns true if the current value matches the default value.
64 bool IsDefaultValue() const; 64 bool IsDefaultValue() const;
65 65
66 private: 66 private:
67 friend class PrefService; 67 friend class PrefService;
68 68
69 Value::ValueType type_; 69 Value::ValueType type_;
70 std::wstring name_; 70 std::wstring name_;
71 scoped_ptr<Value> default_value_; 71 scoped_ptr<Value> default_value_;
72 72
73 // A reference to the pref service's persistent prefs. 73 // A reference to the pref service's persistent prefs.
74 DictionaryValue* root_pref_; 74 DictionaryValue* root_pref_;
75 75
76 DISALLOW_COPY_AND_ASSIGN(Preference); 76 DISALLOW_COPY_AND_ASSIGN(Preference);
77 }; 77 };
78 78
79 // |pref_filename| is the path to the prefs file we will try to load or save t o. 79 // |pref_filename| is the path to the prefs file we will try to load or save
80 // to.
80 explicit PrefService(const FilePath& pref_filename); 81 explicit PrefService(const FilePath& pref_filename);
81 ~PrefService(); 82 ~PrefService();
82 83
83 // Reloads the data from file. This should only be called when the importer 84 // Reloads the data from file. This should only be called when the importer
84 // is running during first run, and the main process may not change pref 85 // is running during first run, and the main process may not change pref
85 // values while the importer process is running. 86 // values while the importer process is running.
86 void ReloadPersistentPrefs(); 87 void ReloadPersistentPrefs();
87 88
88 // Writes the data to disk on the provided thread. In Chrome, |thread| should 89 // Writes the data to disk on the provided thread. In Chrome, |thread| should
89 // be the file thread. The return value only reflects whether serialization 90 // be the file thread. The return value only reflects whether serialization
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 int locale_default_message_id); 122 int locale_default_message_id);
122 void RegisterLocalizedRealPref(const wchar_t* path, 123 void RegisterLocalizedRealPref(const wchar_t* path,
123 int locale_default_message_id); 124 int locale_default_message_id);
124 void RegisterLocalizedStringPref(const wchar_t* path, 125 void RegisterLocalizedStringPref(const wchar_t* path,
125 int locale_default_message_id); 126 int locale_default_message_id);
126 127
127 // Returns whether the specified pref has been registered. 128 // Returns whether the specified pref has been registered.
128 bool IsPrefRegistered(const wchar_t* path); 129 bool IsPrefRegistered(const wchar_t* path);
129 130
130 // If the path is valid and the value at the end of the path matches the type 131 // If the path is valid and the value at the end of the path matches the type
131 // specified, it will return the specified value. Otherwise, the default valu e 132 // specified, it will return the specified value. Otherwise, the default
132 // (set when the pref was registered) will be returned. 133 // value (set when the pref was registered) will be returned.
133 bool GetBoolean(const wchar_t* path) const; 134 bool GetBoolean(const wchar_t* path) const;
134 int GetInteger(const wchar_t* path) const; 135 int GetInteger(const wchar_t* path) const;
135 double GetReal(const wchar_t* path) const; 136 double GetReal(const wchar_t* path) const;
136 std::wstring GetString(const wchar_t* path) const; 137 std::wstring GetString(const wchar_t* path) const;
137 FilePath GetFilePath(const wchar_t* path) const; 138 FilePath GetFilePath(const wchar_t* path) const;
138 139
139 // Returns the branch if it exists. If it's not a branch or the branch does 140 // Returns the branch if it exists. If it's not a branch or the branch does
140 // not exist, returns NULL. This does 141 // not exist, returns NULL. This does
141 const DictionaryValue* GetDictionary(const wchar_t* path) const; 142 const DictionaryValue* GetDictionary(const wchar_t* path) const;
142 const ListValue* GetList(const wchar_t* path) const; 143 const ListValue* GetList(const wchar_t* path) const;
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 // order they are added. 243 // order they are added.
243 typedef ObserverList<NotificationObserver> NotificationObserverList; 244 typedef ObserverList<NotificationObserver> NotificationObserverList;
244 typedef base::hash_map<std::wstring, NotificationObserverList*> 245 typedef base::hash_map<std::wstring, NotificationObserverList*>
245 PrefObserverMap; 246 PrefObserverMap;
246 PrefObserverMap pref_observers_; 247 PrefObserverMap pref_observers_;
247 248
248 DISALLOW_COPY_AND_ASSIGN(PrefService); 249 DISALLOW_COPY_AND_ASSIGN(PrefService);
249 }; 250 };
250 251
251 #endif // CHROME_COMMON_PREF_SERVICE_H_ 252 #endif // CHROME_COMMON_PREF_SERVICE_H_
OLDNEW
« no previous file with comments | « chrome/common/os_exchange_data_unittest.cc ('k') | chrome/common/render_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698