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

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

Issue 617183003: Make sure GetAuthenticatedAccountId() returns a canonicalized id. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address review comments Created 6 years, 2 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 #include "chrome/browser/sync/profile_sync_service.h" 5 #include "chrome/browser/sync/profile_sync_service.h"
6 6
7 #include <cstddef> 7 #include <cstddef>
8 #include <map> 8 #include <map>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 return false; 275 return false;
276 276
277 // Sync is logged in if there is a non-empty effective username. 277 // Sync is logged in if there is a non-empty effective username.
278 return !signin_->GetEffectiveUsername().empty(); 278 return !signin_->GetEffectiveUsername().empty();
279 } 279 }
280 280
281 bool ProfileSyncService::IsOAuthRefreshTokenAvailable() { 281 bool ProfileSyncService::IsOAuthRefreshTokenAvailable() {
282 if (!oauth2_token_service_) 282 if (!oauth2_token_service_)
283 return false; 283 return false;
284 284
285 return oauth2_token_service_->RefreshTokenIsAvailable( 285 std::string account_id = signin_->GetAccountIdToUse();
286 signin_->GetAccountIdToUse()); 286 return !account_id.empty() &&
287 oauth2_token_service_->RefreshTokenIsAvailable(account_id);
287 } 288 }
288 289
289 void ProfileSyncService::Initialize() { 290 void ProfileSyncService::Initialize() {
290 // We clear this here (vs Shutdown) because we want to remember that an error 291 // We clear this here (vs Shutdown) because we want to remember that an error
291 // happened on shutdown so we can display details (message, location) about it 292 // happened on shutdown so we can display details (message, location) about it
292 // in about:sync. 293 // in about:sync.
293 ClearStaleErrors(); 294 ClearStaleErrors();
294 295
295 sync_prefs_.AddSyncPrefObserver(this); 296 sync_prefs_.AddSyncPrefObserver(this);
296 297
(...skipping 2410 matching lines...) Expand 10 before | Expand all | Expand 10 after
2707 base::Time ProfileSyncService::GetDeviceBackupTimeForTesting() const { 2708 base::Time ProfileSyncService::GetDeviceBackupTimeForTesting() const {
2708 return device_info_sync_service_->GetLocalDeviceBackupTime(); 2709 return device_info_sync_service_->GetLocalDeviceBackupTime();
2709 } 2710 }
2710 2711
2711 void ProfileSyncService::FlushDirectory() const { 2712 void ProfileSyncService::FlushDirectory() const {
2712 // backend_initialized_ implies backend_ isn't NULL and the manager exists. 2713 // backend_initialized_ implies backend_ isn't NULL and the manager exists.
2713 // If sync is not initialized yet, we fail silently. 2714 // If sync is not initialized yet, we fail silently.
2714 if (backend_initialized_) 2715 if (backend_initialized_)
2715 backend_->FlushDirectory(); 2716 backend_->FlushDirectory();
2716 } 2717 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698