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

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

Issue 7497069: Support Sync following Gaia OAuth authentication (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Incorporating code review comments from Roger. Created 9 years, 4 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
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 b77f42254ed9059b33b0e9e582a339c62c52da9f..dcc81b7288f8ae5533eab43a0485c557fa0ad94f 100644
--- a/chrome/browser/sync/profile_sync_service.cc
+++ b/chrome/browser/sync/profile_sync_service.cc
@@ -117,11 +117,11 @@ bool ProfileSyncService::AreCredentialsAvailable() {
// CrOS user is always logged in. Chrome uses signin_ to check logged in.
if (!cros_user_.empty() || !signin_->GetUsername().empty()) {
// TODO(chron): Verify CrOS unit test behavior.
- if (profile()->GetTokenService() &&
+ return profile()->GetTokenService() &&
profile()->GetTokenService()->HasTokenForService(
- GaiaConstants::kSyncService)) {
- return true;
- }
+ SyncSetupWizard::IsUsingOAuth() ?
+ GaiaConstants::kSyncServiceOAuth :
+ GaiaConstants::kSyncService);
}
return false;
}
@@ -265,6 +265,9 @@ void ProfileSyncService::RegisterPreferences() {
pref_service->RegisterBooleanPref(prefs::kSyncHasSetupCompleted,
false,
PrefService::UNSYNCABLE_PREF);
+ pref_service->RegisterBooleanPref(prefs::kSyncUsingOAuth,
+ false,
+ PrefService::UNSYNCABLE_PREF);
pref_service->RegisterBooleanPref(prefs::kSyncSuppressStart,
false,
PrefService::UNSYNCABLE_PREF);
@@ -335,10 +338,12 @@ void ProfileSyncService::ClearPreferences() {
SyncCredentials ProfileSyncService::GetCredentials() {
SyncCredentials credentials;
- credentials.email = !cros_user_.empty() ? cros_user_ : signin_->GetUsername();
+ credentials.email = cros_user_.empty() ? signin_->GetUsername() : cros_user_;
DCHECK(!credentials.email.empty());
TokenService* service = profile_->GetTokenService();
credentials.sync_token = service->GetTokenForService(
+ SyncSetupWizard::IsUsingOAuth() ?
+ GaiaConstants::kSyncServiceOAuth :
GaiaConstants::kSyncService);
return credentials;
}
@@ -1305,7 +1310,13 @@ void ProfileSyncService::Observe(int type,
// update the implicit passphrase (idempotent if the passphrase didn't
// actually change), or the user has an explicit passphrase set so this
// becomes a no-op.
- SetPassphrase(successful->password, false, true);
+ if (SyncSetupWizard::IsUsingOAuth()) {
+ // TODO(rickcam): Bug 92323: Fetch password through special Gaia request
+ DCHECK(successful->password.empty());
+ LOG(WARNING) << "Not initializing sync passphrase.";
+ } else {
+ SetPassphrase(successful->password, false, true);
+ }
break;
}
case chrome::NOTIFICATION_GOOGLE_SIGNIN_FAILED: {
@@ -1325,7 +1336,6 @@ void ProfileSyncService::Observe(int type,
if (backend_initialized_) {
backend_->UpdateCredentials(GetCredentials());
}
-
if (!profile_->GetPrefs()->GetBoolean(prefs::kSyncSuppressStart))
StartUp();
}

Powered by Google App Engine
This is Rietveld 408576698