1 // Copyright 2014 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.
5 #include "sync/internal_api/public/events/get_updates_response_event.h"
7 #include "base/strings/stringprintf.h"
8 #include "sync/protocol/proto_value_conversions.h"
12 GetUpdatesResponseEvent::GetUpdatesResponseEvent(
14 const sync_pb::ClientToServerResponse
& response
,
16 : timestamp_(timestamp
),
21 GetUpdatesResponseEvent::~GetUpdatesResponseEvent() {}
23 base::Time
GetUpdatesResponseEvent::GetTimestamp() const {
27 std::string
GetUpdatesResponseEvent::GetType() const {
28 return "GetUpdates Response";
31 std::string
GetUpdatesResponseEvent::GetDetails() const {
34 return base::StringPrintf("Received %d update(s).",
35 response_
.get_updates().entries_size());
36 case SERVER_MORE_TO_DOWNLOAD
:
37 return base::StringPrintf("Received %d update(s). Some updates remain.",
38 response_
.get_updates().entries_size());
40 return base::StringPrintf("Received error: %s",
41 GetSyncerErrorString(error_
));
45 scoped_ptr
<base::DictionaryValue
>
46 GetUpdatesResponseEvent::GetProtoMessage() const {
47 return scoped_ptr
<base::DictionaryValue
>(
48 ClientToServerResponseToValue(response_
, false));
51 scoped_ptr
<ProtocolEvent
> GetUpdatesResponseEvent::Clone() const {
52 return scoped_ptr
<ProtocolEvent
>(
53 new GetUpdatesResponseEvent(