1 // Copyright (c) 2010 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 #include "chrome/browser/sync/engine/model_changing_syncer_command.h" 6 7 #include "base/callback.h" 8 #include "chrome/browser/sync/engine/model_safe_worker.h" 9 #include "chrome/browser/sync/sessions/status_controller.h" 10 #include "chrome/browser/sync/sessions/sync_session.h" 11 12 namespace browser_sync { 13 14 void ModelChangingSyncerCommand::ExecuteImpl(sessions::SyncSession* session) { 15 work_session_ = session; 16 if (!ModelNeutralExecuteImpl(work_session_)) { 17 return; 18 } 19 20 for (size_t i = 0; i < session->workers().size(); ++i) { 21 ModelSafeWorker* worker = session->workers()[i]; 22 ModelSafeGroup group = worker->GetModelSafeGroup(); 23 24 sessions::StatusController* status = work_session_->status_controller(); 25 sessions::ScopedModelSafeGroupRestriction r(status, group); 26 scoped_ptr<Callback0::Type> c(NewCallback(this, 27 &ModelChangingSyncerCommand::StartChangingModel)); 28 worker->DoWorkAndWaitUntilDone(c.get()); 29 } 30 } 31 32 bool ModelChangingSyncerCommand::ModelNeutralExecuteImpl( 33 sessions::SyncSession* session) { 34 return true; 35 } 36 37 } // namespace browser_sync 38