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

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

Issue 2130453004: [Sync] Move //sync to //components/sync. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 4 years, 4 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
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/normal_get_updates_request_event.h" 5 #include "components/sync/engine/events/normal_get_updates_request_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 #include "sync/sessions/nudge_tracker.h" 9 #include "components/sync/sessions_impl/nudge_tracker.h"
10 10
11 namespace syncer { 11 namespace syncer {
12 12
13 NormalGetUpdatesRequestEvent::NormalGetUpdatesRequestEvent( 13 NormalGetUpdatesRequestEvent::NormalGetUpdatesRequestEvent(
14 base::Time timestamp, 14 base::Time timestamp,
15 const sessions::NudgeTracker& nudge_tracker, 15 const sessions::NudgeTracker& nudge_tracker,
16 const sync_pb::ClientToServerMessage& request) 16 const sync_pb::ClientToServerMessage& request)
17 : timestamp_(timestamp), 17 : timestamp_(timestamp),
18 nudged_types_(nudge_tracker.GetNudgedTypes()), 18 nudged_types_(nudge_tracker.GetNudgedTypes()),
19 notified_types_(nudge_tracker.GetNotifiedTypes()), 19 notified_types_(nudge_tracker.GetNotifiedTypes()),
20 refresh_requested_types_(nudge_tracker.GetRefreshRequestedTypes()), 20 refresh_requested_types_(nudge_tracker.GetRefreshRequestedTypes()),
21 is_retry_(nudge_tracker.IsRetryRequired()), 21 is_retry_(nudge_tracker.IsRetryRequired()),
22 request_(request) { } 22 request_(request) {}
23 23
24 NormalGetUpdatesRequestEvent::~NormalGetUpdatesRequestEvent() {} 24 NormalGetUpdatesRequestEvent::~NormalGetUpdatesRequestEvent() {}
25 25
26 base::Time NormalGetUpdatesRequestEvent::GetTimestamp() const { 26 base::Time NormalGetUpdatesRequestEvent::GetTimestamp() const {
27 return timestamp_; 27 return timestamp_;
28 } 28 }
29 29
30 std::string NormalGetUpdatesRequestEvent::GetType() const { 30 std::string NormalGetUpdatesRequestEvent::GetType() const {
31 return "Normal GetUpdate request"; 31 return "Normal GetUpdate request";
32 } 32 }
33 33
34 std::string NormalGetUpdatesRequestEvent::GetDetails() const { 34 std::string NormalGetUpdatesRequestEvent::GetDetails() const {
35 std::string details; 35 std::string details;
36 36
37 if (!nudged_types_.Empty()) { 37 if (!nudged_types_.Empty()) {
38 if (!details.empty()) 38 if (!details.empty())
39 details.append("\n"); 39 details.append("\n");
40 details.append(base::StringPrintf( 40 details.append(base::StringPrintf(
41 "Nudged types: %s", 41 "Nudged types: %s", ModelTypeSetToString(nudged_types_).c_str()));
42 ModelTypeSetToString(nudged_types_).c_str()));
43 } 42 }
44 43
45 if (!notified_types_.Empty()) { 44 if (!notified_types_.Empty()) {
46 if (!details.empty()) 45 if (!details.empty())
47 details.append("\n"); 46 details.append("\n");
48 details.append(base::StringPrintf( 47 details.append(base::StringPrintf(
49 "Notified types: %s", 48 "Notified types: %s", ModelTypeSetToString(notified_types_).c_str()));
50 ModelTypeSetToString(notified_types_).c_str()));
51 } 49 }
52 50
53 if (!refresh_requested_types_.Empty()) { 51 if (!refresh_requested_types_.Empty()) {
54 if (!details.empty()) 52 if (!details.empty())
55 details.append("\n"); 53 details.append("\n");
56 details.append(base::StringPrintf( 54 details.append(base::StringPrintf(
57 "Refresh requested types: %s", 55 "Refresh requested types: %s",
58 ModelTypeSetToString(refresh_requested_types_).c_str())); 56 ModelTypeSetToString(refresh_requested_types_).c_str()));
59 } 57 }
60 58
61 if (is_retry_) { 59 if (is_retry_) {
62 if (!details.empty()) 60 if (!details.empty())
63 details.append("\n"); 61 details.append("\n");
64 details.append(base::StringPrintf("Is retry: True")); 62 details.append(base::StringPrintf("Is retry: True"));
65 } 63 }
66 64
67 return details; 65 return details;
68 } 66 }
69 67
70 std::unique_ptr<base::DictionaryValue> 68 std::unique_ptr<base::DictionaryValue>
71 NormalGetUpdatesRequestEvent::GetProtoMessage() const { 69 NormalGetUpdatesRequestEvent::GetProtoMessage() const {
72 return std::unique_ptr<base::DictionaryValue>( 70 return std::unique_ptr<base::DictionaryValue>(
73 ClientToServerMessageToValue(request_, false)); 71 ClientToServerMessageToValue(request_, false));
74 } 72 }
75 73
76 std::unique_ptr<ProtocolEvent> NormalGetUpdatesRequestEvent::Clone() const { 74 std::unique_ptr<ProtocolEvent> NormalGetUpdatesRequestEvent::Clone() const {
77 return std::unique_ptr<ProtocolEvent>(new NormalGetUpdatesRequestEvent( 75 return std::unique_ptr<ProtocolEvent>(new NormalGetUpdatesRequestEvent(
78 timestamp_, nudged_types_, notified_types_, refresh_requested_types_, 76 timestamp_, nudged_types_, notified_types_, refresh_requested_types_,
79 is_retry_, request_)); 77 is_retry_, request_));
80 } 78 }
81 79
82 NormalGetUpdatesRequestEvent::NormalGetUpdatesRequestEvent( 80 NormalGetUpdatesRequestEvent::NormalGetUpdatesRequestEvent(
83 base::Time timestamp, 81 base::Time timestamp,
84 ModelTypeSet nudged_types, 82 ModelTypeSet nudged_types,
85 ModelTypeSet notified_types, 83 ModelTypeSet notified_types,
86 ModelTypeSet refresh_requested_types, 84 ModelTypeSet refresh_requested_types,
87 bool is_retry, 85 bool is_retry,
88 sync_pb::ClientToServerMessage request) 86 sync_pb::ClientToServerMessage request)
89 : timestamp_(timestamp), 87 : timestamp_(timestamp),
90 nudged_types_(nudged_types), 88 nudged_types_(nudged_types),
91 notified_types_(notified_types), 89 notified_types_(notified_types),
92 refresh_requested_types_(refresh_requested_types), 90 refresh_requested_types_(refresh_requested_types),
93 is_retry_(is_retry), 91 is_retry_(is_retry),
94 request_(request) {} 92 request_(request) {}
95 93
96 } // namespace syncer 94 } // namespace syncer
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698