| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 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 COMPONENTS_UPDATE_CLIENT_PERSISTED_DATA_H_ | 5 #ifndef COMPONENTS_UPDATE_CLIENT_PERSISTED_DATA_H_ |
| 6 #define COMPONENTS_UPDATE_CLIENT_PERSISTED_DATA_H_ | 6 #define COMPONENTS_UPDATE_CLIENT_PERSISTED_DATA_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 // The |pref_service| must outlive the entire update_client. | 31 // The |pref_service| must outlive the entire update_client. |
| 32 explicit PersistedData(PrefService* pref_service); | 32 explicit PersistedData(PrefService* pref_service); |
| 33 | 33 |
| 34 ~PersistedData(); | 34 ~PersistedData(); |
| 35 | 35 |
| 36 // Returns the DateLastRollCall (the server-localized calendar date number the | 36 // Returns the DateLastRollCall (the server-localized calendar date number the |
| 37 // |id| was last checked by this client on) for the specified |id|. | 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|. | 38 // -2 indicates that there is no recorded date number for the |id|. |
| 39 int GetDateLastRollCall(const std::string& id) const; | 39 int GetDateLastRollCall(const std::string& id) const; |
| 40 | 40 |
| 41 // Returns the PingFreshness (a random token that is written into the profile |
| 42 // data whenever the DateLastRollCall it is modified) for the specified |id|. |
| 43 // "" indicates that there is no recorded freshness value for the |id|. |
| 44 std::string GetPingFreshness(const std::string& id) const; |
| 45 |
| 41 // Records the DateLastRollCall for the specified |ids|. |datenum| must be a | 46 // Records the DateLastRollCall for the specified |ids|. |datenum| must be a |
| 42 // non-negative integer: calls with a negative |datenum| are simply ignored. | 47 // non-negative integer: calls with a negative |datenum| are simply ignored. |
| 43 // Calls to SetDateLastRollCall that occur prior to the persisted data store | 48 // Calls to SetDateLastRollCall that occur prior to the persisted data store |
| 44 // has been fully initialized are ignored. | 49 // has been fully initialized are ignored. Also sets the PingFreshness. |
| 45 void SetDateLastRollCall(const std::vector<std::string>& ids, | 50 void SetDateLastRollCall(const std::vector<std::string>& ids, int datenum); |
| 46 int datenum) const; | |
| 47 | 51 |
| 48 // This is called only via update_client's RegisterUpdateClientPreferences. | 52 // This is called only via update_client's RegisterUpdateClientPreferences. |
| 49 static void RegisterPrefs(PrefRegistrySimple* registry); | 53 static void RegisterPrefs(PrefRegistrySimple* registry); |
| 50 | 54 |
| 51 private: | 55 private: |
| 52 base::ThreadChecker thread_checker_; | 56 base::ThreadChecker thread_checker_; |
| 53 PrefService* pref_service_; | 57 PrefService* pref_service_; |
| 54 | 58 |
| 55 DISALLOW_COPY_AND_ASSIGN(PersistedData); | 59 DISALLOW_COPY_AND_ASSIGN(PersistedData); |
| 56 }; | 60 }; |
| 57 | 61 |
| 58 } // namespace update_client | 62 } // namespace update_client |
| 59 | 63 |
| 60 #endif // COMPONENTS_UPDATE_CLIENT_PERSISTED_DATA_H_ | 64 #endif // COMPONENTS_UPDATE_CLIENT_PERSISTED_DATA_H_ |
| OLD | NEW |