diff options
author | dantasse@chromium.org <dantasse@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-06-10 18:45:38 +0000 |
---|---|---|
committer | dantasse@chromium.org <dantasse@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-06-10 18:45:38 +0000 |
commit | af90949bc06158572ff989f17a717d5334dd9927 (patch) | |
tree | fbe11fa9fe6bfe0fa5886a976d5a318da864ecd8 /chrome | |
parent | 84b68afd8b8723fdc6dabb3ecb8d4d4f6d8e6aa4 (diff) | |
download | chromium_src-af90949bc06158572ff989f17a717d5334dd9927.zip chromium_src-af90949bc06158572ff989f17a717d5334dd9927.tar.gz chromium_src-af90949bc06158572ff989f17a717d5334dd9927.tar.bz2 |
Plumbing data type choices through to the PSS
BUG=45869
TEST=existing unit tests
Review URL: http://codereview.chromium.org/2721003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@49430 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/browser/sync/glue/sync_backend_host.cc | 14 | ||||
-rw-r--r-- | chrome/browser/sync/glue/sync_backend_host.h | 7 | ||||
-rw-r--r-- | chrome/browser/sync/profile_sync_service.cc | 7 | ||||
-rw-r--r-- | chrome/browser/sync/profile_sync_service.h | 8 |
4 files changed, 34 insertions, 2 deletions
diff --git a/chrome/browser/sync/glue/sync_backend_host.cc b/chrome/browser/sync/glue/sync_backend_host.cc index a45fbd5..19657a3 100644 --- a/chrome/browser/sync/glue/sync_backend_host.cc +++ b/chrome/browser/sync/glue/sync_backend_host.cc @@ -124,6 +124,11 @@ void SyncBackendHost::Authenticate(const std::string& username, username, password, captcha)); } +void SyncBackendHost::StartSyncing() { + core_thread_.message_loop()->PostTask(FROM_HERE, + NewRunnableMethod(core_.get(), &SyncBackendHost::Core::DoStartSyncing)); +} + void SyncBackendHost::Shutdown(bool sync_disabled) { // Thread shutdown should occur in the following order: // - SyncerThread @@ -378,9 +383,9 @@ void SyncBackendHost::Core::DoInitialize(const DoInitializeOptions& options) { options.notification_method); DCHECK(success) << "Syncapi initialization failed!"; - // TODO(dantasse): this call is in a temporary position in order to enable + // TODO(dantasse): this call is in a temporary position in order to enable
// the new sync setup/passphrase UI. http://crbug.com/45869 - syncapi_->StartSyncing(); + DoStartSyncing(); } void SyncBackendHost::Core::DoAuthenticate(const std::string& username, @@ -390,6 +395,11 @@ void SyncBackendHost::Core::DoAuthenticate(const std::string& username, syncapi_->Authenticate(username.c_str(), password.c_str(), captcha.c_str()); } +void SyncBackendHost::Core::DoStartSyncing() { + DCHECK(MessageLoop::current() == host_->core_thread_.message_loop()); + syncapi_->StartSyncing(); +} + UIModelWorker* SyncBackendHost::ui_worker() { ModelSafeWorker* w = registrar_.workers[GROUP_UI]; if (w == NULL) diff --git a/chrome/browser/sync/glue/sync_backend_host.h b/chrome/browser/sync/glue/sync_backend_host.h index c4b27af..fc9fa31 100644 --- a/chrome/browser/sync/glue/sync_backend_host.h +++ b/chrome/browser/sync/glue/sync_backend_host.h @@ -113,6 +113,9 @@ class SyncBackendHost : public browser_sync::ModelSafeWorkerRegistrar { void Authenticate(const std::string& username, const std::string& password, const std::string& captcha); + // Called on |frontend_loop_| to start syncing. + void StartSyncing(); + // Called on |frontend_loop_| to kick off shutdown. // |sync_disabled| indicates if syncing is being disabled or not. // See the implementation and Core::DoShutdown for details. @@ -277,6 +280,10 @@ class SyncBackendHost : public browser_sync::ModelSafeWorkerRegistrar { const std::string& password, const std::string& captcha); + // Called on the SyncBackendHost core_thread_ to tell the syncapi to start + // syncing (generally after initialization and authentication). + void DoStartSyncing(); + // The shutdown order is a bit complicated: // 1) From |core_thread_|, invoke the syncapi Shutdown call to do a final // SaveChanges, close sqlite handles, and halt the syncer thread (which diff --git a/chrome/browser/sync/profile_sync_service.cc b/chrome/browser/sync/profile_sync_service.cc index b228c80..3bdb5c5 100644 --- a/chrome/browser/sync/profile_sync_service.cc +++ b/chrome/browser/sync/profile_sync_service.cc @@ -575,6 +575,13 @@ void ProfileSyncService::OnUserSubmittedAuth( backend_->Authenticate(username, password, captcha); } +void ProfileSyncService::OnUserChoseDatatypes(bool sync_everything, + const syncable::ModelTypeSet& data_types) { + // TODO(dantasse): save sync_everything to prefs + // call StartSyncing(data_types) + // call ChangePreferredDataTypes(data_types) +} + void ProfileSyncService::OnUserCancelledDialog() { if (!profile_->GetPrefs()->GetBoolean(prefs::kSyncHasSetupCompleted)) { // A sync dialog was aborted before authentication. diff --git a/chrome/browser/sync/profile_sync_service.h b/chrome/browser/sync/profile_sync_service.h index 769b9dc..54c9bc6 100644 --- a/chrome/browser/sync/profile_sync_service.h +++ b/chrome/browser/sync/profile_sync_service.h @@ -167,6 +167,14 @@ class ProfileSyncService : public browser_sync::SyncFrontend, const std::string& password, const std::string& captcha); + // Called when a user chooses which data types to sync as part of the sync + // setup wizard. |sync_everything| represents whether they chose the + // "keep everything synced" option; if true, data_types will be ignored and + // all data types will be synced. |sync_everything| means "sync all current + // and future data types." + virtual void OnUserChoseDatatypes(bool sync_everything, + const syncable::ModelTypeSet& data_types); + // Called when a user cancels any setup dialog (login, etc). virtual void OnUserCancelledDialog(); |