blob: 0a1de1f56d415b6852f464419ced93341ed5b223 (
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
50
51
52
53
54
|
// 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/commit_request_event.h"
#include "base/format_macros.h"
#include "base/strings/stringprintf.h"
#include "sync/protocol/proto_value_conversions.h"
namespace syncer {
CommitRequestEvent::CommitRequestEvent(
base::Time timestamp,
size_t num_items,
ModelTypeSet contributing_types_,
const sync_pb::ClientToServerMessage& request)
: timestamp_(timestamp),
num_items_(num_items),
contributing_types_(contributing_types_),
request_(request) {}
CommitRequestEvent::~CommitRequestEvent() {}
base::Time CommitRequestEvent::GetTimestamp() const {
return timestamp_;
}
std::string CommitRequestEvent::GetType() const {
return "Commit Request";
}
std::string CommitRequestEvent::GetDetails() const {
return base::StringPrintf(
"Item count: %" PRIuS "\n"
"Contributing types: %s",
num_items_,
ModelTypeSetToString(contributing_types_).c_str());
}
scoped_ptr<base::DictionaryValue> CommitRequestEvent::GetProtoMessage() const {
return scoped_ptr<base::DictionaryValue>(
ClientToServerMessageToValue(request_, false));
}
scoped_ptr<ProtocolEvent> CommitRequestEvent::Clone() const {
return scoped_ptr<ProtocolEvent>(
new CommitRequestEvent(timestamp_,
num_items_,
contributing_types_,
request_));
}
} // namespace syncer
|