| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 entry. | 3 // found in the LICENSE entry. |
| 4 | 4 |
| 5 #include "chrome/browser/sync/engine/syncer_end_command.h" | 5 #include "chrome/browser/sync/engine/syncer_end_command.h" |
| 6 | 6 |
| 7 #include "chrome/browser/sync/engine/conflict_resolution_view.h" | |
| 8 #include "chrome/browser/sync/engine/syncer_session.h" | |
| 9 #include "chrome/browser/sync/engine/syncer_status.h" | |
| 10 #include "chrome/browser/sync/engine/syncer_types.h" | 7 #include "chrome/browser/sync/engine/syncer_types.h" |
| 8 #include "chrome/browser/sync/sessions/sync_session.h" |
| 11 #include "chrome/browser/sync/syncable/directory_manager.h" | 9 #include "chrome/browser/sync/syncable/directory_manager.h" |
| 12 #include "chrome/browser/sync/util/event_sys-inl.h" | 10 #include "chrome/browser/sync/util/event_sys-inl.h" |
| 13 | 11 |
| 14 namespace browser_sync { | 12 namespace browser_sync { |
| 15 | 13 |
| 16 SyncerEndCommand::SyncerEndCommand() {} | 14 SyncerEndCommand::SyncerEndCommand() {} |
| 17 SyncerEndCommand::~SyncerEndCommand() {} | 15 SyncerEndCommand::~SyncerEndCommand() {} |
| 18 | 16 |
| 19 void SyncerEndCommand::ExecuteImpl(SyncerSession* session) { | 17 void SyncerEndCommand::ExecuteImpl(sessions::SyncSession* session) { |
| 20 SyncerStatus status(session); | 18 sessions::StatusController* status(session->status_controller()); |
| 21 status.set_syncing(false); | 19 status->set_syncing(false); |
| 22 | 20 |
| 23 if (!session->HasMoreToSync()) { | 21 if (!session->HasMoreToSync()) { |
| 24 // This might be the first time we've fully completed a sync cycle. | 22 // This might be the first time we've fully completed a sync cycle. |
| 25 DCHECK(session->got_zero_updates()); | 23 DCHECK(status->got_zero_updates()); |
| 26 | 24 |
| 27 syncable::ScopedDirLookup dir(session->dirman(), session->account_name()); | 25 syncable::ScopedDirLookup dir(session->context()->directory_manager(), |
| 26 session->context()->account_name()); |
| 28 if (!dir.good()) { | 27 if (!dir.good()) { |
| 29 LOG(ERROR) << "Scoped dir lookup failed!"; | 28 LOG(ERROR) << "Scoped dir lookup failed!"; |
| 30 return; | 29 return; |
| 31 } | 30 } |
| 32 | 31 |
| 33 // This gets persisted to the directory's backing store. | 32 // This gets persisted to the directory's backing store. |
| 34 dir->set_initial_sync_ended(true); | 33 dir->set_initial_sync_ended(true); |
| 35 } | 34 } |
| 36 | 35 |
| 37 SyncerEvent event = { SyncerEvent::SYNC_CYCLE_ENDED }; | 36 SyncerEvent event(SyncerEvent::SYNC_CYCLE_ENDED); |
| 38 event.last_session = session; | 37 sessions::SyncSessionSnapshot snapshot(session->TakeSnapshot()); |
| 39 session->syncer_event_channel()->NotifyListeners(event); | 38 event.snapshot = &snapshot; |
| 39 session->context()->syncer_event_channel()->NotifyListeners(event); |
| 40 } | 40 } |
| 41 | 41 |
| 42 } // namespace browser_sync | 42 } // namespace browser_sync |
| OLD | NEW |