OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 // Utility functions manipulating syncable::Entries, intended for use by the | 5 // Utility functions manipulating syncable::Entries, intended for use by the |
6 // syncer. | 6 // syncer. |
7 | 7 |
8 #ifndef CHROME_BROWSER_SYNC_ENGINE_SYNCER_UTIL_H_ | 8 #ifndef CHROME_BROWSER_SYNC_ENGINE_SYNCER_UTIL_H_ |
9 #define CHROME_BROWSER_SYNC_ENGINE_SYNCER_UTIL_H_ | 9 #define CHROME_BROWSER_SYNC_ENGINE_SYNCER_UTIL_H_ |
10 | 10 |
11 #include <set> | 11 #include <set> |
12 #include <string> | 12 #include <string> |
13 #include <vector> | 13 #include <vector> |
14 | 14 |
15 #include "build/build_config.h" | 15 #include "build/build_config.h" |
16 #include "chrome/browser/sync/engine/syncer.h" | 16 #include "chrome/browser/sync/engine/syncer.h" |
17 #include "chrome/browser/sync/engine/syncer_types.h" | 17 #include "chrome/browser/sync/engine/syncer_types.h" |
18 #include "chrome/browser/sync/syncable/syncable.h" | 18 #include "chrome/browser/sync/syncable/syncable.h" |
19 #include "chrome/browser/sync/syncable/syncable_id.h" | 19 #include "chrome/browser/sync/syncable/syncable_id.h" |
20 #include "chrome/browser/sync/util/sync_types.h" | 20 #include "chrome/browser/sync/util/sync_types.h" |
21 | 21 |
22 namespace browser_sync { | 22 namespace browser_sync { |
23 | 23 |
| 24 class Cryptographer; |
24 class SyncEntity; | 25 class SyncEntity; |
25 | 26 |
26 class SyncerUtil { | 27 class SyncerUtil { |
27 public: | 28 public: |
28 static void ChangeEntryIDAndUpdateChildren( | 29 static void ChangeEntryIDAndUpdateChildren( |
29 syncable::WriteTransaction* trans, | 30 syncable::WriteTransaction* trans, |
30 syncable::MutableEntry* entry, | 31 syncable::MutableEntry* entry, |
31 const syncable::Id& new_id, | 32 const syncable::Id& new_id, |
32 syncable::Directory::ChildHandles* children); | 33 syncable::Directory::ChildHandles* children); |
33 | 34 |
(...skipping 12 matching lines...) Expand all Loading... |
46 const SyncEntity& server_entry); | 47 const SyncEntity& server_entry); |
47 | 48 |
48 static void AttemptReuniteLostCommitResponses( | 49 static void AttemptReuniteLostCommitResponses( |
49 syncable::WriteTransaction* trans, | 50 syncable::WriteTransaction* trans, |
50 const SyncEntity& server_entry, | 51 const SyncEntity& server_entry, |
51 const std::string& client_id); | 52 const std::string& client_id); |
52 | 53 |
53 static UpdateAttemptResponse AttemptToUpdateEntry( | 54 static UpdateAttemptResponse AttemptToUpdateEntry( |
54 syncable::WriteTransaction* const trans, | 55 syncable::WriteTransaction* const trans, |
55 syncable::MutableEntry* const entry, | 56 syncable::MutableEntry* const entry, |
56 ConflictResolver* resolver); | 57 ConflictResolver* resolver, |
57 | 58 Cryptographer* cryptographer); |
58 | 59 |
59 // Pass in name to avoid redundant UTF8 conversion. | 60 // Pass in name to avoid redundant UTF8 conversion. |
60 static void UpdateServerFieldsFromUpdate( | 61 static void UpdateServerFieldsFromUpdate( |
61 syncable::MutableEntry* local_entry, | 62 syncable::MutableEntry* local_entry, |
62 const SyncEntity& server_entry, | 63 const SyncEntity& server_entry, |
63 const std::string& name); | 64 const std::string& name); |
64 | 65 |
65 static void ApplyExtendedAttributes( | 66 static void ApplyExtendedAttributes( |
66 syncable::MutableEntry* local_entry, | 67 syncable::MutableEntry* local_entry, |
67 const SyncEntity& server_entry); | 68 const SyncEntity& server_entry); |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 | 190 |
190 inline bool ClientAndServerTimeMatch(int64 client_time, int64 server_time) { | 191 inline bool ClientAndServerTimeMatch(int64 client_time, int64 server_time) { |
191 // Compare at the coarser timescale (server) | 192 // Compare at the coarser timescale (server) |
192 return ClientTimeToServerTime(client_time) == server_time; | 193 return ClientTimeToServerTime(client_time) == server_time; |
193 } | 194 } |
194 #endif | 195 #endif |
195 | 196 |
196 } // namespace browser_sync | 197 } // namespace browser_sync |
197 | 198 |
198 #endif // CHROME_BROWSER_SYNC_ENGINE_SYNCER_UTIL_H_ | 199 #endif // CHROME_BROWSER_SYNC_ENGINE_SYNCER_UTIL_H_ |
OLD | NEW |