OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2010 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_SERVICE_SERVICE_PREFS_H_ | |
6 #define CHROME_SERVICE_SERVICE_PREFS_H_ | |
7 #pragma once | |
8 | |
9 #include <string> | |
10 | |
11 #include "chrome/common/json_pref_store.h" | |
12 | |
13 // Manages persistent preferences for the service process. This is basically a | |
danno
2010/12/08 13:08:45
This should probably be called ServiceProcessPrefs
Mattias Nissler (ping if slow)
2010/12/09 10:20:20
Done.
| |
14 // thin wrapper around JsonPrefStore for more comfortable use. | |
15 class ServicePrefs { | |
16 public: | |
17 // |file_message_loop_proxy| is the MessageLoopProxy for a thread on which | |
18 // file I/O can be done. | |
19 ServicePrefs(const FilePath& pref_filename, | |
20 base::MessageLoopProxy* file_message_loop_proxy); | |
21 | |
22 // Read preferences from the backing file. | |
23 void ReadPrefs(); | |
24 | |
25 // Write the data to the backing file. | |
26 void WritePrefs(); | |
27 | |
28 // Get a string preference for |key| and store it in |result|. | |
29 void GetString(const std::string& key, std::string* result); | |
30 | |
31 // Set a string |value| for |key|. | |
32 void SetString(const std::string& key, const std::string& value); | |
33 | |
34 // Get a boolean preference for |key| and store it in |result|. | |
35 void GetBoolean(const std::string& key, bool* result); | |
36 | |
37 // Set a boolean |value| for |key|. | |
38 void SetBoolean(const std::string& key, bool value); | |
39 | |
40 // Get a dictionary preference for |key| and store it in |result|. | |
41 void GetDictionary(const std::string& key, DictionaryValue** result); | |
42 | |
43 private: | |
44 JsonPrefStore prefs_; | |
45 | |
46 DISALLOW_COPY_AND_ASSIGN(ServicePrefs); | |
47 }; | |
48 | |
49 #endif // CHROME_SERVICE_SERVICE_PREFS_H_ | |
OLD | NEW |