OLD | NEW |
1 // Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium OS 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 CHROMEOS_PLATFORM_UPDATE_ENGINE_PREFS_INTERFACE_H__ | 5 #ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_PREFS_INTERFACE_H__ |
6 #define CHROMEOS_PLATFORM_UPDATE_ENGINE_PREFS_INTERFACE_H__ | 6 #define CHROMEOS_PLATFORM_UPDATE_ENGINE_PREFS_INTERFACE_H__ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 namespace chromeos_update_engine { | 10 namespace chromeos_update_engine { |
11 | 11 |
| 12 extern const char kPrefsLastActivePingDay[]; |
| 13 extern const char kPrefsLastRollCallPingDay[]; |
| 14 |
12 // The prefs interface allows access to a persistent preferences | 15 // The prefs interface allows access to a persistent preferences |
13 // store. The two reasons for providing this as an interface are | 16 // store. The two reasons for providing this as an interface are |
14 // testing as well as easier switching to a new implementation in the | 17 // testing as well as easier switching to a new implementation in the |
15 // future, if necessary. | 18 // future, if necessary. |
16 | 19 |
17 class PrefsInterface { | 20 class PrefsInterface { |
18 public: | 21 public: |
19 // Gets a string |value| associated with |key|. Returns true on | 22 // Gets a string |value| associated with |key|. Returns true on |
20 // success, false on failure (including when the |key| is not | 23 // success, false on failure (including when the |key| is not |
21 // present in the store). | 24 // present in the store). |
22 virtual bool GetString(const std::string& key, std::string* value) = 0; | 25 virtual bool GetString(const std::string& key, std::string* value) = 0; |
23 | 26 |
24 // Associates |key| with a string |value|. Returns true on success, | 27 // Associates |key| with a string |value|. Returns true on success, |
25 // false otherwise. | 28 // false otherwise. |
26 virtual bool SetString(const std::string& key, const std::string& value) = 0; | 29 virtual bool SetString(const std::string& key, const std::string& value) = 0; |
27 | 30 |
28 // Gets an int64 |value| associated with |key|. Returns true on | 31 // Gets an int64 |value| associated with |key|. Returns true on |
29 // success, false on failure (including when the |key| is not | 32 // success, false on failure (including when the |key| is not |
30 // present in the store). | 33 // present in the store). |
31 virtual bool GetInt64(const std::string& key, int64_t* value) = 0; | 34 virtual bool GetInt64(const std::string& key, int64_t* value) = 0; |
32 | 35 |
33 // Associates |key| with an int64 |value|. Returns true on success, | 36 // Associates |key| with an int64 |value|. Returns true on success, |
34 // false otherwise. | 37 // false otherwise. |
35 virtual bool SetInt64(const std::string& key, const int64_t value) = 0; | 38 virtual bool SetInt64(const std::string& key, const int64_t value) = 0; |
| 39 |
| 40 virtual ~PrefsInterface() {} |
36 }; | 41 }; |
37 | 42 |
38 } // namespace chromeos_update_engine | 43 } // namespace chromeos_update_engine |
39 | 44 |
40 #endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_PREFS_INTERFACE_H__ | 45 #endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_PREFS_INTERFACE_H__ |
OLD | NEW |