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

Side by Side Diff: ios/chrome/browser/sync/sync_setup_service.cc

Issue 1582183004: [Sync] Only pass user-selectable types to OnUserChoseDataTypes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Intersect with UserSelectableTypes before passing into OnUserChoseDatatypes Created 4 years, 11 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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 "ios/chrome/browser/sync/sync_setup_service.h" 5 #include "ios/chrome/browser/sync/sync_setup_service.h"
6 6
7 #include <stdio.h> 7 #include <stdio.h>
8 8
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/metrics/histogram_macros.h" 10 #include "base/metrics/histogram_macros.h"
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 96
97 bool SyncSetupService::IsSyncingAllDataTypes() const { 97 bool SyncSetupService::IsSyncingAllDataTypes() const {
98 sync_driver::SyncPrefs sync_prefs(prefs_); 98 sync_driver::SyncPrefs sync_prefs(prefs_);
99 return sync_prefs.HasKeepEverythingSynced(); 99 return sync_prefs.HasKeepEverythingSynced();
100 } 100 }
101 101
102 void SyncSetupService::SetSyncingAllDataTypes(bool sync_all) { 102 void SyncSetupService::SetSyncingAllDataTypes(bool sync_all) {
103 sync_service_->SetSetupInProgress(true); 103 sync_service_->SetSetupInProgress(true);
104 if (sync_all && !IsSyncEnabled()) 104 if (sync_all && !IsSyncEnabled())
105 SetSyncEnabled(true); 105 SetSyncEnabled(true);
106 sync_service_->OnUserChoseDatatypes(sync_all, GetDataTypes()); 106 sync_service_->OnUserChoseDatatypes(
107 sync_all, Intersection(GetDataTypes(), syncer::UserSelectableTypes()));
107 } 108 }
108 109
109 bool SyncSetupService::IsSyncEnabled() const { 110 bool SyncSetupService::IsSyncEnabled() const {
110 return sync_service_->CanSyncStart(); 111 return sync_service_->CanSyncStart();
111 } 112 }
112 113
113 void SyncSetupService::SetSyncEnabled(bool sync_enabled) { 114 void SyncSetupService::SetSyncEnabled(bool sync_enabled) {
114 SetSyncEnabledWithoutChangingDatatypes(sync_enabled); 115 SetSyncEnabledWithoutChangingDatatypes(sync_enabled);
115 if (sync_enabled && GetDataTypes().Empty()) 116 if (sync_enabled && GetDataTypes().Empty())
116 SetSyncingAllDataTypes(true); 117 SetSyncingAllDataTypes(true);
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 bool sync_enabled) { 194 bool sync_enabled) {
194 sync_service_->SetSetupInProgress(true); 195 sync_service_->SetSetupInProgress(true);
195 if (sync_enabled) { 196 if (sync_enabled) {
196 sync_service_->RequestStart(); 197 sync_service_->RequestStart();
197 } else { 198 } else {
198 UMA_HISTOGRAM_ENUMERATION("Sync.StopSource", syncer::CHROME_SYNC_SETTINGS, 199 UMA_HISTOGRAM_ENUMERATION("Sync.StopSource", syncer::CHROME_SYNC_SETTINGS,
199 syncer::STOP_SOURCE_LIMIT); 200 syncer::STOP_SOURCE_LIMIT);
200 sync_service_->RequestStop(sync_driver::SyncService::KEEP_DATA); 201 sync_service_->RequestStop(sync_driver::SyncService::KEEP_DATA);
201 } 202 }
202 } 203 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698