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.
4 
5 #ifndef RLZ_WIN_LIB_RLZ_VALUE_STORE_REGISTRY_H_
6 #define RLZ_WIN_LIB_RLZ_VALUE_STORE_REGISTRY_H_
7 
8 #include <stddef.h>
9 #include <stdint.h>
10 
11 #include "base/compiler_specific.h"
12 #include "base/macros.h"
13 #include "rlz/lib/rlz_value_store.h"
14 
15 namespace rlz_lib {
16 
17 // Implements RlzValueStore by storing values in the windows registry.
18 class RlzValueStoreRegistry : public RlzValueStore {
19  public:
20   static std::wstring GetWideLibKeyName();
21 
22   bool HasAccess(AccessType type) override;
23 
24   bool WritePingTime(Product product, int64_t time) override;
25   bool ReadPingTime(Product product, int64_t* time) override;
26   bool ClearPingTime(Product product) override;
27 
28   bool WriteAccessPointRlz(AccessPoint access_point,
29                                    const char* new_rlz) override;
30   bool ReadAccessPointRlz(AccessPoint access_point,
31                                   char* rlz,
32                                   size_t rlz_size) override;
33   bool ClearAccessPointRlz(AccessPoint access_point) override;
34   bool UpdateExistingAccessPointRlz(const std::string& brand) override;
35 
36   bool AddProductEvent(Product product, const char* event_rlz) override;
37   bool ReadProductEvents(Product product,
38                                  std::vector<std::string>* events) override;
39   bool ClearProductEvent(Product product,
40                                  const char* event_rlz) override;
41   bool ClearAllProductEvents(Product product) override;
42 
43   bool AddStatefulEvent(Product product,
44                                 const char* event_rlz) override;
45   bool IsStatefulEvent(Product product,
46                                const char* event_rlz) override;
47   bool ClearAllStatefulEvents(Product product) override;
48 
49   void CollectGarbage() override;
50 
51  private:
RlzValueStoreRegistry()52   RlzValueStoreRegistry() {}
53   DISALLOW_COPY_AND_ASSIGN(RlzValueStoreRegistry);
54   friend class ScopedRlzValueStoreLock;
55 };
56 
57 }  // namespace rlz_lib
58 
59 #endif  // RLZ_WIN_LIB_RLZ_VALUE_STORE_REGISTRY_H_
60 
61