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
3// found in the LICENSE file.
4
5#include "chrome/browser/sync/engine/syncer_end_command.h"
6
7#include "chrome/browser/sync/engine/syncer_types.h"
8#include "chrome/browser/sync/sessions/sync_session.h"
9#include "chrome/browser/sync/syncable/directory_manager.h"
10#include "chrome/common/deprecated/event_sys-inl.h"
11
12namespace browser_sync {
13
14SyncerEndCommand::SyncerEndCommand() {}
15SyncerEndCommand::~SyncerEndCommand() {}
16
17void SyncerEndCommand::ExecuteImpl(sessions::SyncSession* session) {
18  // Always send out a cycle ended notification, regardless of end-state.
19  session->status_controller()->set_syncing(false);
20  SyncEngineEvent event(SyncEngineEvent::SYNC_CYCLE_ENDED);
21  sessions::SyncSessionSnapshot snapshot(session->TakeSnapshot());
22  event.snapshot = &snapshot;
23  session->context()->NotifyListeners(event);
24  VLOG(1) << this << " sent sync end snapshot";
25}
26
27}  // namespace browser_sync
28