OLD | NEW |
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 RLZ_VALUE_STORE_H_ | 5 #ifndef RLZ_VALUE_STORE_H_ |
6 #define RLZ_VALUE_STORE_H_ | 6 #define RLZ_VALUE_STORE_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include <stddef.h> |
| 9 #include <stdint.h> |
| 10 |
| 11 #include <string> |
| 12 #include <vector> |
| 13 |
9 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
| 15 #include "build/build_config.h" |
10 #include "rlz/lib/rlz_enums.h" | 16 #include "rlz/lib/rlz_enums.h" |
11 | 17 |
12 #if defined(OS_WIN) | 18 #if defined(OS_WIN) |
13 #include "rlz/win/lib/lib_mutex.h" | 19 #include "rlz/win/lib/lib_mutex.h" |
14 #endif | 20 #endif |
15 | 21 |
16 #if defined(OS_MACOSX) | 22 #if defined(OS_MACOSX) |
17 #include "base/mac/scoped_nsautorelease_pool.h" | 23 #include "base/mac/scoped_nsautorelease_pool.h" |
18 #endif | 24 #endif |
19 | 25 |
20 | |
21 #include <string> | |
22 #include <vector> | |
23 | |
24 namespace base { | 26 namespace base { |
25 class FilePath; | 27 class FilePath; |
26 } | 28 } |
27 | 29 |
28 namespace rlz_lib { | 30 namespace rlz_lib { |
29 | 31 |
30 // Abstracts away rlz's key value store. On windows, this usually writes to | 32 // Abstracts away rlz's key value store. On windows, this usually writes to |
31 // the registry. On mac, it writes to an NSDefaults object. | 33 // the registry. On mac, it writes to an NSDefaults object. |
32 class RlzValueStore { | 34 class RlzValueStore { |
33 public: | 35 public: |
34 virtual ~RlzValueStore() {} | 36 virtual ~RlzValueStore() {} |
35 | 37 |
36 enum AccessType { kReadAccess, kWriteAccess }; | 38 enum AccessType { kReadAccess, kWriteAccess }; |
37 virtual bool HasAccess(AccessType type) = 0; | 39 virtual bool HasAccess(AccessType type) = 0; |
38 | 40 |
39 // Ping times. | 41 // Ping times. |
40 virtual bool WritePingTime(Product product, int64 time) = 0; | 42 virtual bool WritePingTime(Product product, int64_t time) = 0; |
41 virtual bool ReadPingTime(Product product, int64* time) = 0; | 43 virtual bool ReadPingTime(Product product, int64_t* time) = 0; |
42 virtual bool ClearPingTime(Product product) = 0; | 44 virtual bool ClearPingTime(Product product) = 0; |
43 | 45 |
44 // Access point RLZs. | 46 // Access point RLZs. |
45 virtual bool WriteAccessPointRlz(AccessPoint access_point, | 47 virtual bool WriteAccessPointRlz(AccessPoint access_point, |
46 const char* new_rlz) = 0; | 48 const char* new_rlz) = 0; |
47 virtual bool ReadAccessPointRlz(AccessPoint access_point, | 49 virtual bool ReadAccessPointRlz(AccessPoint access_point, |
48 char* rlz, // At most kMaxRlzLength + 1 bytes | 50 char* rlz, // At most kMaxRlzLength + 1 bytes |
49 size_t rlz_size) = 0; | 51 size_t rlz_size) = 0; |
50 virtual bool ClearAccessPointRlz(AccessPoint access_point) = 0; | 52 virtual bool ClearAccessPointRlz(AccessPoint access_point) = 0; |
51 | 53 |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 void SetRlzStoreDirectory(const base::FilePath& directory); | 113 void SetRlzStoreDirectory(const base::FilePath& directory); |
112 | 114 |
113 // Returns the path of the file used as data store. | 115 // Returns the path of the file used as data store. |
114 std::string RlzStoreFilenameStr(); | 116 std::string RlzStoreFilenameStr(); |
115 } // namespace testing | 117 } // namespace testing |
116 #endif // defined(OS_POSIX) | 118 #endif // defined(OS_POSIX) |
117 | 119 |
118 } // namespace rlz_lib | 120 } // namespace rlz_lib |
119 | 121 |
120 #endif // RLZ_VALUE_STORE_H_ | 122 #endif // RLZ_VALUE_STORE_H_ |
OLD | NEW |