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

Side by Side Diff: sync/internal_api/public/sessions/sync_session_snapshot.cc

Issue 11416126: Track merged nudge sources (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix type ID Created 8 years, 1 month 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/sessions/sync_session_snapshot.h" 5 #include "sync/internal_api/public/sessions/sync_session_snapshot.h"
6 6
7 #include "base/json/json_writer.h" 7 #include "base/json/json_writer.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/values.h" 9 #include "base/values.h"
10 10
(...skipping 16 matching lines...) Expand all
27 SyncSessionSnapshot::SyncSessionSnapshot( 27 SyncSessionSnapshot::SyncSessionSnapshot(
28 const ModelNeutralState& model_neutral_state, 28 const ModelNeutralState& model_neutral_state,
29 bool is_share_usable, 29 bool is_share_usable,
30 ModelTypeSet initial_sync_ended, 30 ModelTypeSet initial_sync_ended,
31 const ProgressMarkerMap& download_progress_markers, 31 const ProgressMarkerMap& download_progress_markers,
32 bool is_silenced, 32 bool is_silenced,
33 int num_encryption_conflicts, 33 int num_encryption_conflicts,
34 int num_hierarchy_conflicts, 34 int num_hierarchy_conflicts,
35 int num_server_conflicts, 35 int num_server_conflicts,
36 const SyncSourceInfo& source, 36 const SyncSourceInfo& source,
37 const std::vector<SyncSourceInfo>& merged_sources_log,
37 bool notifications_enabled, 38 bool notifications_enabled,
38 size_t num_entries, 39 size_t num_entries,
39 base::Time sync_start_time, 40 base::Time sync_start_time,
40 const std::vector<int>& num_entries_by_type, 41 const std::vector<int>& num_entries_by_type,
41 const std::vector<int>& num_to_delete_entries_by_type) 42 const std::vector<int>& num_to_delete_entries_by_type)
42 : model_neutral_state_(model_neutral_state), 43 : model_neutral_state_(model_neutral_state),
43 is_share_usable_(is_share_usable), 44 is_share_usable_(is_share_usable),
44 initial_sync_ended_(initial_sync_ended), 45 initial_sync_ended_(initial_sync_ended),
45 download_progress_markers_(download_progress_markers), 46 download_progress_markers_(download_progress_markers),
46 is_silenced_(is_silenced), 47 is_silenced_(is_silenced),
47 num_encryption_conflicts_(num_encryption_conflicts), 48 num_encryption_conflicts_(num_encryption_conflicts),
48 num_hierarchy_conflicts_(num_hierarchy_conflicts), 49 num_hierarchy_conflicts_(num_hierarchy_conflicts),
49 num_server_conflicts_(num_server_conflicts), 50 num_server_conflicts_(num_server_conflicts),
50 source_(source), 51 source_(source),
52 merged_sources_log_(merged_sources_log),
51 notifications_enabled_(notifications_enabled), 53 notifications_enabled_(notifications_enabled),
52 num_entries_(num_entries), 54 num_entries_(num_entries),
53 sync_start_time_(sync_start_time), 55 sync_start_time_(sync_start_time),
54 num_entries_by_type_(num_entries_by_type), 56 num_entries_by_type_(num_entries_by_type),
55 num_to_delete_entries_by_type_(num_to_delete_entries_by_type), 57 num_to_delete_entries_by_type_(num_to_delete_entries_by_type),
56 is_initialized_(true) { 58 is_initialized_(true) {
57 } 59 }
58 60
59 SyncSessionSnapshot::~SyncSessionSnapshot() {} 61 SyncSessionSnapshot::~SyncSessionSnapshot() {}
60 62
(...skipping 24 matching lines...) Expand all
85 value->SetBoolean("isSilenced", is_silenced_); 87 value->SetBoolean("isSilenced", is_silenced_);
86 // We don't care too much if we lose precision here, also. 88 // We don't care too much if we lose precision here, also.
87 value->SetInteger("numEncryptionConflicts", 89 value->SetInteger("numEncryptionConflicts",
88 num_encryption_conflicts_); 90 num_encryption_conflicts_);
89 value->SetInteger("numHierarchyConflicts", 91 value->SetInteger("numHierarchyConflicts",
90 num_hierarchy_conflicts_); 92 num_hierarchy_conflicts_);
91 value->SetInteger("numServerConflicts", 93 value->SetInteger("numServerConflicts",
92 num_server_conflicts_); 94 num_server_conflicts_);
93 value->SetInteger("numEntries", num_entries_); 95 value->SetInteger("numEntries", num_entries_);
94 value->Set("source", source_.ToValue()); 96 value->Set("source", source_.ToValue());
97 scoped_ptr<ListValue> sources_list(new ListValue());
98 for (std::vector<SyncSourceInfo>::const_iterator i =
99 merged_sources_log_.begin(); i != merged_sources_log_.end(); ++i) {
100 sources_list->Append(i->ToValue());
101 }
102 value->Set("sourcesList", sources_list.release());
95 value->SetBoolean("notificationsEnabled", notifications_enabled_); 103 value->SetBoolean("notificationsEnabled", notifications_enabled_);
96 104
97
98 scoped_ptr<DictionaryValue> counter_entries(new DictionaryValue()); 105 scoped_ptr<DictionaryValue> counter_entries(new DictionaryValue());
99 for (int i = FIRST_REAL_MODEL_TYPE; i < MODEL_TYPE_COUNT; i++) { 106 for (int i = FIRST_REAL_MODEL_TYPE; i < MODEL_TYPE_COUNT; i++) {
100 scoped_ptr<DictionaryValue> type_entries(new DictionaryValue()); 107 scoped_ptr<DictionaryValue> type_entries(new DictionaryValue());
101 type_entries->SetInteger("numEntries", num_entries_by_type_[i]); 108 type_entries->SetInteger("numEntries", num_entries_by_type_[i]);
102 type_entries->SetInteger("numToDeleteEntries", 109 type_entries->SetInteger("numToDeleteEntries",
103 num_to_delete_entries_by_type_[i]); 110 num_to_delete_entries_by_type_[i]);
104 111
105 const std::string model_type = ModelTypeToString(static_cast<ModelType>(i)); 112 const std::string model_type = ModelTypeToString(static_cast<ModelType>(i));
106 counter_entries->Set(model_type, type_entries.release()); 113 counter_entries->Set(model_type, type_entries.release());
107 } 114 }
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 } 155 }
149 156
150 int SyncSessionSnapshot::num_server_conflicts() const { 157 int SyncSessionSnapshot::num_server_conflicts() const {
151 return num_server_conflicts_; 158 return num_server_conflicts_;
152 } 159 }
153 160
154 SyncSourceInfo SyncSessionSnapshot::source() const { 161 SyncSourceInfo SyncSessionSnapshot::source() const {
155 return source_; 162 return source_;
156 } 163 }
157 164
165 const std::vector<SyncSourceInfo>&
166 SyncSessionSnapshot::merged_sources_log() const {
167 return merged_sources_log_;
168 }
169
158 bool SyncSessionSnapshot::notifications_enabled() const { 170 bool SyncSessionSnapshot::notifications_enabled() const {
159 return notifications_enabled_; 171 return notifications_enabled_;
160 } 172 }
161 173
162 size_t SyncSessionSnapshot::num_entries() const { 174 size_t SyncSessionSnapshot::num_entries() const {
163 return num_entries_; 175 return num_entries_;
164 } 176 }
165 177
166 base::Time SyncSessionSnapshot::sync_start_time() const { 178 base::Time SyncSessionSnapshot::sync_start_time() const {
167 return sync_start_time_; 179 return sync_start_time_;
168 } 180 }
169 181
170 bool SyncSessionSnapshot::is_initialized() const { 182 bool SyncSessionSnapshot::is_initialized() const {
171 return is_initialized_; 183 return is_initialized_;
172 } 184 }
173 185
174 const std::vector<int>& SyncSessionSnapshot::num_entries_by_type() const { 186 const std::vector<int>& SyncSessionSnapshot::num_entries_by_type() const {
175 return num_entries_by_type_; 187 return num_entries_by_type_;
176 } 188 }
177 189
178 const std::vector<int>& 190 const std::vector<int>&
179 SyncSessionSnapshot::num_to_delete_entries_by_type() const { 191 SyncSessionSnapshot::num_to_delete_entries_by_type() const {
180 return num_to_delete_entries_by_type_; 192 return num_to_delete_entries_by_type_;
181 } 193 }
182 194
183 } // namespace sessions 195 } // namespace sessions
184 } // namespace syncer 196 } // namespace syncer
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698