Don't show supervised user as "already on this device" while they're being imported.
[chromium-blink-merge.git] / sync / internal_api / events / get_updates_response_event.cc
blob50bc551900fb953c4fdd274cd2dc3533f98bbd99
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"
10 namespace syncer {
12 GetUpdatesResponseEvent::GetUpdatesResponseEvent(
13 base::Time timestamp,
14 const sync_pb::ClientToServerResponse& response,
15 SyncerError error)
16 : timestamp_(timestamp),
17 response_(response),
18 error_(error) {
21 GetUpdatesResponseEvent::~GetUpdatesResponseEvent() {}
23 base::Time GetUpdatesResponseEvent::GetTimestamp() const {
24 return timestamp_;
27 std::string GetUpdatesResponseEvent::GetType() const {
28 return "GetUpdates Response";
31 std::string GetUpdatesResponseEvent::GetDetails() const {
32 switch (error_) {
33 case SYNCER_OK:
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());
39 default:
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(
54 timestamp_,
55 response_,
56 error_));
59 } // namespace syncer