Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(79)

Side by Side Diff: components/update_client/persisted_data.h

Issue 1861383004: Add module for counting date-last-roll-call and persisting those counts (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: format Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2016 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 COMPONENTS_UPDATE_CLIENT_PERSISTED_DATA_H_
6 #define COMPONENTS_UPDATE_CLIENT_PERSISTED_DATA_H_
7
8 #include <string>
9 #include <vector>
10
11 #include "base/macros.h"
12 #include "base/threading/thread_checker.h"
13 #include "base/values.h"
14
15 class PrefRegistrySimple;
16 class PrefService;
17
18 namespace update_client {
19
20 // A PersistedData is a wrapper layer around a PrefService, designed to maintain
21 // update data that outlives the browser process and isn't exposed outside of
22 // update_client.
23 //
24 // The public methods of this class should be called only on the thread that
25 // initializes it - which also has to match the thread the PrefService has been
26 // initialized on.
27 class PersistedData {
28 public:
29 // Constructs a provider that uses the specified |pref_service|.
30 // The associated preferences are assumed to already be registered.
31 // The |pref_service| must outlive the entire update_client.
32 explicit PersistedData(PrefService* pref_service);
33
34 ~PersistedData();
35
36 // Returns the DateLastRollCall (the server-localized calendar date number the
37 // |id| was last checked by this client on) for the specified |id|.
38 // -2 indicates that there is no recorded date number for the |id|.
39 int GetDateLastRollCall(const std::string& id) const;
40
41 // Records the DateLastRollCall for the specified |ids|. |datenum| must be a
42 // non-negative integer: calls with a negative |datenum| are simply ignored.
43 // Calls to SetDateLastRollCall that occur prior to the persisted data store
44 // has been fully initialized are ignored.
45 void SetDateLastRollCall(const std::vector<std::string>& ids,
46 int datenum) const;
47
48 // This is called only via update_client's RegisterUpdateClientPreferences.
49 static void RegisterPrefs(PrefRegistrySimple* registry);
50
51 private:
52 base::ThreadChecker thread_checker_;
53 PrefService* pref_service_;
54
55 DISALLOW_COPY_AND_ASSIGN(PersistedData);
56 };
57
58 } // namespace update_client
59
60 #endif // COMPONENTS_UPDATE_CLIENT_PERSISTED_DATA_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698