Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(117)

Side by Side Diff: components/sync/engine/events/get_updates_response_event.cc

Issue 2436863005: [Sync] Move events files around a bit. (Closed)
Patch Set: Rebase. Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
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.
4
5 #include "components/sync/engine/events/get_updates_response_event.h"
6
7 #include "base/strings/stringprintf.h"
8 #include "components/sync/protocol/proto_value_conversions.h"
9
10 namespace syncer {
11
12 GetUpdatesResponseEvent::GetUpdatesResponseEvent(
13 base::Time timestamp,
14 const sync_pb::ClientToServerResponse& response,
15 SyncerError error)
16 : timestamp_(timestamp), response_(response), error_(error) {}
17
18 GetUpdatesResponseEvent::~GetUpdatesResponseEvent() {}
19
20 base::Time GetUpdatesResponseEvent::GetTimestamp() const {
21 return timestamp_;
22 }
23
24 std::string GetUpdatesResponseEvent::GetType() const {
25 return "GetUpdates Response";
26 }
27
28 std::string GetUpdatesResponseEvent::GetDetails() const {
29 switch (error_) {
30 case SYNCER_OK:
31 return base::StringPrintf("Received %d update(s).",
32 response_.get_updates().entries_size());
33 case SERVER_MORE_TO_DOWNLOAD:
34 return base::StringPrintf("Received %d update(s). Some updates remain.",
35 response_.get_updates().entries_size());
36 default:
37 return base::StringPrintf("Received error: %s",
38 GetSyncerErrorString(error_));
39 }
40 }
41
42 std::unique_ptr<base::DictionaryValue>
43 GetUpdatesResponseEvent::GetProtoMessage() const {
44 return std::unique_ptr<base::DictionaryValue>(
45 ClientToServerResponseToValue(response_, false));
46 }
47
48 std::unique_ptr<ProtocolEvent> GetUpdatesResponseEvent::Clone() const {
49 return std::unique_ptr<ProtocolEvent>(
50 new GetUpdatesResponseEvent(timestamp_, response_, error_));
51 }
52
53 } // namespace syncer
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698