OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "sync/internal_api/public/events/commit_response_event.h" | 5 #include "components/sync/engine/events/commit_response_event.h" |
6 | 6 |
7 #include "base/strings/stringprintf.h" | 7 #include "base/strings/stringprintf.h" |
8 #include "sync/protocol/proto_value_conversions.h" | 8 #include "components/sync/protocol/proto_value_conversions.h" |
9 | 9 |
10 namespace syncer { | 10 namespace syncer { |
11 | 11 |
12 CommitResponseEvent::CommitResponseEvent( | 12 CommitResponseEvent::CommitResponseEvent( |
13 base::Time timestamp, | 13 base::Time timestamp, |
14 SyncerError result, | 14 SyncerError result, |
15 const sync_pb::ClientToServerResponse& response) | 15 const sync_pb::ClientToServerResponse& response) |
16 : timestamp_(timestamp), | 16 : timestamp_(timestamp), result_(result), response_(response) {} |
17 result_(result), | |
18 response_(response) {} | |
19 | 17 |
20 CommitResponseEvent::~CommitResponseEvent() {} | 18 CommitResponseEvent::~CommitResponseEvent() {} |
21 | 19 |
22 base::Time CommitResponseEvent::GetTimestamp() const { | 20 base::Time CommitResponseEvent::GetTimestamp() const { |
23 return timestamp_; | 21 return timestamp_; |
24 } | 22 } |
25 | 23 |
26 std::string CommitResponseEvent::GetType() const { | 24 std::string CommitResponseEvent::GetType() const { |
27 return "Commit Response"; | 25 return "Commit Response"; |
28 } | 26 } |
29 | 27 |
30 std::string CommitResponseEvent::GetDetails() const { | 28 std::string CommitResponseEvent::GetDetails() const { |
31 return base::StringPrintf("Result: %s", GetSyncerErrorString(result_)); | 29 return base::StringPrintf("Result: %s", GetSyncerErrorString(result_)); |
32 } | 30 } |
33 | 31 |
34 std::unique_ptr<base::DictionaryValue> CommitResponseEvent::GetProtoMessage() | 32 std::unique_ptr<base::DictionaryValue> CommitResponseEvent::GetProtoMessage() |
35 const { | 33 const { |
36 return std::unique_ptr<base::DictionaryValue>( | 34 return std::unique_ptr<base::DictionaryValue>( |
37 ClientToServerResponseToValue(response_, false)); | 35 ClientToServerResponseToValue(response_, false)); |
38 } | 36 } |
39 | 37 |
40 std::unique_ptr<ProtocolEvent> CommitResponseEvent::Clone() const { | 38 std::unique_ptr<ProtocolEvent> CommitResponseEvent::Clone() const { |
41 return std::unique_ptr<ProtocolEvent>( | 39 return std::unique_ptr<ProtocolEvent>( |
42 new CommitResponseEvent(timestamp_, result_, response_)); | 40 new CommitResponseEvent(timestamp_, result_, response_)); |
43 } | 41 } |
44 | 42 |
45 } // namespace syncer | 43 } // namespace syncer |
OLD | NEW |