OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 // A class that watches the syncer and attempts to resolve any conflicts that | 5 // A class that watches the syncer and attempts to resolve any conflicts that |
6 // occur. | 6 // occur. |
7 | 7 |
8 #ifndef CHROME_BROWSER_SYNC_ENGINE_CONFLICT_RESOLVER_H_ | 8 #ifndef CHROME_BROWSER_SYNC_ENGINE_CONFLICT_RESOLVER_H_ |
9 #define CHROME_BROWSER_SYNC_ENGINE_CONFLICT_RESOLVER_H_ | 9 #define CHROME_BROWSER_SYNC_ENGINE_CONFLICT_RESOLVER_H_ |
10 #pragma once | 10 #pragma once |
(...skipping 21 matching lines...) Expand all Loading... |
32 namespace sessions { | 32 namespace sessions { |
33 class ConflictProgress; | 33 class ConflictProgress; |
34 class StatusController; | 34 class StatusController; |
35 } // namespace sessions | 35 } // namespace sessions |
36 | 36 |
37 class ConflictResolver { | 37 class ConflictResolver { |
38 friend class SyncerTest; | 38 friend class SyncerTest; |
39 FRIEND_TEST_ALL_PREFIXES(SyncerTest, | 39 FRIEND_TEST_ALL_PREFIXES(SyncerTest, |
40 ConflictResolverMergeOverwritesLocalEntry); | 40 ConflictResolverMergeOverwritesLocalEntry); |
41 public: | 41 public: |
| 42 // Enumeration of different conflict resolutions. Used for histogramming. |
| 43 enum SimpleConflictResolutions { |
| 44 OVERWRITE_LOCAL, // Resolved by overwriting local changes. |
| 45 OVERWRITE_SERVER, // Resolved by overwriting server changes. |
| 46 UNDELETE, // Resolved by undeleting local item. |
| 47 IGNORE_ENCRYPTION, // Resolved by ignoring an encryption-only server |
| 48 // change. |
| 49 NIGORI_MERGE, // Resolved by merging nigori nodes. |
| 50 CHANGES_MATCH, // Resolved by ignoring both local and server |
| 51 // changes because they matched. |
| 52 CONFLICT_RESOLUTION_SIZE, |
| 53 }; |
| 54 |
42 ConflictResolver(); | 55 ConflictResolver(); |
43 ~ConflictResolver(); | 56 ~ConflictResolver(); |
44 // Called by the syncer at the end of a update/commit cycle. | 57 // Called by the syncer at the end of a update/commit cycle. |
45 // Returns true if the syncer should try to apply its updates again. | 58 // Returns true if the syncer should try to apply its updates again. |
46 bool ResolveConflicts(syncable::WriteTransaction* trans, | 59 bool ResolveConflicts(syncable::WriteTransaction* trans, |
47 const Cryptographer* cryptographer, | 60 const Cryptographer* cryptographer, |
48 const sessions::ConflictProgress& progress, | 61 const sessions::ConflictProgress& progress, |
49 sessions::StatusController* status); | 62 sessions::StatusController* status); |
50 | 63 |
51 private: | 64 private: |
(...skipping 16 matching lines...) Expand all Loading... |
68 const Cryptographer* cryptographer, | 81 const Cryptographer* cryptographer, |
69 const sessions::ConflictProgress& progress, | 82 const sessions::ConflictProgress& progress, |
70 sessions::StatusController* status); | 83 sessions::StatusController* status); |
71 | 84 |
72 DISALLOW_COPY_AND_ASSIGN(ConflictResolver); | 85 DISALLOW_COPY_AND_ASSIGN(ConflictResolver); |
73 }; | 86 }; |
74 | 87 |
75 } // namespace browser_sync | 88 } // namespace browser_sync |
76 | 89 |
77 #endif // CHROME_BROWSER_SYNC_ENGINE_CONFLICT_RESOLVER_H_ | 90 #endif // CHROME_BROWSER_SYNC_ENGINE_CONFLICT_RESOLVER_H_ |
OLD | NEW |