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_CHROMEOS_LIB_RLZ_VALUE_STORE_CHROMEOS_H_ | 5 #ifndef RLZ_CHROMEOS_LIB_RLZ_VALUE_STORE_CHROMEOS_H_ |
6 #define RLZ_CHROMEOS_LIB_RLZ_VALUE_STORE_CHROMEOS_H_ | 6 #define RLZ_CHROMEOS_LIB_RLZ_VALUE_STORE_CHROMEOS_H_ |
7 | 7 |
8 #include "base/file_path.h" | 8 #include "base/file_path.h" |
9 #include "base/threading/non_thread_safe.h" | 9 #include "base/threading/non_thread_safe.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
11 #include "rlz/lib/rlz_value_store.h" | 11 #include "rlz/lib/rlz_value_store.h" |
12 | 12 |
13 namespace base { | 13 namespace base { |
14 class ListValue; | 14 class ListValue; |
15 class SequencedTaskRunner; | 15 class SequencedTaskRunner; |
16 class Value; | 16 class Value; |
17 } | 17 } |
18 | 18 |
19 namespace rlz_lib { | 19 namespace rlz_lib { |
20 | 20 |
21 // An implementation of RlzValueStore for ChromeOS. | 21 // An implementation of RlzValueStore for ChromeOS. |
22 class RlzValueStoreChromeOS : public RlzValueStore, | 22 class RlzValueStoreChromeOS : public RlzValueStore, |
23 public base::NonThreadSafe { | 23 public base::NonThreadSafe { |
24 public: | 24 public: |
25 // // Sets the task runner that will be used by ImportantFileWriter for write | 25 // // Sets the task runner that will be used by ImportantFileWriter for write |
26 // // operations. | 26 // // operations. |
27 // static void SetFileTaskRunner(base::SequencedTaskRunner* file_task_runner); | 27 // static void SetFileTaskRunner(base::SequencedTaskRunner* file_task_runner); |
28 | 28 |
29 // Creates new instance and synchronously reads data from file. | 29 // Creates new instance and synchronously reads data from file. |
30 RlzValueStoreChromeOS(const FilePath& store_path); | 30 RlzValueStoreChromeOS(const base::FilePath& store_path); |
31 virtual ~RlzValueStoreChromeOS(); | 31 virtual ~RlzValueStoreChromeOS(); |
32 | 32 |
33 // RlzValueStore overrides: | 33 // RlzValueStore overrides: |
34 virtual bool HasAccess(AccessType type) OVERRIDE; | 34 virtual bool HasAccess(AccessType type) OVERRIDE; |
35 | 35 |
36 virtual bool WritePingTime(Product product, int64 time) OVERRIDE; | 36 virtual bool WritePingTime(Product product, int64 time) OVERRIDE; |
37 virtual bool ReadPingTime(Product product, int64* time) OVERRIDE; | 37 virtual bool ReadPingTime(Product product, int64* time) OVERRIDE; |
38 virtual bool ClearPingTime(Product product) OVERRIDE; | 38 virtual bool ClearPingTime(Product product) OVERRIDE; |
39 | 39 |
40 virtual bool WriteAccessPointRlz(AccessPoint access_point, | 40 virtual bool WriteAccessPointRlz(AccessPoint access_point, |
(...skipping 26 matching lines...) Expand all Loading... |
67 void WriteStore(); | 67 void WriteStore(); |
68 | 68 |
69 // Adds |value| to list at |list_name| path in JSON store. | 69 // Adds |value| to list at |list_name| path in JSON store. |
70 bool AddValueToList(std::string list_name, base::Value* value); | 70 bool AddValueToList(std::string list_name, base::Value* value); |
71 // Removes |value| from list at |list_name| path in JSON store. | 71 // Removes |value| from list at |list_name| path in JSON store. |
72 bool RemoveValueFromList(std::string list_name, const base::Value& value); | 72 bool RemoveValueFromList(std::string list_name, const base::Value& value); |
73 | 73 |
74 // In-memory store with RLZ data. | 74 // In-memory store with RLZ data. |
75 scoped_ptr<base::DictionaryValue> rlz_store_; | 75 scoped_ptr<base::DictionaryValue> rlz_store_; |
76 | 76 |
77 FilePath store_path_; | 77 base::FilePath store_path_; |
78 | 78 |
79 bool read_only_; | 79 bool read_only_; |
80 | 80 |
81 DISALLOW_COPY_AND_ASSIGN(RlzValueStoreChromeOS); | 81 DISALLOW_COPY_AND_ASSIGN(RlzValueStoreChromeOS); |
82 }; | 82 }; |
83 | 83 |
84 } // namespace rlz_lib | 84 } // namespace rlz_lib |
85 | 85 |
86 #endif // RLZ_CHROMEOS_LIB_RLZ_VALUE_STORE_CHROMEOS_H_ | 86 #endif // RLZ_CHROMEOS_LIB_RLZ_VALUE_STORE_CHROMEOS_H_ |
OLD | NEW |