summaryrefslogtreecommitdiffstats
path: root/sync/internal_api/events/configure_get_updates_request_event.cc
blob: 8b487b60c862e5e9d0fe31c26fe6ff92de18c333 (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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
// Copyright 2014 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/internal_api/public/events/configure_get_updates_request_event.h"

#include "base/strings/stringprintf.h"
#include "sync/protocol/proto_enum_conversions.h"
#include "sync/protocol/proto_value_conversions.h"

namespace syncer {

ConfigureGetUpdatesRequestEvent::ConfigureGetUpdatesRequestEvent(
      base::Time timestamp,
      sync_pb::SyncEnums::GetUpdatesOrigin origin,
      const sync_pb::ClientToServerMessage& request)
  : timestamp_(timestamp),
    origin_(origin),
    request_(request) { }

ConfigureGetUpdatesRequestEvent::~ConfigureGetUpdatesRequestEvent() {}

base::Time ConfigureGetUpdatesRequestEvent::GetTimestamp() const {
  return timestamp_;
}

std::string ConfigureGetUpdatesRequestEvent::GetType() const {
  return "Initial GetUpdates";
}

std::string ConfigureGetUpdatesRequestEvent::GetDetails() const {
  return base::StringPrintf("Reason: %s", GetUpdatesOriginString(origin_));
}

scoped_ptr<base::DictionaryValue>
ConfigureGetUpdatesRequestEvent::GetProtoMessage() const {
  return scoped_ptr<base::DictionaryValue>(
    ClientToServerMessageToValue(request_, false));
}

scoped_ptr<ProtocolEvent> ConfigureGetUpdatesRequestEvent::Clone() const {
  return scoped_ptr<ProtocolEvent>(
      new ConfigureGetUpdatesRequestEvent(
          timestamp_,
          origin_,
          request_));
}

}  // namespace syncer