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

Side by Side Diff: components/browser_sync/profile_sync_service.cc

Issue 2374913002: [USS] Show USS counters in about:sync page (Closed)
Patch Set: remove unique_ptr and rebase Created 4 years, 2 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 (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/browser_sync/profile_sync_service.h" 5 #include "components/browser_sync/profile_sync_service.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <cstddef> 9 #include <cstddef>
10 #include <map> 10 #include <map>
(...skipping 525 matching lines...) Expand 10 before | Expand all | Expand 10 after
536 OnCommitCountersUpdated(type, counters)); 536 OnCommitCountersUpdated(type, counters));
537 } 537 }
538 538
539 void ProfileSyncService::OnDirectoryTypeUpdateCounterUpdated( 539 void ProfileSyncService::OnDirectoryTypeUpdateCounterUpdated(
540 syncer::ModelType type, 540 syncer::ModelType type,
541 const syncer::UpdateCounters& counters) { 541 const syncer::UpdateCounters& counters) {
542 FOR_EACH_OBSERVER(syncer::TypeDebugInfoObserver, type_debug_info_observers_, 542 FOR_EACH_OBSERVER(syncer::TypeDebugInfoObserver, type_debug_info_observers_,
543 OnUpdateCountersUpdated(type, counters)); 543 OnUpdateCountersUpdated(type, counters));
544 } 544 }
545 545
546 void ProfileSyncService::OnDirectoryTypeStatusCounterUpdated( 546 void ProfileSyncService::OnDatatypeStatusCounterUpdated(
547 syncer::ModelType type, 547 syncer::ModelType type,
548 const syncer::StatusCounters& counters) { 548 const syncer::StatusCounters& counters) {
549 FOR_EACH_OBSERVER(syncer::TypeDebugInfoObserver, type_debug_info_observers_, 549 FOR_EACH_OBSERVER(syncer::TypeDebugInfoObserver, type_debug_info_observers_,
550 OnStatusCountersUpdated(type, counters)); 550 OnStatusCountersUpdated(type, counters));
551 } 551 }
552 552
553 void ProfileSyncService::OnDataTypeRequestsSyncStartup(syncer::ModelType type) { 553 void ProfileSyncService::OnDataTypeRequestsSyncStartup(syncer::ModelType type) {
554 DCHECK(syncer::UserTypes().Has(type)); 554 DCHECK(syncer::UserTypes().Has(type));
555 555
556 if (!GetPreferredDataTypes().Has(type)) { 556 if (!GetPreferredDataTypes().Has(type)) {
(...skipping 1243 matching lines...) Expand 10 before | Expand all | Expand 10 after
1800 1800
1801 void ProfileSyncService::GetModelSafeRoutingInfo( 1801 void ProfileSyncService::GetModelSafeRoutingInfo(
1802 syncer::ModelSafeRoutingInfo* out) const { 1802 syncer::ModelSafeRoutingInfo* out) const {
1803 if (backend_.get() && backend_initialized_) { 1803 if (backend_.get() && backend_initialized_) {
1804 backend_->GetModelSafeRoutingInfo(out); 1804 backend_->GetModelSafeRoutingInfo(out);
1805 } else { 1805 } else {
1806 NOTREACHED(); 1806 NOTREACHED();
1807 } 1807 }
1808 } 1808 }
1809 1809
1810 base::Value* ProfileSyncService::GetTypeStatusMap() const { 1810 base::Value* ProfileSyncService::GetTypeStatusMap() {
1811 std::unique_ptr<base::ListValue> result(new base::ListValue()); 1811 std::unique_ptr<base::ListValue> result(new base::ListValue());
1812 1812
1813 if (!backend_.get() || !backend_initialized_) { 1813 if (!backend_.get() || !backend_initialized_) {
1814 return result.release(); 1814 return result.release();
1815 } 1815 }
1816 1816
1817 DataTypeStatusTable::TypeErrorMap error_map = 1817 DataTypeStatusTable::TypeErrorMap error_map =
1818 data_type_status_table_.GetAllErrors(); 1818 data_type_status_table_.GetAllErrors();
1819 ModelTypeSet active_types; 1819 ModelTypeSet active_types;
1820 ModelTypeSet passive_types; 1820 ModelTypeSet passive_types;
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
1883 type_status->SetString("value", "Throttled"); 1883 type_status->SetString("value", "Throttled");
1884 } else if (active_types.Has(type)) { 1884 } else if (active_types.Has(type)) {
1885 type_status->SetString("status", "ok"); 1885 type_status->SetString("status", "ok");
1886 type_status->SetString( 1886 type_status->SetString(
1887 "value", "Active: " + ModelSafeGroupToString(routing_info[type])); 1887 "value", "Active: " + ModelSafeGroupToString(routing_info[type]));
1888 } else { 1888 } else {
1889 type_status->SetString("status", "warning"); 1889 type_status->SetString("status", "warning");
1890 type_status->SetString("value", "Disabled by User"); 1890 type_status->SetString("value", "Disabled by User");
1891 } 1891 }
1892 1892
1893 int live_count = detailed_status.num_entries_by_type[type] - 1893 const auto& dtc_iter = data_type_controllers_.find(type);
1894 detailed_status.num_to_delete_entries_by_type[type]; 1894 if (dtc_iter != data_type_controllers_.end()) {
1895 type_status->SetInteger("num_entries", 1895 dtc_iter->second->GetStatusCounters(
1896 detailed_status.num_entries_by_type[type]); 1896 base::Bind(&ProfileSyncService::OnDatatypeStatusCounterUpdated,
maxbogue 2016/10/04 00:02:00 If this Bind call were wrapped with syncer::BindTo
Gang Wu 2016/10/06 00:20:22 Done.
1897 type_status->SetInteger("num_live", live_count); 1897 base::Unretained(this)));
1898 }
1898 1899
1899 result->Append(std::move(type_status)); 1900 result->Append(std::move(type_status));
1900 } 1901 }
1901 return result.release(); 1902 return result.release();
1902 } 1903 }
1903 1904
1904 void ProfileSyncService::ConsumeCachedPassphraseIfPossible() { 1905 void ProfileSyncService::ConsumeCachedPassphraseIfPossible() {
1905 // If no cached passphrase, or sync backend hasn't started up yet, just exit. 1906 // If no cached passphrase, or sync backend hasn't started up yet, just exit.
1906 // If the backend isn't running yet, OnBackendInitialized() will call this 1907 // If the backend isn't running yet, OnBackendInitialized() will call this
1907 // method again after the backend starts up. 1908 // method again after the backend starts up.
(...skipping 583 matching lines...) Expand 10 before | Expand all | Expand 10 after
2491 2492
2492 DCHECK(startup_controller_->IsSetupInProgress()); 2493 DCHECK(startup_controller_->IsSetupInProgress());
2493 startup_controller_->SetSetupInProgress(false); 2494 startup_controller_->SetSetupInProgress(false);
2494 2495
2495 if (IsBackendInitialized()) 2496 if (IsBackendInitialized())
2496 ReconfigureDatatypeManager(); 2497 ReconfigureDatatypeManager();
2497 NotifyObservers(); 2498 NotifyObservers();
2498 } 2499 }
2499 2500
2500 } // namespace browser_sync 2501 } // namespace browser_sync
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698