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/commit_request_event.h"
7 #include "base/format_macros.h"
8 #include "base/strings/stringprintf.h"
9 #include "sync/protocol/proto_value_conversions.h"
13 CommitRequestEvent::CommitRequestEvent(
16 ModelTypeSet contributing_types_
,
17 const sync_pb::ClientToServerMessage
& request
)
18 : timestamp_(timestamp
),
19 num_items_(num_items
),
20 contributing_types_(contributing_types_
),
23 CommitRequestEvent::~CommitRequestEvent() {}
25 base::Time
CommitRequestEvent::GetTimestamp() const {
29 std::string
CommitRequestEvent::GetType() const {
30 return "Commit Request";
33 std::string
CommitRequestEvent::GetDetails() const {
34 return base::StringPrintf(
35 "Item count: %" PRIuS
"\n"
36 "Contributing types: %s",
38 ModelTypeSetToString(contributing_types_
).c_str());
41 scoped_ptr
<base::DictionaryValue
> CommitRequestEvent::GetProtoMessage() const {
42 return scoped_ptr
<base::DictionaryValue
>(
43 ClientToServerMessageToValue(request_
, false));
46 scoped_ptr
<ProtocolEvent
> CommitRequestEvent::Clone() const {
47 return scoped_ptr
<ProtocolEvent
>(
48 new CommitRequestEvent(timestamp_
,