summaryrefslogtreecommitdiffstats
path: root/sync/engine/syncer_command.cc
blob: 60e8debd4a714e19fd59b99a14dc64715f9d991e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "sync/engine/syncer_command.h"

#include "sync/engine/net/server_connection_manager.h"
#include "sync/sessions/sync_session.h"

namespace browser_sync {
using sessions::SyncSession;

SyncerCommand::SyncerCommand() {}
SyncerCommand::~SyncerCommand() {}

SyncerError SyncerCommand::Execute(SyncSession* session) {
  SyncerError result = ExecuteImpl(session);
  SendNotifications(session);
  return result;
}

void SyncerCommand::SendNotifications(SyncSession* session) {
  if (session->mutable_status_controller()->TestAndClearIsDirty()) {
    SyncEngineEvent event(SyncEngineEvent::STATUS_CHANGED);
    event.snapshot = session->TakeSnapshot();
    session->context()->NotifyListeners(event);
  }
}

}  // namespace browser_sync