OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE entry. |
| 4 |
| 5 #include "chrome/browser/sync/engine/syncer_end_command.h" |
| 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" |
| 11 #include "chrome/browser/sync/syncable/directory_manager.h" |
| 12 #include "chrome/browser/sync/util/event_sys-inl.h" |
| 13 |
| 14 namespace browser_sync { |
| 15 |
| 16 SyncerEndCommand::SyncerEndCommand() {} |
| 17 SyncerEndCommand::~SyncerEndCommand() {} |
| 18 |
| 19 void SyncerEndCommand::ExecuteImpl(SyncerSession* session) { |
| 20 ConflictResolutionView conflict_view(session); |
| 21 conflict_view.increment_num_sync_cycles(); |
| 22 SyncerStatus status(session); |
| 23 status.set_syncing(false); |
| 24 |
| 25 if (!session->ShouldSyncAgain()) { |
| 26 // This might be the first time we've fully completed a sync cycle. |
| 27 DCHECK(session->got_zero_updates()); |
| 28 |
| 29 syncable::ScopedDirLookup dir(session->dirman(), session->account_name()); |
| 30 if (!dir.good()) { |
| 31 LOG(ERROR) << "Scoped dir lookup failed!"; |
| 32 return; |
| 33 } |
| 34 |
| 35 // This gets persisted to the directory's backing store. |
| 36 dir->set_initial_sync_ended(true); |
| 37 } |
| 38 |
| 39 SyncerEvent event = { SyncerEvent::SYNC_CYCLE_ENDED }; |
| 40 event.last_session = session; |
| 41 session->syncer_event_channel()->NotifyListeners(event); |
| 42 } |
| 43 |
| 44 } // namespace browser_sync |
OLD | NEW |