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_SYNC_DEVICE_INFO_DEVICE_INFO_UTIL_H_ | 5 #ifndef COMPONENTS_SYNC_DEVICE_INFO_DEVICE_INFO_UTIL_H_ |
6 #define COMPONENTS_SYNC_DEVICE_INFO_DEVICE_INFO_UTIL_H_ | 6 #define COMPONENTS_SYNC_DEVICE_INFO_DEVICE_INFO_UTIL_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
11 | 11 |
12 namespace sync_pb { | 12 namespace sync_pb { |
13 class DeviceInfoSpecifics; | 13 class DeviceInfoSpecifics; |
14 } | 14 } |
15 | 15 |
16 namespace sync_driver { | 16 namespace syncer { |
17 | 17 |
18 // This class contains constants and static helper functions that are shared | 18 // This class contains constants and static helper functions that are shared |
19 // between DeviceInfoSyncService and DeviceInfoService. | 19 // between DeviceInfoSyncService and DeviceInfoService. |
20 class DeviceInfoUtil { | 20 class DeviceInfoUtil { |
21 public: | 21 public: |
22 // The prefix to be appended before the cache guid when creating tags. This is | 22 // The prefix to be appended before the cache guid when creating tags. This is |
23 // needed for backwards compatiblity with all old clients because we need to | 23 // needed for backwards compatiblity with all old clients because we need to |
24 // ensure everyone uses the same logic to generate the tag, so that everyone | 24 // ensure everyone uses the same logic to generate the tag, so that everyone |
25 // can independently hash the tag to the same value. | 25 // can independently hash the tag to the same value. |
26 static const char kClientTagPrefix[]; | 26 static const char kClientTagPrefix[]; |
(...skipping 19 matching lines...) Expand all Loading... |
46 static bool IsActive(const base::Time last_update, const base::Time now); | 46 static bool IsActive(const base::Time last_update, const base::Time now); |
47 | 47 |
48 // Formats ClientTag from DeviceInfoSpecifics. | 48 // Formats ClientTag from DeviceInfoSpecifics. |
49 static std::string SpecificsToTag( | 49 static std::string SpecificsToTag( |
50 const sync_pb::DeviceInfoSpecifics& specifics); | 50 const sync_pb::DeviceInfoSpecifics& specifics); |
51 | 51 |
52 // Extracts cache_guid from ClientTag. | 52 // Extracts cache_guid from ClientTag. |
53 static std::string TagToCacheGuid(const std::string& tag); | 53 static std::string TagToCacheGuid(const std::string& tag); |
54 }; | 54 }; |
55 | 55 |
56 } // namespace sync_driver | 56 } // namespace syncer |
57 | 57 |
58 #endif // COMPONENTS_SYNC_DEVICE_INFO_DEVICE_INFO_UTIL_H_ | 58 #endif // COMPONENTS_SYNC_DEVICE_INFO_DEVICE_INFO_UTIL_H_ |
OLD | NEW |