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

Unified Diff: chrome/browser/sync/profile_sync_service.cc

Issue 2880001: HTML sync setup UI. (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: Created 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/sync/profile_sync_service.h ('k') | chrome/browser/sync/resources/choose_datatypes.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/sync/profile_sync_service.cc
diff --git a/chrome/browser/sync/profile_sync_service.cc b/chrome/browser/sync/profile_sync_service.cc
index 7b4f3fb526adc9f997636b64a340a8ac2f207b57..9f778f55ac879599e0fc7042839d9902be69c9ad 100644
--- a/chrome/browser/sync/profile_sync_service.cc
+++ b/chrome/browser/sync/profile_sync_service.cc
@@ -200,6 +200,7 @@ void ProfileSyncService::RegisterPreferences() {
return;
pref_service->RegisterInt64Pref(prefs::kSyncLastSyncedTime, 0);
pref_service->RegisterBooleanPref(prefs::kSyncHasSetupCompleted, false);
+ pref_service->RegisterBooleanPref(prefs::kKeepEverythingSynced, false);
// If you've never synced before, or if you're using Chrome OS, all datatypes
// are on by default.
@@ -510,6 +511,15 @@ void ProfileSyncService::ShowLoginDialog() {
}
}
+void ProfileSyncService::ShowChooseDataTypes() {
+ if (WizardIsVisible()) {
+ wizard_.Focus();
+ return;
+ }
+
+ wizard_.Step(SyncSetupWizard::CHOOSE_DATA_TYPES);
+}
+
SyncBackendHost::StatusSummary ProfileSyncService::QuerySyncStatusSummary() {
if (backend_.get())
return backend_->GetStatusSummary();
@@ -583,10 +593,21 @@ void ProfileSyncService::OnUserSubmittedAuth(
}
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)
+ const syncable::ModelTypeSet& chosen_types) {
+ if (!backend_.get()) {
+ NOTREACHED();
+ return;
+ }
+ profile_->GetPrefs()->SetBoolean(prefs::kKeepEverythingSynced,
+ sync_everything);
+
+ ChangePreferredDataTypes(chosen_types);
+ profile_->GetPrefs()->ScheduleSavePersistentPrefs();
+
+ // If the backend has already started syncing, that's okay;
+ // SyncerThread::Start() checks if it's already running before starting.
+ backend_->StartSyncing();
+ // TODO(dantasse): pass the chosen_types parameter through to the backend
}
void ProfileSyncService::OnUserCancelledDialog() {
@@ -719,6 +740,7 @@ void ProfileSyncService::Observe(NotificationType type,
// TODO(sync): Less wizard, more toast.
wizard_.Step(SyncSetupWizard::DONE);
FOR_EACH_OBSERVER(Observer, observers_, OnStateChanged());
+
break;
}
case NotificationType::SYNC_PASSPHRASE_REQUIRED: {
« no previous file with comments | « chrome/browser/sync/profile_sync_service.h ('k') | chrome/browser/sync/resources/choose_datatypes.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698