OLD | NEW |
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 "components/sync/driver/about_sync_util.h" | 5 #include "components/sync/driver/about_sync_util.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/location.h" | 10 #include "base/location.h" |
| 11 #include "base/logging.h" |
11 #include "base/memory/ptr_util.h" | 12 #include "base/memory/ptr_util.h" |
12 #include "base/strings/string16.h" | 13 #include "base/strings/string16.h" |
13 #include "base/strings/stringprintf.h" | 14 #include "base/strings/stringprintf.h" |
14 #include "base/values.h" | 15 #include "base/values.h" |
15 #include "components/signin/core/browser/signin_manager_base.h" | 16 #include "components/signin/core/browser/signin_manager_base.h" |
16 #include "components/sync/driver/sync_service.h" | 17 #include "components/sync/driver/sync_service.h" |
17 #include "components/sync/engine/cycle/sync_cycle_snapshot.h" | 18 #include "components/sync/engine/cycle/sync_cycle_snapshot.h" |
18 #include "components/sync/engine/sync_status.h" | 19 #include "components/sync/engine/sync_status.h" |
19 #include "components/sync/engine/sync_string_conversions.h" | 20 #include "components/sync/engine/sync_string_conversions.h" |
20 #include "components/sync/model/time.h" | 21 #include "components/sync/model/time.h" |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 // Creates a 'section' for display on about:sync, consisting of a title and a | 70 // Creates a 'section' for display on about:sync, consisting of a title and a |
70 // list of fields. Returns a pointer to the new section. Note that | 71 // list of fields. Returns a pointer to the new section. Note that |
71 // |parent_list|, not the caller, owns the newly added section. | 72 // |parent_list|, not the caller, owns the newly added section. |
72 base::ListValue* AddSection(base::ListValue* parent_list, | 73 base::ListValue* AddSection(base::ListValue* parent_list, |
73 const std::string& title) { | 74 const std::string& title) { |
74 std::unique_ptr<base::DictionaryValue> section(new base::DictionaryValue()); | 75 std::unique_ptr<base::DictionaryValue> section(new base::DictionaryValue()); |
75 base::ListValue* section_contents = new base::ListValue(); | 76 base::ListValue* section_contents = new base::ListValue(); |
76 section->SetString("title", title); | 77 section->SetString("title", title); |
77 section->Set("data", section_contents); | 78 section->Set("data", section_contents); |
78 section->SetBoolean("is_sensitive", false); | 79 section->SetBoolean("is_sensitive", false); |
| 80 // If the following |Append| results in a reallocation, pointers to the |
| 81 // members of |parent_list| will be invalidated. This would result in |
| 82 // use-after-free in |*SyncStat::SetValue|. This is why the following CHECK is |
| 83 // necessary to ensure no reallocation takes place. |
| 84 // TODO(crbug.com/702230): Remove the usages of raw pointers in this file. |
| 85 CHECK_LT(parent_list->GetSize(), parent_list->capacity()); |
79 parent_list->Append(std::move(section)); | 86 parent_list->Append(std::move(section)); |
80 return section_contents; | 87 return section_contents; |
81 } | 88 } |
82 | 89 |
83 // Same as AddSection, but for data that should be elided when dumped into text | 90 // Same as AddSection, but for data that should be elided when dumped into text |
84 // form and posted in a public forum (e.g. unique identifiers). | 91 // form and posted in a public forum (e.g. unique identifiers). |
85 base::ListValue* AddSensitiveSection(base::ListValue* parent_list, | 92 base::ListValue* AddSensitiveSection(base::ListValue* parent_list, |
86 const std::string& title) { | 93 const std::string& title) { |
87 std::unique_ptr<base::DictionaryValue> section(new base::DictionaryValue()); | 94 std::unique_ptr<base::DictionaryValue> section(new base::DictionaryValue()); |
88 base::ListValue* section_contents = new base::ListValue(); | 95 base::ListValue* section_contents = new base::ListValue(); |
89 section->SetString("title", title); | 96 section->SetString("title", title); |
90 section->Set("data", section_contents); | 97 section->Set("data", section_contents); |
91 section->SetBoolean("is_sensitive", true); | 98 section->SetBoolean("is_sensitive", true); |
| 99 // If the following |Append| results in a reallocation, pointers to |
| 100 // |parent_list| and its members will be invalidated. This would result in |
| 101 // use-after-free in |*SyncStat::SetValue|. This is why the following CHECK is |
| 102 // necessary to ensure no reallocation takes place. |
| 103 CHECK_LT(parent_list->GetSize(), parent_list->capacity()); |
| 104 // TODO(crbug.com/702230): Remove the usages of raw pointers in this file. |
92 parent_list->Append(std::move(section)); | 105 parent_list->Append(std::move(section)); |
93 return section_contents; | 106 return section_contents; |
94 } | 107 } |
95 | 108 |
96 // The following helper classes help manage the about:sync fields which will be | 109 // The following helper classes help manage the about:sync fields which will be |
97 // populated in method in ConstructAboutInformation. | 110 // populated in method in ConstructAboutInformation. |
98 // | 111 // |
99 // Each instance of one of thse classes indicates a field in about:sync. Each | 112 // Each instance of one of thse classes indicates a field in about:sync. Each |
100 // field will be serialized to a DictionaryValue with entries for 'stat_name', | 113 // field will be serialized to a DictionaryValue with entries for 'stat_name', |
101 // 'stat_value' and 'is_valid'. | 114 // 'stat_value' and 'is_valid'. |
102 | 115 |
103 class StringSyncStat { | 116 class StringSyncStat { |
104 public: | 117 public: |
105 StringSyncStat(base::ListValue* section, const std::string& key); | 118 StringSyncStat(base::ListValue* section, const std::string& key); |
106 void SetValue(const std::string& value); | 119 void SetValue(const std::string& value); |
107 void SetValue(const base::string16& value); | 120 void SetValue(const base::string16& value); |
108 | 121 |
109 private: | 122 private: |
110 // Owned by the |section| passed in during construction. | 123 // Owned by the |section| passed in during construction. |
111 base::DictionaryValue* stat_; | 124 base::DictionaryValue* stat_; |
112 }; | 125 }; |
113 | 126 |
114 StringSyncStat::StringSyncStat(base::ListValue* section, | 127 StringSyncStat::StringSyncStat(base::ListValue* section, |
115 const std::string& key) { | 128 const std::string& key) { |
116 stat_ = new base::DictionaryValue(); | 129 stat_ = new base::DictionaryValue(); |
117 stat_->SetString("stat_name", key); | 130 stat_->SetString("stat_name", key); |
118 stat_->SetString("stat_value", "Uninitialized"); | 131 stat_->SetString("stat_value", "Uninitialized"); |
119 stat_->SetBoolean("is_valid", false); | 132 stat_->SetBoolean("is_valid", false); |
| 133 // |stat_| will be invalidated by |Append|, so it needs to be reset. |
| 134 // Furthermore, if |Append| results in a reallocation, |stat_| members of |
| 135 // other SyncStats will be invalidated. This is why the following check is |
| 136 // necessary, so that it is guaranteed that a reallocation will not happen. |
| 137 // TODO(crbug.com/702230): Remove the usages of raw pointers in this file. |
| 138 CHECK_LT(section->GetSize(), section->capacity()); |
120 section->Append(base::WrapUnique(stat_)); | 139 section->Append(base::WrapUnique(stat_)); |
| 140 section->GetDictionary(section->GetSize() - 1, &stat_); |
121 } | 141 } |
122 | 142 |
123 void StringSyncStat::SetValue(const std::string& value) { | 143 void StringSyncStat::SetValue(const std::string& value) { |
124 stat_->SetString("stat_value", value); | 144 stat_->SetString("stat_value", value); |
125 stat_->SetBoolean("is_valid", true); | 145 stat_->SetBoolean("is_valid", true); |
126 } | 146 } |
127 | 147 |
128 void StringSyncStat::SetValue(const base::string16& value) { | 148 void StringSyncStat::SetValue(const base::string16& value) { |
129 stat_->SetString("stat_value", value); | 149 stat_->SetString("stat_value", value); |
130 stat_->SetBoolean("is_valid", true); | 150 stat_->SetBoolean("is_valid", true); |
131 } | 151 } |
132 | 152 |
133 class BoolSyncStat { | 153 class BoolSyncStat { |
134 public: | 154 public: |
135 BoolSyncStat(base::ListValue* section, const std::string& key); | 155 BoolSyncStat(base::ListValue* section, const std::string& key); |
136 void SetValue(bool value); | 156 void SetValue(bool value); |
137 | 157 |
138 private: | 158 private: |
139 // Owned by the |section| passed in during construction. | 159 // Owned by the |section| passed in during construction. |
140 base::DictionaryValue* stat_; | 160 base::DictionaryValue* stat_; |
141 }; | 161 }; |
142 | 162 |
143 BoolSyncStat::BoolSyncStat(base::ListValue* section, const std::string& key) { | 163 BoolSyncStat::BoolSyncStat(base::ListValue* section, const std::string& key) { |
144 stat_ = new base::DictionaryValue(); | 164 stat_ = new base::DictionaryValue(); |
145 stat_->SetString("stat_name", key); | 165 stat_->SetString("stat_name", key); |
146 stat_->SetBoolean("stat_value", false); | 166 stat_->SetBoolean("stat_value", false); |
147 stat_->SetBoolean("is_valid", false); | 167 stat_->SetBoolean("is_valid", false); |
| 168 // |stat_| will be invalidated by |Append|, so it needs to be reset. |
| 169 // Furthermore, if |Append| results in a reallocation, |stat_| members of |
| 170 // other SyncStats will be invalidated. This is why the following check is |
| 171 // necessary, so that it is guaranteed that a reallocation will not happen. |
| 172 // TODO(crbug.com/702230): Remove the usages of raw pointers in this file. |
| 173 CHECK_LT(section->GetSize(), section->capacity()); |
148 section->Append(base::WrapUnique(stat_)); | 174 section->Append(base::WrapUnique(stat_)); |
| 175 section->GetDictionary(section->GetSize() - 1, &stat_); |
149 } | 176 } |
150 | 177 |
151 void BoolSyncStat::SetValue(bool value) { | 178 void BoolSyncStat::SetValue(bool value) { |
152 stat_->SetBoolean("stat_value", value); | 179 stat_->SetBoolean("stat_value", value); |
153 stat_->SetBoolean("is_valid", true); | 180 stat_->SetBoolean("is_valid", true); |
154 } | 181 } |
155 | 182 |
156 class IntSyncStat { | 183 class IntSyncStat { |
157 public: | 184 public: |
158 IntSyncStat(base::ListValue* section, const std::string& key); | 185 IntSyncStat(base::ListValue* section, const std::string& key); |
159 void SetValue(int value); | 186 void SetValue(int value); |
160 | 187 |
161 private: | 188 private: |
162 // Owned by the |section| passed in during construction. | 189 // Owned by the |section| passed in during construction. |
163 base::DictionaryValue* stat_; | 190 base::DictionaryValue* stat_; |
164 }; | 191 }; |
165 | 192 |
166 IntSyncStat::IntSyncStat(base::ListValue* section, const std::string& key) { | 193 IntSyncStat::IntSyncStat(base::ListValue* section, const std::string& key) { |
167 stat_ = new base::DictionaryValue(); | 194 stat_ = new base::DictionaryValue(); |
168 stat_->SetString("stat_name", key); | 195 stat_->SetString("stat_name", key); |
169 stat_->SetInteger("stat_value", 0); | 196 stat_->SetInteger("stat_value", 0); |
170 stat_->SetBoolean("is_valid", false); | 197 stat_->SetBoolean("is_valid", false); |
| 198 // |stat_| will be invalidated by |Append|, so it needs to be reset. |
| 199 // Furthermore, if |Append| results in a reallocation, |stat_| members of |
| 200 // other SyncStats will be invalidated. This is why the following check is |
| 201 // necessary, so that it is guaranteed that a reallocation will not happen. |
| 202 // TODO(crbug.com/702230): Remove the usages of raw pointers in this file. |
| 203 CHECK_LT(section->GetSize(), section->capacity()); |
171 section->Append(base::WrapUnique(stat_)); | 204 section->Append(base::WrapUnique(stat_)); |
| 205 section->GetDictionary(section->GetSize() - 1, &stat_); |
172 } | 206 } |
173 | 207 |
174 void IntSyncStat::SetValue(int value) { | 208 void IntSyncStat::SetValue(int value) { |
175 stat_->SetInteger("stat_value", value); | 209 stat_->SetInteger("stat_value", value); |
176 stat_->SetBoolean("is_valid", true); | 210 stat_->SetBoolean("is_valid", true); |
177 } | 211 } |
178 | 212 |
179 // Returns a string describing the chrome version environment. Version format: | 213 // Returns a string describing the chrome version environment. Version format: |
180 // <Build Info> <OS> <Version number> (<Last change>)<channel or "-devel"> | 214 // <Build Info> <OS> <Version number> (<Last change>)<channel or "-devel"> |
181 // If version information is unavailable, returns "invalid." | 215 // If version information is unavailable, returns "invalid." |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 // classes defined above. | 278 // classes defined above. |
245 std::unique_ptr<base::DictionaryValue> ConstructAboutInformation( | 279 std::unique_ptr<base::DictionaryValue> ConstructAboutInformation( |
246 SyncService* service, | 280 SyncService* service, |
247 SigninManagerBase* signin, | 281 SigninManagerBase* signin, |
248 version_info::Channel channel) { | 282 version_info::Channel channel) { |
249 std::unique_ptr<base::DictionaryValue> about_info( | 283 std::unique_ptr<base::DictionaryValue> about_info( |
250 new base::DictionaryValue()); | 284 new base::DictionaryValue()); |
251 | 285 |
252 // 'details': A list of sections. | 286 // 'details': A list of sections. |
253 base::ListValue* stats_list = new base::ListValue(); | 287 base::ListValue* stats_list = new base::ListValue(); |
| 288 // TODO(crbug.com/702230): Remove the usages of raw pointers in this file. |
| 289 stats_list->Reserve(12); |
254 | 290 |
255 // The following lines define the sections and their fields. For each field, | 291 // The following lines define the sections and their fields. For each field, |
256 // a class is instantiated, which allows us to reference the fields in | 292 // a class is instantiated, which allows us to reference the fields in |
257 // 'setter' code later on in this function. | 293 // 'setter' code later on in this function. |
258 base::ListValue* section_summary = AddSection(stats_list, "Summary"); | 294 base::ListValue* section_summary = AddSection(stats_list, "Summary"); |
| 295 // TODO(crbug.com/702230): Remove the usages of raw pointers in this file. |
| 296 section_summary->Reserve(1); |
259 StringSyncStat summary_string(section_summary, "Summary"); | 297 StringSyncStat summary_string(section_summary, "Summary"); |
260 | 298 |
261 base::ListValue* section_version = AddSection(stats_list, "Version Info"); | 299 base::ListValue* section_version = AddSection(stats_list, "Version Info"); |
| 300 // TODO(crbug.com/702230): Remove the usages of raw pointers in this file. |
| 301 section_version->Reserve(2); |
262 StringSyncStat client_version(section_version, "Client Version"); | 302 StringSyncStat client_version(section_version, "Client Version"); |
263 StringSyncStat server_url(section_version, "Server URL"); | 303 StringSyncStat server_url(section_version, "Server URL"); |
264 | 304 |
265 base::ListValue* section_identity = | 305 base::ListValue* section_identity = |
266 AddSensitiveSection(stats_list, kIdentityTitle); | 306 AddSensitiveSection(stats_list, kIdentityTitle); |
| 307 // TODO(crbug.com/702230): Remove the usages of raw pointers in this file. |
| 308 section_identity->Reserve(3); |
267 StringSyncStat sync_id(section_identity, "Sync Client ID"); | 309 StringSyncStat sync_id(section_identity, "Sync Client ID"); |
268 StringSyncStat invalidator_id(section_identity, "Invalidator Client ID"); | 310 StringSyncStat invalidator_id(section_identity, "Invalidator Client ID"); |
269 StringSyncStat username(section_identity, "Username"); | 311 StringSyncStat username(section_identity, "Username"); |
270 | 312 |
271 base::ListValue* section_credentials = AddSection(stats_list, "Credentials"); | 313 base::ListValue* section_credentials = AddSection(stats_list, "Credentials"); |
| 314 // TODO(crbug.com/702230): Remove the usages of raw pointers in this file. |
| 315 section_credentials->Reserve(4); |
272 StringSyncStat request_token_time(section_credentials, "Requested Token"); | 316 StringSyncStat request_token_time(section_credentials, "Requested Token"); |
273 StringSyncStat receive_token_time(section_credentials, "Received Token"); | 317 StringSyncStat receive_token_time(section_credentials, "Received Token"); |
274 StringSyncStat token_request_status(section_credentials, | 318 StringSyncStat token_request_status(section_credentials, |
275 "Token Request Status"); | 319 "Token Request Status"); |
276 StringSyncStat next_token_request(section_credentials, "Next Token Request"); | 320 StringSyncStat next_token_request(section_credentials, "Next Token Request"); |
277 | 321 |
278 base::ListValue* section_local = AddSection(stats_list, "Local State"); | 322 base::ListValue* section_local = AddSection(stats_list, "Local State"); |
| 323 // TODO(crbug.com/702230): Remove the usages of raw pointers in this file. |
| 324 section_local->Reserve(7); |
279 StringSyncStat server_connection(section_local, "Server Connection"); | 325 StringSyncStat server_connection(section_local, "Server Connection"); |
280 StringSyncStat last_synced(section_local, "Last Synced"); | 326 StringSyncStat last_synced(section_local, "Last Synced"); |
281 BoolSyncStat is_setup_complete(section_local, | 327 BoolSyncStat is_setup_complete(section_local, |
282 "Sync First-Time Setup Complete"); | 328 "Sync First-Time Setup Complete"); |
283 StringSyncStat backend_initialization(section_local, | 329 StringSyncStat backend_initialization(section_local, |
284 "Sync Backend Initialization"); | 330 "Sync Backend Initialization"); |
285 BoolSyncStat is_syncing(section_local, "Syncing"); | 331 BoolSyncStat is_syncing(section_local, "Syncing"); |
286 BoolSyncStat is_local_sync_enabled(section_local, | 332 BoolSyncStat is_local_sync_enabled(section_local, |
287 "Local sync backend enabled"); | 333 "Local sync backend enabled"); |
288 StringSyncStat local_backend_path(section_local, "Local backend path"); | 334 StringSyncStat local_backend_path(section_local, "Local backend path"); |
289 | 335 |
290 base::ListValue* section_network = AddSection(stats_list, "Network"); | 336 base::ListValue* section_network = AddSection(stats_list, "Network"); |
| 337 // TODO(crbug.com/702230): Remove the usages of raw pointers in this file. |
| 338 section_network->Reserve(3); |
291 BoolSyncStat is_throttled(section_network, "Throttled"); | 339 BoolSyncStat is_throttled(section_network, "Throttled"); |
292 StringSyncStat retry_time(section_network, "Retry time (maybe stale)"); | 340 StringSyncStat retry_time(section_network, "Retry time (maybe stale)"); |
293 BoolSyncStat are_notifications_enabled(section_network, | 341 BoolSyncStat are_notifications_enabled(section_network, |
294 "Notifications Enabled"); | 342 "Notifications Enabled"); |
295 | 343 |
296 base::ListValue* section_encryption = AddSection(stats_list, "Encryption"); | 344 base::ListValue* section_encryption = AddSection(stats_list, "Encryption"); |
| 345 // TODO(crbug.com/702230): Remove the usages of raw pointers in this file. |
| 346 section_encryption->Reserve(9); |
297 BoolSyncStat is_using_explicit_passphrase(section_encryption, | 347 BoolSyncStat is_using_explicit_passphrase(section_encryption, |
298 "Explicit Passphrase"); | 348 "Explicit Passphrase"); |
299 BoolSyncStat is_passphrase_required(section_encryption, | 349 BoolSyncStat is_passphrase_required(section_encryption, |
300 "Passphrase Required"); | 350 "Passphrase Required"); |
301 BoolSyncStat is_cryptographer_ready(section_encryption, | 351 BoolSyncStat is_cryptographer_ready(section_encryption, |
302 "Cryptographer Ready"); | 352 "Cryptographer Ready"); |
303 BoolSyncStat has_pending_keys(section_encryption, | 353 BoolSyncStat has_pending_keys(section_encryption, |
304 "Cryptographer Has Pending Keys"); | 354 "Cryptographer Has Pending Keys"); |
305 StringSyncStat encrypted_types(section_encryption, "Encrypted Types"); | 355 StringSyncStat encrypted_types(section_encryption, "Encrypted Types"); |
306 BoolSyncStat has_keystore_key(section_encryption, "Has Keystore Key"); | 356 BoolSyncStat has_keystore_key(section_encryption, "Has Keystore Key"); |
307 StringSyncStat keystore_migration_time(section_encryption, | 357 StringSyncStat keystore_migration_time(section_encryption, |
308 "Keystore Migration Time"); | 358 "Keystore Migration Time"); |
309 StringSyncStat passphrase_type(section_encryption, "Passphrase Type"); | 359 StringSyncStat passphrase_type(section_encryption, "Passphrase Type"); |
310 StringSyncStat passphrase_time(section_encryption, "Passphrase Time"); | 360 StringSyncStat passphrase_time(section_encryption, "Passphrase Time"); |
311 | 361 |
312 base::ListValue* section_last_session = | 362 base::ListValue* section_last_session = |
313 AddSection(stats_list, "Status from Last Completed Session"); | 363 AddSection(stats_list, "Status from Last Completed Session"); |
| 364 // TODO(crbug.com/702230): Remove the usages of raw pointers in this file. |
| 365 section_last_session->Reserve(4); |
314 StringSyncStat session_source(section_last_session, "Sync Source"); | 366 StringSyncStat session_source(section_last_session, "Sync Source"); |
315 StringSyncStat get_key_result(section_last_session, "GetKey Step Result"); | 367 StringSyncStat get_key_result(section_last_session, "GetKey Step Result"); |
316 StringSyncStat download_result(section_last_session, "Download Step Result"); | 368 StringSyncStat download_result(section_last_session, "Download Step Result"); |
317 StringSyncStat commit_result(section_last_session, "Commit Step Result"); | 369 StringSyncStat commit_result(section_last_session, "Commit Step Result"); |
318 | 370 |
319 base::ListValue* section_counters = AddSection(stats_list, "Running Totals"); | 371 base::ListValue* section_counters = AddSection(stats_list, "Running Totals"); |
| 372 // TODO(crbug.com/702230): Remove the usages of raw pointers in this file. |
| 373 section_counters->Reserve(7); |
320 IntSyncStat notifications_received(section_counters, | 374 IntSyncStat notifications_received(section_counters, |
321 "Notifications Received"); | 375 "Notifications Received"); |
322 IntSyncStat updates_received(section_counters, "Updates Downloaded"); | 376 IntSyncStat updates_received(section_counters, "Updates Downloaded"); |
323 IntSyncStat tombstone_updates(section_counters, "Tombstone Updates"); | 377 IntSyncStat tombstone_updates(section_counters, "Tombstone Updates"); |
324 IntSyncStat reflected_updates(section_counters, "Reflected Updates"); | 378 IntSyncStat reflected_updates(section_counters, "Reflected Updates"); |
325 IntSyncStat successful_commits(section_counters, "Successful Commits"); | 379 IntSyncStat successful_commits(section_counters, "Successful Commits"); |
326 IntSyncStat conflicts_resolved_local_wins(section_counters, | 380 IntSyncStat conflicts_resolved_local_wins(section_counters, |
327 "Conflicts Resolved: Client Wins"); | 381 "Conflicts Resolved: Client Wins"); |
328 IntSyncStat conflicts_resolved_server_wins(section_counters, | 382 IntSyncStat conflicts_resolved_server_wins(section_counters, |
329 "Conflicts Resolved: Server Wins"); | 383 "Conflicts Resolved: Server Wins"); |
330 | 384 |
331 base::ListValue* section_this_cycle = | 385 base::ListValue* section_this_cycle = |
332 AddSection(stats_list, "Transient Counters (this cycle)"); | 386 AddSection(stats_list, "Transient Counters (this cycle)"); |
| 387 // TODO(crbug.com/702230): Remove the usages of raw pointers in this file. |
| 388 section_this_cycle->Reserve(4); |
333 IntSyncStat encryption_conflicts(section_this_cycle, "Encryption Conflicts"); | 389 IntSyncStat encryption_conflicts(section_this_cycle, "Encryption Conflicts"); |
334 IntSyncStat hierarchy_conflicts(section_this_cycle, "Hierarchy Conflicts"); | 390 IntSyncStat hierarchy_conflicts(section_this_cycle, "Hierarchy Conflicts"); |
335 IntSyncStat server_conflicts(section_this_cycle, "Server Conflicts"); | 391 IntSyncStat server_conflicts(section_this_cycle, "Server Conflicts"); |
336 IntSyncStat committed_items(section_this_cycle, "Committed Items"); | 392 IntSyncStat committed_items(section_this_cycle, "Committed Items"); |
337 | 393 |
338 base::ListValue* section_that_cycle = AddSection( | 394 base::ListValue* section_that_cycle = AddSection( |
339 stats_list, "Transient Counters (last cycle of last completed session)"); | 395 stats_list, "Transient Counters (last cycle of last completed session)"); |
| 396 // TODO(crbug.com/702230): Remove the usages of raw pointers in this file. |
| 397 section_that_cycle->Reserve(3); |
340 IntSyncStat updates_downloaded(section_that_cycle, "Updates Downloaded"); | 398 IntSyncStat updates_downloaded(section_that_cycle, "Updates Downloaded"); |
341 IntSyncStat committed_count(section_that_cycle, "Committed Count"); | 399 IntSyncStat committed_count(section_that_cycle, "Committed Count"); |
342 IntSyncStat entries(section_that_cycle, "Entries"); | 400 IntSyncStat entries(section_that_cycle, "Entries"); |
343 | 401 |
344 base::ListValue* section_nudge_info = | 402 base::ListValue* section_nudge_info = |
345 AddSection(stats_list, "Nudge Source Counters"); | 403 AddSection(stats_list, "Nudge Source Counters"); |
| 404 // TODO(crbug.com/702230): Remove the usages of raw pointers in this file. |
| 405 section_nudge_info->Reserve(3); |
346 IntSyncStat nudge_source_notification(section_nudge_info, | 406 IntSyncStat nudge_source_notification(section_nudge_info, |
347 "Server Invalidations"); | 407 "Server Invalidations"); |
348 IntSyncStat nudge_source_local(section_nudge_info, "Local Changes"); | 408 IntSyncStat nudge_source_local(section_nudge_info, "Local Changes"); |
349 IntSyncStat nudge_source_local_refresh(section_nudge_info, "Local Refreshes"); | 409 IntSyncStat nudge_source_local_refresh(section_nudge_info, "Local Refreshes"); |
350 | 410 |
351 // This list of sections belongs in the 'details' field of the returned | 411 // This list of sections belongs in the 'details' field of the returned |
352 // message. | 412 // message. |
353 about_info->Set(kDetailsKey, stats_list); | 413 about_info->Set(kDetailsKey, stats_list); |
354 | 414 |
355 // Populate all the fields we declared above. | 415 // Populate all the fields we declared above. |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
484 full_status.sync_protocol_error.error_type != UNKNOWN_ERROR && | 544 full_status.sync_protocol_error.error_type != UNKNOWN_ERROR && |
485 full_status.sync_protocol_error.error_type != SYNC_SUCCESS; | 545 full_status.sync_protocol_error.error_type != SYNC_SUCCESS; |
486 | 546 |
487 about_info->SetBoolean("actionable_error_detected", | 547 about_info->SetBoolean("actionable_error_detected", |
488 actionable_error_detected); | 548 actionable_error_detected); |
489 | 549 |
490 // NOTE: We won't bother showing any of the following values unless | 550 // NOTE: We won't bother showing any of the following values unless |
491 // actionable_error_detected is set. | 551 // actionable_error_detected is set. |
492 | 552 |
493 base::ListValue* actionable_error = new base::ListValue(); | 553 base::ListValue* actionable_error = new base::ListValue(); |
| 554 // TODO(crbug.com/702230): Remove the usages of raw pointers in this file. |
| 555 actionable_error->Reserve(4); |
494 about_info->Set("actionable_error", actionable_error); | 556 about_info->Set("actionable_error", actionable_error); |
495 | 557 |
496 StringSyncStat error_type(actionable_error, "Error Type"); | 558 StringSyncStat error_type(actionable_error, "Error Type"); |
497 StringSyncStat action(actionable_error, "Action"); | 559 StringSyncStat action(actionable_error, "Action"); |
498 StringSyncStat url(actionable_error, "URL"); | 560 StringSyncStat url(actionable_error, "URL"); |
499 StringSyncStat description(actionable_error, "Error Description"); | 561 StringSyncStat description(actionable_error, "Error Description"); |
500 | 562 |
501 if (actionable_error_detected) { | 563 if (actionable_error_detected) { |
502 error_type.SetValue( | 564 error_type.SetValue( |
503 GetSyncErrorTypeString(full_status.sync_protocol_error.error_type)); | 565 GetSyncErrorTypeString(full_status.sync_protocol_error.error_type)); |
(...skipping 18 matching lines...) Expand all Loading... |
522 } | 584 } |
523 | 585 |
524 about_info->Set("type_status", service->GetTypeStatusMap()); | 586 about_info->Set("type_status", service->GetTypeStatusMap()); |
525 | 587 |
526 return about_info; | 588 return about_info; |
527 } | 589 } |
528 | 590 |
529 } // namespace sync_ui_util | 591 } // namespace sync_ui_util |
530 | 592 |
531 } // namespace syncer | 593 } // namespace syncer |
OLD | NEW |