| 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" |
| (...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 271 } | 271 } |
| 272 | 272 |
| 273 } // namespace | 273 } // namespace |
| 274 | 274 |
| 275 // This function both defines the structure of the message to be returned and | 275 // This function both defines the structure of the message to be returned and |
| 276 // its contents. Most of the message consists of simple fields in about:sync | 276 // its contents. Most of the message consists of simple fields in about:sync |
| 277 // which are grouped into sections and populated with the help of the SyncStat | 277 // which are grouped into sections and populated with the help of the SyncStat |
| 278 // classes defined above. | 278 // classes defined above. |
| 279 std::unique_ptr<base::DictionaryValue> ConstructAboutInformation( | 279 std::unique_ptr<base::DictionaryValue> ConstructAboutInformation( |
| 280 SyncService* service, | 280 SyncService* service, |
| 281 SigninManagerBase* signin, | |
| 282 version_info::Channel channel) { | 281 version_info::Channel channel) { |
| 283 std::unique_ptr<base::DictionaryValue> about_info( | 282 std::unique_ptr<base::DictionaryValue> about_info( |
| 284 new base::DictionaryValue()); | 283 new base::DictionaryValue()); |
| 285 | 284 |
| 286 // 'details': A list of sections. | 285 // 'details': A list of sections. |
| 287 base::ListValue* stats_list = new base::ListValue(); | 286 base::ListValue* stats_list = new base::ListValue(); |
| 288 // TODO(crbug.com/702230): Remove the usages of raw pointers in this file. | 287 // TODO(crbug.com/702230): Remove the usages of raw pointers in this file. |
| 289 stats_list->Reserve(12); | 288 stats_list->Reserve(12); |
| 290 | 289 |
| 291 // The following lines define the sections and their fields. For each field, | 290 // The following lines define the sections and their fields. For each field, |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 427 | 426 |
| 428 if (is_status_valid) | 427 if (is_status_valid) |
| 429 summary_string.SetValue(service->QuerySyncStatusSummaryString()); | 428 summary_string.SetValue(service->QuerySyncStatusSummaryString()); |
| 430 | 429 |
| 431 server_url.SetValue(service->sync_service_url().spec()); | 430 server_url.SetValue(service->sync_service_url().spec()); |
| 432 | 431 |
| 433 if (is_status_valid && !full_status.sync_id.empty()) | 432 if (is_status_valid && !full_status.sync_id.empty()) |
| 434 sync_id.SetValue(full_status.sync_id); | 433 sync_id.SetValue(full_status.sync_id); |
| 435 if (is_status_valid && !full_status.invalidator_client_id.empty()) | 434 if (is_status_valid && !full_status.invalidator_client_id.empty()) |
| 436 invalidator_id.SetValue(full_status.invalidator_client_id); | 435 invalidator_id.SetValue(full_status.invalidator_client_id); |
| 437 if (signin) | 436 if (service->signin()) |
| 438 username.SetValue(signin->GetAuthenticatedAccountInfo().email); | 437 username.SetValue(service->signin()->GetAuthenticatedAccountInfo().email); |
| 439 | 438 |
| 440 const SyncService::SyncTokenStatus& token_status = | 439 const SyncService::SyncTokenStatus& token_status = |
| 441 service->GetSyncTokenStatus(); | 440 service->GetSyncTokenStatus(); |
| 442 server_connection.SetValue(GetConnectionStatus(token_status)); | 441 server_connection.SetValue(GetConnectionStatus(token_status)); |
| 443 request_token_time.SetValue( | 442 request_token_time.SetValue( |
| 444 GetTimeStr(token_status.token_request_time, "n/a")); | 443 GetTimeStr(token_status.token_request_time, "n/a")); |
| 445 receive_token_time.SetValue( | 444 receive_token_time.SetValue( |
| 446 GetTimeStr(token_status.token_receive_time, "n/a")); | 445 GetTimeStr(token_status.token_receive_time, "n/a")); |
| 447 std::string err = token_status.last_get_token_error.error_message(); | 446 std::string err = token_status.last_get_token_error.error_message(); |
| 448 token_request_status.SetValue(err.empty() ? "OK" : err); | 447 token_request_status.SetValue(err.empty() ? "OK" : err); |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 584 } | 583 } |
| 585 | 584 |
| 586 about_info->Set("type_status", service->GetTypeStatusMap()); | 585 about_info->Set("type_status", service->GetTypeStatusMap()); |
| 587 | 586 |
| 588 return about_info; | 587 return about_info; |
| 589 } | 588 } |
| 590 | 589 |
| 591 } // namespace sync_ui_util | 590 } // namespace sync_ui_util |
| 592 | 591 |
| 593 } // namespace syncer | 592 } // namespace syncer |
| OLD | NEW |