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

Side by Side Diff: chrome/browser/sync/engine/conflict_resolver.h

Issue 8917031: [Sync] Add nigori node conflict resolution. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase + pass trans/cryptographer directly through Created 9 years 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 | Annotate | Revision Log
OLDNEW
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
11 11
12 #include <map> 12 #include <map>
13 #include <set> 13 #include <set>
14 #include <string> 14 #include <string>
15 15
16 #include "base/basictypes.h" 16 #include "base/basictypes.h"
17 #include "base/gtest_prod_util.h" 17 #include "base/gtest_prod_util.h"
18 #include "chrome/browser/sync/engine/syncer_types.h" 18 #include "chrome/browser/sync/engine/syncer_types.h"
19 19
20 namespace syncable { 20 namespace syncable {
21 class BaseTransaction; 21 class BaseTransaction;
22 class Id; 22 class Id;
23 class MutableEntry; 23 class MutableEntry;
24 class ScopedDirLookup; 24 class ScopedDirLookup;
25 class WriteTransaction; 25 class WriteTransaction;
26 } // namespace syncable 26 } // namespace syncable
27 27
28 namespace browser_sync { 28 namespace browser_sync {
29 29
30 class Cryptographer;
31
30 namespace sessions { 32 namespace sessions {
31 class ConflictProgress; 33 class ConflictProgress;
32 class StatusController; 34 class StatusController;
33 } // namespace sessions 35 } // namespace sessions
34 36
35 class ConflictResolver { 37 class ConflictResolver {
36 friend class SyncerTest; 38 friend class SyncerTest;
37 FRIEND_TEST_ALL_PREFIXES(SyncerTest, 39 FRIEND_TEST_ALL_PREFIXES(SyncerTest,
38 ConflictResolverMergeOverwritesLocalEntry); 40 ConflictResolverMergeOverwritesLocalEntry);
39 public: 41 public:
40 ConflictResolver(); 42 ConflictResolver();
41 ~ConflictResolver(); 43 ~ConflictResolver();
42 // Called by the syncer at the end of a update/commit cycle. 44 // Called by the syncer at the end of a update/commit cycle.
43 // Returns true if the syncer should try to apply its updates again. 45 // Returns true if the syncer should try to apply its updates again.
44 bool ResolveConflicts(const syncable::ScopedDirLookup& dir, 46 bool ResolveConflicts(syncable::WriteTransaction* trans,
47 const Cryptographer* cryptographer,
45 const sessions::ConflictProgress& progress, 48 const sessions::ConflictProgress& progress,
46 sessions::StatusController* status); 49 sessions::StatusController* status);
47 50
48 private: 51 private:
49 enum ProcessSimpleConflictResult { 52 enum ProcessSimpleConflictResult {
50 NO_SYNC_PROGRESS, // No changes to advance syncing made. 53 NO_SYNC_PROGRESS, // No changes to advance syncing made.
51 SYNC_PROGRESS, // Progress made. 54 SYNC_PROGRESS, // Progress made.
52 }; 55 };
53 56
54 void IgnoreLocalChanges(syncable::MutableEntry* entry); 57 void IgnoreLocalChanges(syncable::MutableEntry* entry);
55 void OverwriteServerChanges(syncable::WriteTransaction* trans, 58 void OverwriteServerChanges(syncable::WriteTransaction* trans,
56 syncable::MutableEntry* entry); 59 syncable::MutableEntry* entry);
57 60
58 ProcessSimpleConflictResult ProcessSimpleConflict( 61 ProcessSimpleConflictResult ProcessSimpleConflict(
59 syncable::WriteTransaction* trans, 62 syncable::WriteTransaction* trans,
60 const syncable::Id& id, 63 const syncable::Id& id,
64 const Cryptographer* cryptographer,
61 sessions::StatusController* status); 65 sessions::StatusController* status);
62 66
63 bool ResolveSimpleConflicts(const syncable::ScopedDirLookup& dir, 67 bool ResolveSimpleConflicts(syncable::WriteTransaction* trans,
68 const Cryptographer* cryptographer,
64 const sessions::ConflictProgress& progress, 69 const sessions::ConflictProgress& progress,
65 sessions::StatusController* status); 70 sessions::StatusController* status);
66 71
67 DISALLOW_COPY_AND_ASSIGN(ConflictResolver); 72 DISALLOW_COPY_AND_ASSIGN(ConflictResolver);
68 }; 73 };
69 74
70 } // namespace browser_sync 75 } // namespace browser_sync
71 76
72 #endif // CHROME_BROWSER_SYNC_ENGINE_CONFLICT_RESOLVER_H_ 77 #endif // CHROME_BROWSER_SYNC_ENGINE_CONFLICT_RESOLVER_H_
OLDNEW
« no previous file with comments | « chrome/browser/sync/engine/apply_updates_command_unittest.cc ('k') | chrome/browser/sync/engine/conflict_resolver.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698