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

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

Issue 1575153004: [Sync] Simplify sync startup behavior. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@setup
Patch Set: Rebase. Created 4 years, 9 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 <set> 8 #include <set>
9 #include <string> 9 #include <string>
10 #include <utility> 10 #include <utility>
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 // types until the user has finished setting up sync. There are two APIs 158 // types until the user has finished setting up sync. There are two APIs
159 // that control the initial sync download: 159 // that control the initial sync download:
160 // 160 //
161 // * SetFirstSetupComplete() 161 // * SetFirstSetupComplete()
162 // * SetSetupInProgress() 162 // * SetSetupInProgress()
163 // 163 //
164 // SetFirstSetupComplete() should be called once the user has finished setting 164 // SetFirstSetupComplete() should be called once the user has finished setting
165 // up sync at least once on their account. SetSetupInProgress(true) should be 165 // up sync at least once on their account. SetSetupInProgress(true) should be
166 // called while the user is actively configuring their account, and then 166 // called while the user is actively configuring their account, and then
167 // SetSetupInProgress(false) should be called when configuration is complete. 167 // SetSetupInProgress(false) should be called when configuration is complete.
168 // When SetFirstSetupComplete() == false, but SetSetupInProgress(true) has 168 // Once both these conditions have been met, CanConfigureDataTypes() will
169 // been called, then the sync engine knows not to download any user data. 169 // return true and datatype configuration can begin.
170 //
171 // When initial sync is complete, the UI code should call
172 // SetFirstSetupComplete() followed by SetSetupInProgress(false) - this will
173 // tell the sync engine that setup is completed and it can begin downloading
174 // data from the sync server.
175 //
176 class ProfileSyncService : public sync_driver::SyncService, 170 class ProfileSyncService : public sync_driver::SyncService,
177 public sync_driver::SyncFrontend, 171 public sync_driver::SyncFrontend,
178 public sync_driver::SyncPrefObserver, 172 public sync_driver::SyncPrefObserver,
179 public sync_driver::DataTypeManagerObserver, 173 public sync_driver::DataTypeManagerObserver,
180 public syncer::UnrecoverableErrorHandler, 174 public syncer::UnrecoverableErrorHandler,
181 public KeyedService, 175 public KeyedService,
182 public OAuth2TokenService::Consumer, 176 public OAuth2TokenService::Consumer,
183 public OAuth2TokenService::Observer, 177 public OAuth2TokenService::Observer,
184 public SigninManagerBase::Observer { 178 public SigninManagerBase::Observer {
185 public: 179 public:
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after
501 virtual bool IsEncryptEverythingAllowed() const; 495 virtual bool IsEncryptEverythingAllowed() const;
502 496
503 // Sets whether encrypting all the sync data is allowed or not. 497 // Sets whether encrypting all the sync data is allowed or not.
504 virtual void SetEncryptEverythingAllowed(bool allowed); 498 virtual void SetEncryptEverythingAllowed(bool allowed);
505 499
506 // Returns true if the syncer is waiting for new datatypes to be encrypted. 500 // Returns true if the syncer is waiting for new datatypes to be encrypted.
507 virtual bool encryption_pending() const; 501 virtual bool encryption_pending() const;
508 502
509 SigninManagerBase* signin() const; 503 SigninManagerBase* signin() const;
510 504
511 // Used by tests.
512 bool auto_start_enabled() const;
513
514 SyncErrorController* sync_error_controller() { 505 SyncErrorController* sync_error_controller() {
515 return sync_error_controller_.get(); 506 return sync_error_controller_.get();
516 } 507 }
517 508
518 // TODO(sync): This is only used in tests. Can we remove it? 509 // TODO(sync): This is only used in tests. Can we remove it?
519 const sync_driver::DataTypeStatusTable& data_type_status_table() const; 510 const sync_driver::DataTypeStatusTable& data_type_status_table() const;
520 511
521 sync_driver::DataTypeManager::ConfigureStatus configure_status() { 512 sync_driver::DataTypeManager::ConfigureStatus configure_status() {
522 return configure_status_; 513 return configure_status_;
523 } 514 }
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
775 766
776 // Calls data type manager to start catch up configure. 767 // Calls data type manager to start catch up configure.
777 void BeginConfigureCatchUpBeforeClear(); 768 void BeginConfigureCatchUpBeforeClear();
778 769
779 // Calls sync backend to send ClearServerDataMessage to server. 770 // Calls sync backend to send ClearServerDataMessage to server.
780 void ClearAndRestartSyncForPassphraseEncryption(); 771 void ClearAndRestartSyncForPassphraseEncryption();
781 772
782 // Restarts sync clearing directory in the process. 773 // Restarts sync clearing directory in the process.
783 void OnClearServerDataDone(); 774 void OnClearServerDataDone();
784 775
776 // True if setup has been completed at least once and is not in progress.
777 bool CanConfigureDataTypes() const;
778
785 // This profile's SyncClient, which abstracts away non-Sync dependencies and 779 // This profile's SyncClient, which abstracts away non-Sync dependencies and
786 // the Sync API component factory. 780 // the Sync API component factory.
787 scoped_ptr<sync_driver::SyncClient> sync_client_; 781 scoped_ptr<sync_driver::SyncClient> sync_client_;
788 782
789 // The class that handles getting, setting, and persisting sync 783 // The class that handles getting, setting, and persisting sync
790 // preferences. 784 // preferences.
791 sync_driver::SyncPrefs sync_prefs_; 785 sync_driver::SyncPrefs sync_prefs_;
792 786
793 // TODO(ncarter): Put this in a profile, once there is UI for it. 787 // TODO(ncarter): Put this in a profile, once there is UI for it.
794 // This specifies where to find the sync server. 788 // This specifies where to find the sync server.
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
994 base::WeakPtrFactory<ProfileSyncService> startup_controller_weak_factory_; 988 base::WeakPtrFactory<ProfileSyncService> startup_controller_weak_factory_;
995 989
996 DISALLOW_COPY_AND_ASSIGN(ProfileSyncService); 990 DISALLOW_COPY_AND_ASSIGN(ProfileSyncService);
997 }; 991 };
998 992
999 bool ShouldShowActionOnUI( 993 bool ShouldShowActionOnUI(
1000 const syncer::SyncProtocolError& error); 994 const syncer::SyncProtocolError& error);
1001 995
1002 996
1003 #endif // COMPONENTS_BROWSER_SYNC_BROWSER_PROFILE_SYNC_SERVICE_H_ 997 #endif // COMPONENTS_BROWSER_SYNC_BROWSER_PROFILE_SYNC_SERVICE_H_
OLDNEW
« no previous file with comments | « chrome/browser/sync/test/integration/sync_test.cc ('k') | components/browser_sync/browser/profile_sync_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698