GaiaOAuthClient::Core::GetUserInfo() does not need to send or receive cookies.
[chromium-blink-merge.git] / rlz / chromeos / lib / rlz_value_store_chromeos.h
blob29758a4c7d12252a5dde12ca4adde6feabd3492c
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
3 // found in the LICENSE file.
5 #ifndef RLZ_CHROMEOS_LIB_RLZ_VALUE_STORE_CHROMEOS_H_
6 #define RLZ_CHROMEOS_LIB_RLZ_VALUE_STORE_CHROMEOS_H_
8 #include "base/files/file_path.h"
9 #include "base/threading/non_thread_safe.h"
10 #include "base/values.h"
11 #include "rlz/lib/rlz_value_store.h"
13 namespace base {
14 class ListValue;
15 class SequencedTaskRunner;
16 class Value;
19 namespace rlz_lib {
21 // An implementation of RlzValueStore for ChromeOS.
22 class RlzValueStoreChromeOS : public RlzValueStore,
23 public base::NonThreadSafe {
24 public:
25 // // Sets the task runner that will be used by ImportantFileWriter for write
26 // // operations.
27 // static void SetFileTaskRunner(base::SequencedTaskRunner* file_task_runner);
29 // Creates new instance and synchronously reads data from file.
30 RlzValueStoreChromeOS(const base::FilePath& store_path);
31 virtual ~RlzValueStoreChromeOS();
33 // RlzValueStore overrides:
34 virtual bool HasAccess(AccessType type) OVERRIDE;
36 virtual bool WritePingTime(Product product, int64 time) OVERRIDE;
37 virtual bool ReadPingTime(Product product, int64* time) OVERRIDE;
38 virtual bool ClearPingTime(Product product) OVERRIDE;
40 virtual bool WriteAccessPointRlz(AccessPoint access_point,
41 const char* new_rlz) OVERRIDE;
42 virtual bool ReadAccessPointRlz(AccessPoint access_point,
43 char* rlz,
44 size_t rlz_size) OVERRIDE;
45 virtual bool ClearAccessPointRlz(AccessPoint access_point) OVERRIDE;
47 virtual bool AddProductEvent(Product product, const char* event_rlz) OVERRIDE;
48 virtual bool ReadProductEvents(Product product,
49 std::vector<std::string>* events) OVERRIDE;
50 virtual bool ClearProductEvent(Product product,
51 const char* event_rlz) OVERRIDE;
52 virtual bool ClearAllProductEvents(Product product) OVERRIDE;
54 virtual bool AddStatefulEvent(Product product,
55 const char* event_rlz) OVERRIDE;
56 virtual bool IsStatefulEvent(Product product,
57 const char* event_rlz) OVERRIDE;
58 virtual bool ClearAllStatefulEvents(Product product) OVERRIDE;
60 virtual void CollectGarbage() OVERRIDE;
62 private:
63 // Reads RLZ store from file.
64 void ReadStore();
66 // Writes RLZ store back to file.
67 void WriteStore();
69 // Adds |value| to list at |list_name| path in JSON store.
70 bool AddValueToList(std::string list_name, base::Value* value);
71 // Removes |value| from list at |list_name| path in JSON store.
72 bool RemoveValueFromList(std::string list_name, const base::Value& value);
74 // In-memory store with RLZ data.
75 scoped_ptr<base::DictionaryValue> rlz_store_;
77 base::FilePath store_path_;
79 bool read_only_;
81 DISALLOW_COPY_AND_ASSIGN(RlzValueStoreChromeOS);
84 } // namespace rlz_lib
86 #endif // RLZ_CHROMEOS_LIB_RLZ_VALUE_STORE_CHROMEOS_H_