Home | History | Annotate | Download | only in engine
      1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved.
      2 // Use of this source code is governed by a BSD-style license that can be
      3 // found in the LICENSE file.
      4 
      5 #ifndef CHROME_BROWSER_SYNC_ENGINE_BUILD_AND_PROCESS_CONFLICT_SETS_COMMAND_H_
      6 #define CHROME_BROWSER_SYNC_ENGINE_BUILD_AND_PROCESS_CONFLICT_SETS_COMMAND_H_
      7 #pragma once
      8 
      9 #include <vector>
     10 
     11 #include "base/basictypes.h"
     12 #include "chrome/browser/sync/engine/model_changing_syncer_command.h"
     13 #include "chrome/browser/sync/engine/model_safe_worker.h"
     14 
     15 namespace syncable {
     16 class BaseTransaction;
     17 class Entry;
     18 class Id;
     19 class MutableEntry;
     20 class WriteTransaction;
     21 }  // namespace syncable
     22 
     23 namespace browser_sync {
     24 
     25 class ConflictResolver;
     26 class Cryptographer;
     27 
     28 namespace sessions {
     29 class ConflictProgress;
     30 class StatusController;
     31 }
     32 
     33 class BuildAndProcessConflictSetsCommand : public ModelChangingSyncerCommand {
     34  public:
     35   BuildAndProcessConflictSetsCommand();
     36   virtual ~BuildAndProcessConflictSetsCommand();
     37 
     38   // ModelChangingSyncerCommand implementation.
     39   virtual void ModelChangingExecuteImpl(sessions::SyncSession* session);
     40 
     41  private:
     42   bool BuildAndProcessConflictSets(sessions::SyncSession* session);
     43 
     44   bool ProcessSingleDirectionConflictSets(
     45       syncable::WriteTransaction* trans, ConflictResolver* resolver,
     46       Cryptographer* cryptographer, sessions::StatusController* status,
     47       const ModelSafeRoutingInfo& routes);
     48   bool ApplyUpdatesTransactionally(
     49       syncable::WriteTransaction* trans,
     50       const std::vector<syncable::Id>* const update_set,
     51       ConflictResolver* resolver,
     52       Cryptographer* cryptographer,
     53       const ModelSafeRoutingInfo& routes,
     54       sessions::StatusController* status);
     55   void BuildConflictSets(syncable::BaseTransaction* trans,
     56                          sessions::ConflictProgress* conflict_progress);
     57 
     58   void MergeSetsForNameClash(syncable::BaseTransaction* trans,
     59                              syncable::Entry* entry,
     60                              sessions::ConflictProgress* conflict_progress);
     61   void MergeSetsForIntroducedLoops(syncable::BaseTransaction* trans,
     62       syncable::Entry* entry,
     63       sessions::ConflictProgress* conflict_progress);
     64   void MergeSetsForNonEmptyDirectories(syncable::BaseTransaction* trans,
     65       syncable::Entry* entry,
     66       sessions::ConflictProgress* conflict_progress);
     67   void MergeSetsForPositionUpdate(syncable::BaseTransaction* trans,
     68       syncable::Entry* entry,
     69       sessions::ConflictProgress* conflict_progress);
     70 
     71   DISALLOW_COPY_AND_ASSIGN(BuildAndProcessConflictSetsCommand);
     72 };
     73 
     74 }  // namespace browser_sync
     75 
     76 #endif  // CHROME_BROWSER_SYNC_ENGINE_BUILD_AND_PROCESS_CONFLICT_SETS_COMMAND_H_
     77