Revert "Fix broken channel icon in chrome://help on CrOS" and try again
[chromium-blink-merge.git] / sync / internal_api / events / commit_request_event.cc
blob0a1de1f56d415b6852f464419ced93341ed5b223
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"
11 namespace syncer {
13 CommitRequestEvent::CommitRequestEvent(
14 base::Time timestamp,
15 size_t num_items,
16 ModelTypeSet contributing_types_,
17 const sync_pb::ClientToServerMessage& request)
18 : timestamp_(timestamp),
19 num_items_(num_items),
20 contributing_types_(contributing_types_),
21 request_(request) {}
23 CommitRequestEvent::~CommitRequestEvent() {}
25 base::Time CommitRequestEvent::GetTimestamp() const {
26 return timestamp_;
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",
37 num_items_,
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_,
49 num_items_,
50 contributing_types_,
51 request_));
54 } // namespace syncer