| 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 | |
| 45 void VerifyUpdatesCommand::ModelChangingExecuteImpl( | 30 void VerifyUpdatesCommand::ModelChangingExecuteImpl( |
| 46 sessions::SyncSession* session) { | 31 sessions::SyncSession* session) { |
| 47 DVLOG(1) << "Beginning Update Verification"; | 32 DVLOG(1) << "Beginning Update Verification"; |
| 48 ScopedDirLookup dir(session->context()->directory_manager(), | 33 ScopedDirLookup dir(session->context()->directory_manager(), |
| 49 session->context()->account_name()); | 34 session->context()->account_name()); |
| 50 if (!dir.good()) { | 35 if (!dir.good()) { |
| 51 LOG(ERROR) << "Scoped dir lookup failed!"; | 36 LOG(ERROR) << "Scoped dir lookup failed!"; |
| 52 return; | 37 return; |
| 53 } | 38 } |
| 54 WriteTransaction trans(FROM_HERE, SYNCER, dir); | 39 WriteTransaction trans(FROM_HERE, SYNCER, dir); |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 deleted, is_directory, model_type); | 120 deleted, is_directory, model_type); |
| 136 } | 121 } |
| 137 | 122 |
| 138 if (VERIFY_UNDECIDED == result.value) | 123 if (VERIFY_UNDECIDED == result.value) |
| 139 result.value = VERIFY_SUCCESS; // No news is good news. | 124 result.value = VERIFY_SUCCESS; // No news is good news. |
| 140 | 125 |
| 141 return result; // This might be VERIFY_SUCCESS as well | 126 return result; // This might be VERIFY_SUCCESS as well |
| 142 } | 127 } |
| 143 | 128 |
| 144 } // namespace browser_sync | 129 } // namespace browser_sync |
| OLD | NEW |