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

Side by Side Diff: components/browser_sync/browser/profile_sync_service.h

Issue 2044303004: Sync: Support multiple setup UIs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix android Created 4 years, 6 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 #ifndef COMPONENTS_BROWSER_SYNC_BROWSER_PROFILE_SYNC_SERVICE_H_ 5 #ifndef COMPONENTS_BROWSER_SYNC_BROWSER_PROFILE_SYNC_SERVICE_H_
6 #define COMPONENTS_BROWSER_SYNC_BROWSER_PROFILE_SYNC_SERVICE_H_ 6 #define COMPONENTS_BROWSER_SYNC_BROWSER_PROFILE_SYNC_SERVICE_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 // The "sync everything" state cannot be read from ProfileSyncService, but 158 // The "sync everything" state cannot be read from ProfileSyncService, but
159 // is instead pulled from SyncPrefs.HasKeepEverythingSynced(). 159 // is instead pulled from SyncPrefs.HasKeepEverythingSynced().
160 // 160 //
161 // Initial sync setup: 161 // Initial sync setup:
162 // 162 //
163 // For privacy reasons, it is usually desirable to avoid syncing any data 163 // For privacy reasons, it is usually desirable to avoid syncing any data
164 // types until the user has finished setting up sync. There are two APIs 164 // types until the user has finished setting up sync. There are two APIs
165 // that control the initial sync download: 165 // that control the initial sync download:
166 // 166 //
167 // * SetFirstSetupComplete() 167 // * SetFirstSetupComplete()
168 // * SetSetupInProgress() 168 // * GetSetupInProgressHandle()
169 // 169 //
170 // SetFirstSetupComplete() should be called once the user has finished setting 170 // SetFirstSetupComplete() should be called once the user has finished setting
171 // up sync at least once on their account. SetSetupInProgress(true) should be 171 // up sync at least once on their account. GetSetupInProgressHandle() should
172 // called while the user is actively configuring their account, and then 172 // be called while the user is actively configuring their account. The handle
173 // SetSetupInProgress(false) should be called when configuration is complete. 173 // should be deleted once configuration is complete.
174 // Once both these conditions have been met, CanConfigureDataTypes() will 174 //
175 // return true and datatype configuration can begin. 175 // Once first setup has completed and there are no outstanding
176 // setup-in-progress handles, CanConfigureDataTypes() will return true and
177 // datatype configuration can begin.
176 class ProfileSyncService : public sync_driver::SyncService, 178 class ProfileSyncService : public sync_driver::SyncService,
177 public sync_driver::SyncFrontend, 179 public sync_driver::SyncFrontend,
178 public sync_driver::SyncPrefObserver, 180 public sync_driver::SyncPrefObserver,
179 public sync_driver::DataTypeManagerObserver, 181 public sync_driver::DataTypeManagerObserver,
180 public syncer::UnrecoverableErrorHandler, 182 public syncer::UnrecoverableErrorHandler,
181 public KeyedService, 183 public KeyedService,
182 public OAuth2TokenService::Consumer, 184 public OAuth2TokenService::Consumer,
183 public OAuth2TokenService::Observer, 185 public OAuth2TokenService::Observer,
184 public SigninManagerBase::Observer, 186 public SigninManagerBase::Observer,
185 public GaiaCookieManagerService::Observer { 187 public GaiaCookieManagerService::Observer {
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 bool CanSyncStart() const override; 275 bool CanSyncStart() const override;
274 void RequestStop(SyncStopDataFate data_fate) override; 276 void RequestStop(SyncStopDataFate data_fate) override;
275 void RequestStart() override; 277 void RequestStart() override;
276 syncer::ModelTypeSet GetActiveDataTypes() const override; 278 syncer::ModelTypeSet GetActiveDataTypes() const override;
277 sync_driver::SyncClient* GetSyncClient() const override; 279 sync_driver::SyncClient* GetSyncClient() const override;
278 syncer::ModelTypeSet GetPreferredDataTypes() const override; 280 syncer::ModelTypeSet GetPreferredDataTypes() const override;
279 void OnUserChoseDatatypes(bool sync_everything, 281 void OnUserChoseDatatypes(bool sync_everything,
280 syncer::ModelTypeSet chosen_types) override; 282 syncer::ModelTypeSet chosen_types) override;
281 void SetFirstSetupComplete() override; 283 void SetFirstSetupComplete() override;
282 bool IsFirstSetupInProgress() const override; 284 bool IsFirstSetupInProgress() const override;
283 void SetSetupInProgress(bool setup_in_progress) override;
284 bool IsSetupInProgress() const override; 285 bool IsSetupInProgress() const override;
285 bool ConfigurationDone() const override; 286 bool ConfigurationDone() const override;
286 const GoogleServiceAuthError& GetAuthError() const override; 287 const GoogleServiceAuthError& GetAuthError() const override;
287 bool HasUnrecoverableError() const override; 288 bool HasUnrecoverableError() const override;
288 bool IsBackendInitialized() const override; 289 bool IsBackendInitialized() const override;
289 sync_driver::OpenTabsUIDelegate* GetOpenTabsUIDelegate() override; 290 sync_driver::OpenTabsUIDelegate* GetOpenTabsUIDelegate() override;
290 bool IsPassphraseRequiredForDecryption() const override; 291 bool IsPassphraseRequiredForDecryption() const override;
291 base::Time GetExplicitPassphraseTime() const override; 292 base::Time GetExplicitPassphraseTime() const override;
292 bool IsUsingSecondaryPassphrase() const override; 293 bool IsUsingSecondaryPassphrase() const override;
293 void EnableEncryptEverything() override; 294 void EnableEncryptEverything() override;
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after
664 IS_MANAGED, // Sync is disallowed by enterprise policy. 665 IS_MANAGED, // Sync is disallowed by enterprise policy.
665 NOT_ALLOWED_BY_PLATFORM, // Sync is disallowed by the platform. 666 NOT_ALLOWED_BY_PLATFORM, // Sync is disallowed by the platform.
666 SYNC_INITIAL_STATE_LIMIT 667 SYNC_INITIAL_STATE_LIMIT
667 }; 668 };
668 669
669 friend class ProfileSyncServicePasswordTest; 670 friend class ProfileSyncServicePasswordTest;
670 friend class SyncTest; 671 friend class SyncTest;
671 friend class TestProfileSyncService; 672 friend class TestProfileSyncService;
672 FRIEND_TEST_ALL_PREFIXES(ProfileSyncServiceTest, InitialState); 673 FRIEND_TEST_ALL_PREFIXES(ProfileSyncServiceTest, InitialState);
673 674
675 // sync_driver::SyncService implementation
676 void SetSetupInProgress(bool setup_in_progress) override;
677
674 // Stops the sync engine. Does NOT set IsSyncRequested to false. Use 678 // Stops the sync engine. Does NOT set IsSyncRequested to false. Use
675 // RequestStop for that. |data_fate| controls whether the local sync data is 679 // RequestStop for that. |data_fate| controls whether the local sync data is
676 // deleted or kept when the engine shuts down. 680 // deleted or kept when the engine shuts down.
677 void StopImpl(SyncStopDataFate data_fate); 681 void StopImpl(SyncStopDataFate data_fate);
678 682
679 // Update the last auth error and notify observers of error state. 683 // Update the last auth error and notify observers of error state.
680 void UpdateAuthErrorState(const GoogleServiceAuthError& error); 684 void UpdateAuthErrorState(const GoogleServiceAuthError& error);
681 685
682 // Detects and attempts to recover from a previous improper datatype 686 // Detects and attempts to recover from a previous improper datatype
683 // configuration where Keep Everything Synced and the preferred types were 687 // configuration where Keep Everything Synced and the preferred types were
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after
1020 base::WeakPtrFactory<ProfileSyncService> startup_controller_weak_factory_; 1024 base::WeakPtrFactory<ProfileSyncService> startup_controller_weak_factory_;
1021 1025
1022 DISALLOW_COPY_AND_ASSIGN(ProfileSyncService); 1026 DISALLOW_COPY_AND_ASSIGN(ProfileSyncService);
1023 }; 1027 };
1024 1028
1025 bool ShouldShowActionOnUI( 1029 bool ShouldShowActionOnUI(
1026 const syncer::SyncProtocolError& error); 1030 const syncer::SyncProtocolError& error);
1027 1031
1028 1032
1029 #endif // COMPONENTS_BROWSER_SYNC_BROWSER_PROFILE_SYNC_SERVICE_H_ 1033 #endif // COMPONENTS_BROWSER_SYNC_BROWSER_PROFILE_SYNC_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698