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 #include "chrome/browser/sync/engine/model_changing_syncer_command.h" | 5 #include "chrome/browser/sync/engine/model_changing_syncer_command.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/callback_old.h" | 8 #include "base/callback_old.h" |
9 #include "chrome/browser/sync/sessions/status_controller.h" | 9 #include "chrome/browser/sync/sessions/status_controller.h" |
10 #include "chrome/browser/sync/sessions/sync_session.h" | 10 #include "chrome/browser/sync/sessions/sync_session.h" |
11 #include "chrome/browser/sync/util/unrecoverable_error_info.h" | 11 #include "chrome/browser/sync/util/unrecoverable_error_info.h" |
12 | 12 |
13 namespace browser_sync { | 13 namespace browser_sync { |
14 | 14 |
15 void ModelChangingSyncerCommand::ExecuteImpl(sessions::SyncSession* session) { | 15 void ModelChangingSyncerCommand::ExecuteImpl(sessions::SyncSession* session) { |
16 work_session_ = session; | 16 work_session_ = session; |
17 if (!ModelNeutralExecuteImpl(work_session_)) { | 17 if (!ModelNeutralExecuteImpl(work_session_)) { |
18 return; | 18 return; |
19 } | 19 } |
20 | 20 |
21 const std::set<ModelSafeGroup>& groups_to_change = | 21 const std::set<ModelSafeGroup>& groups_to_change = |
22 HasCustomGroupsToChange() ? | 22 GetGroupsToChange(*work_session_); |
23 GetGroupsToChange(*work_session_) : | |
24 session->GetEnabledGroups(); | |
25 for (size_t i = 0; i < session->workers().size(); ++i) { | 23 for (size_t i = 0; i < session->workers().size(); ++i) { |
26 ModelSafeWorker* worker = work_session_->workers()[i]; | 24 ModelSafeWorker* worker = work_session_->workers()[i]; |
27 ModelSafeGroup group = worker->GetModelSafeGroup(); | 25 ModelSafeGroup group = worker->GetModelSafeGroup(); |
28 // Skip workers whose group isn't active. | 26 // Skip workers whose group isn't active. |
29 if (groups_to_change.count(group) == 0u) { | 27 if (groups_to_change.count(group) == 0u) { |
30 DVLOG(2) << "Skipping worker for group " | 28 DVLOG(2) << "Skipping worker for group " |
31 << ModelSafeGroupToString(group); | 29 << ModelSafeGroupToString(group); |
32 continue; | 30 continue; |
33 } | 31 } |
34 | 32 |
(...skipping 11 matching lines...) Expand all Loading... |
46 | 44 |
47 } | 45 } |
48 } | 46 } |
49 | 47 |
50 bool ModelChangingSyncerCommand::ModelNeutralExecuteImpl( | 48 bool ModelChangingSyncerCommand::ModelNeutralExecuteImpl( |
51 sessions::SyncSession* session) { | 49 sessions::SyncSession* session) { |
52 return true; | 50 return true; |
53 } | 51 } |
54 | 52 |
55 } // namespace browser_sync | 53 } // namespace browser_sync |
OLD | NEW |