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

Side by Side Diff: chrome/browser/sync/profile_sync_service.cc

Issue 2878012: Revert 50902 - New HTML Sync Setup UI.... (Closed) Base URL: svn://svn.chromium.org/chrome/branches/450/src/
Patch Set: Created 10 years, 5 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 "chrome/browser/sync/profile_sync_service.h" 5 #include "chrome/browser/sync/profile_sync_service.h"
6 6
7 #include <map> 7 #include <map>
8 #include <set> 8 #include <set>
9 9
10 #include "app/l10n_util.h" 10 #include "app/l10n_util.h"
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 browser_sync::StringToNotificationMethod(notification_method_str); 187 browser_sync::StringToNotificationMethod(notification_method_str);
188 } 188 }
189 } 189 }
190 190
191 void ProfileSyncService::RegisterPreferences() { 191 void ProfileSyncService::RegisterPreferences() {
192 PrefService* pref_service = profile_->GetPrefs(); 192 PrefService* pref_service = profile_->GetPrefs();
193 if (pref_service->FindPreference(prefs::kSyncLastSyncedTime)) 193 if (pref_service->FindPreference(prefs::kSyncLastSyncedTime))
194 return; 194 return;
195 pref_service->RegisterInt64Pref(prefs::kSyncLastSyncedTime, 0); 195 pref_service->RegisterInt64Pref(prefs::kSyncLastSyncedTime, 0);
196 pref_service->RegisterBooleanPref(prefs::kSyncHasSetupCompleted, false); 196 pref_service->RegisterBooleanPref(prefs::kSyncHasSetupCompleted, false);
197 pref_service->RegisterBooleanPref(prefs::kKeepEverythingSynced, false);
198 197
199 // If you've never synced before, or if you're using Chrome OS, all datatypes 198 // If you've never synced before, or if you're using Chrome OS, all datatypes
200 // are on by default. 199 // are on by default.
201 // TODO(nick): Perhaps a better model would be to always default to false, 200 // TODO(nick): Perhaps a better model would be to always default to false,
202 // and explicitly call SetDataTypes() when the user shows the wizard. 201 // and explicitly call SetDataTypes() when the user shows the wizard.
203 #if defined(OS_CHROMEOS) 202 #if defined(OS_CHROMEOS)
204 bool enable_by_default = true; 203 bool enable_by_default = true;
205 #else 204 #else
206 bool enable_by_default = 205 bool enable_by_default =
207 !pref_service->HasPrefPath(prefs::kSyncHasSetupCompleted); 206 !pref_service->HasPrefPath(prefs::kSyncHasSetupCompleted);
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after
497 UMA_HISTOGRAM_LONG_TIMES("Sync.ReauthorizationTime", 496 UMA_HISTOGRAM_LONG_TIMES("Sync.ReauthorizationTime",
498 base::TimeTicks::Now() - auth_error_time_); 497 base::TimeTicks::Now() - auth_error_time_);
499 auth_error_time_ = base::TimeTicks(); // Reset auth_error_time_ to null. 498 auth_error_time_ = base::TimeTicks(); // Reset auth_error_time_ to null.
500 } 499 }
501 500
502 if (last_auth_error_.state() != AuthError::NONE) { 501 if (last_auth_error_.state() != AuthError::NONE) {
503 wizard_.Step(SyncSetupWizard::GAIA_LOGIN); 502 wizard_.Step(SyncSetupWizard::GAIA_LOGIN);
504 } 503 }
505 } 504 }
506 505
507 void ProfileSyncService::ShowChooseDataTypes() {
508 if (WizardIsVisible()) {
509 wizard_.Focus();
510 return;
511 }
512
513 wizard_.Step(SyncSetupWizard::CHOOSE_DATA_TYPES);
514 }
515
516 SyncBackendHost::StatusSummary ProfileSyncService::QuerySyncStatusSummary() { 506 SyncBackendHost::StatusSummary ProfileSyncService::QuerySyncStatusSummary() {
517 if (backend_.get()) 507 if (backend_.get())
518 return backend_->GetStatusSummary(); 508 return backend_->GetStatusSummary();
519 else 509 else
520 return SyncBackendHost::Status::OFFLINE_UNUSABLE; 510 return SyncBackendHost::Status::OFFLINE_UNUSABLE;
521 } 511 }
522 512
523 SyncBackendHost::Status ProfileSyncService::QueryDetailedSyncStatus() { 513 SyncBackendHost::Status ProfileSyncService::QueryDetailedSyncStatus() {
524 if (backend_.get()) { 514 if (backend_.get()) {
525 return backend_->GetDetailedStatus(); 515 return backend_->GetDetailedStatus();
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
579 } 569 }
580 last_attempted_user_email_ = username; 570 last_attempted_user_email_ = username;
581 is_auth_in_progress_ = true; 571 is_auth_in_progress_ = true;
582 FOR_EACH_OBSERVER(Observer, observers_, OnStateChanged()); 572 FOR_EACH_OBSERVER(Observer, observers_, OnStateChanged());
583 573
584 auth_start_time_ = base::TimeTicks::Now(); 574 auth_start_time_ = base::TimeTicks::Now();
585 backend_->Authenticate(username, password, captcha); 575 backend_->Authenticate(username, password, captcha);
586 } 576 }
587 577
588 void ProfileSyncService::OnUserChoseDatatypes(bool sync_everything, 578 void ProfileSyncService::OnUserChoseDatatypes(bool sync_everything,
589 const syncable::ModelTypeSet& chosen_types) { 579 const syncable::ModelTypeSet& data_types) {
590 if (!backend_.get()) { 580 // TODO(dantasse): save sync_everything to prefs
591 NOTREACHED(); 581 // call StartSyncing(data_types)
592 return; 582 // call ChangePreferredDataTypes(data_types)
593 }
594 profile_->GetPrefs()->SetBoolean(prefs::kKeepEverythingSynced,
595 sync_everything);
596
597 ChangePreferredDataTypes(chosen_types);
598 profile_->GetPrefs()->ScheduleSavePersistentPrefs();
599
600 // If the backend has already started syncing, that's okay;
601 // SyncerThread::Start() checks if it's already running before starting.
602 backend_->StartSyncing();
603 // TODO(dantasse): pass the chosen_types parameter through to the backend
604 } 583 }
605 584
606 void ProfileSyncService::OnUserCancelledDialog() { 585 void ProfileSyncService::OnUserCancelledDialog() {
607 if (!profile_->GetPrefs()->GetBoolean(prefs::kSyncHasSetupCompleted)) { 586 if (!profile_->GetPrefs()->GetBoolean(prefs::kSyncHasSetupCompleted)) {
608 // A sync dialog was aborted before authentication. 587 // A sync dialog was aborted before authentication.
609 // Rollback. 588 // Rollback.
610 DisableForUser(); 589 DisableForUser();
611 } 590 }
612 591
613 FOR_EACH_OBSERVER(Observer, observers_, OnStateChanged()); 592 FOR_EACH_OBSERVER(Observer, observers_, OnStateChanged());
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
726 DataTypeManager::ConfigureResult result = 705 DataTypeManager::ConfigureResult result =
727 *(Details<DataTypeManager::ConfigureResult>(details).ptr()); 706 *(Details<DataTypeManager::ConfigureResult>(details).ptr());
728 if (result != DataTypeManager::OK) { 707 if (result != DataTypeManager::OK) {
729 OnUnrecoverableError(FROM_HERE, "Sync Configuration failed."); 708 OnUnrecoverableError(FROM_HERE, "Sync Configuration failed.");
730 return; 709 return;
731 } 710 }
732 711
733 // TODO(sync): Less wizard, more toast. 712 // TODO(sync): Less wizard, more toast.
734 wizard_.Step(SyncSetupWizard::DONE); 713 wizard_.Step(SyncSetupWizard::DONE);
735 FOR_EACH_OBSERVER(Observer, observers_, OnStateChanged()); 714 FOR_EACH_OBSERVER(Observer, observers_, OnStateChanged());
736
737 break; 715 break;
738 } 716 }
739 case NotificationType::SYNC_PASSPHRASE_REQUIRED: { 717 case NotificationType::SYNC_PASSPHRASE_REQUIRED: {
740 // TODO(sync): Show the passphrase UI here. 718 // TODO(sync): Show the passphrase UI here.
741 SetPassphrase("dummy passphrase"); 719 SetPassphrase("dummy passphrase");
742 break; 720 break;
743 } 721 }
744 case NotificationType::SYNC_PASSPHRASE_ACCEPTED: { 722 case NotificationType::SYNC_PASSPHRASE_ACCEPTED: {
745 // Make sure the data types that depend on the passphrase are started at 723 // Make sure the data types that depend on the passphrase are started at
746 // this time. 724 // this time.
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
780 // is initialized, all enabled data types are consistent with one 758 // is initialized, all enabled data types are consistent with one
781 // another, and no unrecoverable error has transpired. 759 // another, and no unrecoverable error has transpired.
782 if (unrecoverable_error_detected_) 760 if (unrecoverable_error_detected_)
783 return false; 761 return false;
784 762
785 if (!data_type_manager_.get()) 763 if (!data_type_manager_.get())
786 return false; 764 return false;
787 765
788 return data_type_manager_->state() == DataTypeManager::CONFIGURED; 766 return data_type_manager_->state() == DataTypeManager::CONFIGURED;
789 } 767 }
OLDNEW
« 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