| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 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 | 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/store_timestamps_command.h" | 5 #include "chrome/browser/sync/engine/store_timestamps_command.h" |
| 6 | 6 |
| 7 #include "chrome/browser/sync/sessions/status_controller.h" | 7 #include "chrome/browser/sync/sessions/status_controller.h" |
| 8 #include "chrome/browser/sync/sessions/sync_session.h" | 8 #include "chrome/browser/sync/sessions/sync_session.h" |
| 9 #include "chrome/browser/sync/syncable/directory_manager.h" | 9 #include "chrome/browser/sync/syncable/directory_manager.h" |
| 10 #include "chrome/browser/sync/syncable/model_type.h" | 10 #include "chrome/browser/sync/syncable/model_type.h" |
| 11 #include "chrome/browser/sync/syncable/syncable.h" | 11 #include "chrome/browser/sync/syncable/syncable.h" |
| 12 | 12 |
| 13 namespace browser_sync { | 13 namespace browser_sync { |
| 14 | 14 |
| 15 StoreTimestampsCommand::StoreTimestampsCommand() {} | 15 StoreTimestampsCommand::StoreTimestampsCommand() {} |
| 16 StoreTimestampsCommand::~StoreTimestampsCommand() {} | 16 StoreTimestampsCommand::~StoreTimestampsCommand() {} |
| 17 | 17 |
| 18 void StoreTimestampsCommand::ExecuteImpl(sessions::SyncSession* session) { | 18 void StoreTimestampsCommand::ExecuteImpl(sessions::SyncSession* session) { |
| 19 syncable::ScopedDirLookup dir(session->context()->directory_manager(), | 19 syncable::ScopedDirLookup dir(session->context()->directory_manager(), |
| 20 session->context()->account_name()); | 20 session->context()->account_name()); |
| 21 | 21 |
| 22 if (!dir.good()) { | 22 if (!dir.good()) { |
| 23 LOG(ERROR) << "Scoped dir lookup failed!"; | 23 LOG(ERROR) << "Scoped dir lookup failed!"; |
| 24 return; | 24 return; |
| 25 } | 25 } |
| 26 | 26 |
| 27 const GetUpdatesResponse& updates = | 27 const GetUpdatesResponse& updates = |
| 28 session->status_controller()->updates_response().get_updates(); | 28 session->status_controller().updates_response().get_updates(); |
| 29 | 29 |
| 30 sessions::StatusController* status = session->status_controller(); | 30 sessions::StatusController* status = session->mutable_status_controller(); |
| 31 | 31 |
| 32 // Update the progress marker tokens from the server result. If a marker | 32 // Update the progress marker tokens from the server result. If a marker |
| 33 // was omitted for any one type, that indicates no change from the previous | 33 // was omitted for any one type, that indicates no change from the previous |
| 34 // state. | 34 // state. |
| 35 syncable::ModelTypeBitSet forward_progress_types; | 35 syncable::ModelTypeBitSet forward_progress_types; |
| 36 for (int i = 0; i < updates.new_progress_marker_size(); ++i) { | 36 for (int i = 0; i < updates.new_progress_marker_size(); ++i) { |
| 37 syncable::ModelType model = | 37 syncable::ModelType model = |
| 38 syncable::GetModelTypeFromExtensionFieldNumber( | 38 syncable::GetModelTypeFromExtensionFieldNumber( |
| 39 updates.new_progress_marker(i).data_type_id()); | 39 updates.new_progress_marker(i).data_type_id()); |
| 40 if (model == syncable::UNSPECIFIED || model == syncable::TOP_LEVEL_FOLDER) { | 40 if (model == syncable::UNSPECIFIED || model == syncable::TOP_LEVEL_FOLDER) { |
| (...skipping 12 matching lines...) Expand all Loading... |
| 53 << status->updates_request_types().to_string(); | 53 << status->updates_request_types().to_string(); |
| 54 } | 54 } |
| 55 if (updates.has_changes_remaining()) { | 55 if (updates.has_changes_remaining()) { |
| 56 int64 changes_left = updates.changes_remaining(); | 56 int64 changes_left = updates.changes_remaining(); |
| 57 VLOG(1) << "Changes remaining: " << changes_left; | 57 VLOG(1) << "Changes remaining: " << changes_left; |
| 58 status->set_num_server_changes_remaining(changes_left); | 58 status->set_num_server_changes_remaining(changes_left); |
| 59 } | 59 } |
| 60 } | 60 } |
| 61 | 61 |
| 62 } // namespace browser_sync | 62 } // namespace browser_sync |
| OLD | NEW |