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/verify_updates_command.h" | 5 #include "chrome/browser/sync/engine/verify_updates_command.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/location.h" | 9 #include "base/location.h" |
10 #include "chrome/browser/sync/engine/syncer.h" | 10 #include "chrome/browser/sync/engine/syncer.h" |
11 #include "chrome/browser/sync/engine/syncer_proto_util.h" | 11 #include "chrome/browser/sync/engine/syncer_proto_util.h" |
12 #include "chrome/browser/sync/engine/syncer_types.h" | 12 #include "chrome/browser/sync/engine/syncer_types.h" |
13 #include "chrome/browser/sync/engine/syncer_util.h" | 13 #include "chrome/browser/sync/engine/syncer_util.h" |
14 #include "chrome/browser/sync/engine/syncproto.h" | 14 #include "chrome/browser/sync/engine/syncproto.h" |
15 #include "chrome/browser/sync/protocol/bookmark_specifics.pb.h" | 15 #include "chrome/browser/sync/protocol/bookmark_specifics.pb.h" |
16 #include "chrome/browser/sync/syncable/directory_manager.h" | 16 #include "chrome/browser/sync/syncable/directory_manager.h" |
17 #include "chrome/browser/sync/syncable/syncable.h" | 17 #include "chrome/browser/sync/syncable/syncable.h" |
18 | 18 |
19 namespace browser_sync { | 19 namespace browser_sync { |
20 | 20 |
21 using syncable::ScopedDirLookup; | 21 using syncable::ScopedDirLookup; |
22 using syncable::WriteTransaction; | 22 using syncable::WriteTransaction; |
23 | 23 |
24 using syncable::GET_BY_ID; | 24 using syncable::GET_BY_ID; |
25 using syncable::SYNCER; | 25 using syncable::SYNCER; |
26 | 26 |
27 VerifyUpdatesCommand::VerifyUpdatesCommand() {} | 27 VerifyUpdatesCommand::VerifyUpdatesCommand() {} |
28 VerifyUpdatesCommand::~VerifyUpdatesCommand() {} | 28 VerifyUpdatesCommand::~VerifyUpdatesCommand() {} |
29 | 29 |
| 30 std::set<ModelSafeGroup> VerifyUpdatesCommand::GetGroupsToChange( |
| 31 const sessions::SyncSession& session) const { |
| 32 std::set<ModelSafeGroup> groups_with_updates; |
| 33 |
| 34 const GetUpdatesResponse& updates = |
| 35 session.status_controller().updates_response().get_updates(); |
| 36 for (int i = 0; i < updates.entries().size(); i++) { |
| 37 groups_with_updates.insert( |
| 38 GetGroupForModelType(syncable::GetModelType(updates.entries(i)), |
| 39 session.routing_info())); |
| 40 } |
| 41 |
| 42 return groups_with_updates; |
| 43 } |
| 44 |
30 void VerifyUpdatesCommand::ModelChangingExecuteImpl( | 45 void VerifyUpdatesCommand::ModelChangingExecuteImpl( |
31 sessions::SyncSession* session) { | 46 sessions::SyncSession* session) { |
32 VLOG(1) << "Beginning Update Verification"; | 47 VLOG(1) << "Beginning Update Verification"; |
33 ScopedDirLookup dir(session->context()->directory_manager(), | 48 ScopedDirLookup dir(session->context()->directory_manager(), |
34 session->context()->account_name()); | 49 session->context()->account_name()); |
35 if (!dir.good()) { | 50 if (!dir.good()) { |
36 LOG(ERROR) << "Scoped dir lookup failed!"; | 51 LOG(ERROR) << "Scoped dir lookup failed!"; |
37 return; | 52 return; |
38 } | 53 } |
39 WriteTransaction trans(FROM_HERE, SYNCER, dir); | 54 WriteTransaction trans(FROM_HERE, SYNCER, dir); |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 deleted, is_directory, model_type); | 135 deleted, is_directory, model_type); |
121 } | 136 } |
122 | 137 |
123 if (VERIFY_UNDECIDED == result.value) | 138 if (VERIFY_UNDECIDED == result.value) |
124 result.value = VERIFY_SUCCESS; // No news is good news. | 139 result.value = VERIFY_SUCCESS; // No news is good news. |
125 | 140 |
126 return result; // This might be VERIFY_SUCCESS as well | 141 return result; // This might be VERIFY_SUCCESS as well |
127 } | 142 } |
128 | 143 |
129 } // namespace browser_sync | 144 } // namespace browser_sync |
OLD | NEW |