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

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

Issue 1175243009: [Sync] Rename SyncEnabledAndLoggedIn() to CanStartSync(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Missed a const transition. Created 5 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/sync_startup_tracker.h" 5 #include "chrome/browser/sync/sync_startup_tracker.h"
6 6
7 #include "chrome/browser/profiles/profile.h" 7 #include "chrome/browser/profiles/profile.h"
8 #include "chrome/browser/sync/profile_sync_service.h" 8 #include "chrome/browser/sync/profile_sync_service.h"
9 #include "chrome/browser/sync/profile_sync_service_factory.h" 9 #include "chrome/browser/sync/profile_sync_service_factory.h"
10 10
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 SyncStartupTracker::SyncServiceState SyncStartupTracker::GetSyncServiceState( 50 SyncStartupTracker::SyncServiceState SyncStartupTracker::GetSyncServiceState(
51 Profile* profile) { 51 Profile* profile) {
52 // If sync is not allowed, treat this as a startup error. 52 // If sync is not allowed, treat this as a startup error.
53 if (!profile->IsSyncAllowed()) 53 if (!profile->IsSyncAllowed())
54 return SYNC_STARTUP_ERROR; 54 return SYNC_STARTUP_ERROR;
55 55
56 ProfileSyncService* service = 56 ProfileSyncService* service =
57 ProfileSyncServiceFactory::GetForProfile(profile); 57 ProfileSyncServiceFactory::GetForProfile(profile);
58 58
59 // If no service exists or it can't be started, treat as a startup error. 59 // If no service exists or it can't be started, treat as a startup error.
60 if (!service || !service->IsSyncEnabledAndLoggedIn()) { 60 if (!service || !service->CanSyncStart()) {
61 return SYNC_STARTUP_ERROR; 61 return SYNC_STARTUP_ERROR;
62 } 62 }
63 63
64 // If the sync backend has started up, notify the callback. 64 // If the sync backend has started up, notify the callback.
65 if (service->backend_initialized()) 65 if (service->backend_initialized())
66 return SYNC_STARTUP_COMPLETE; 66 return SYNC_STARTUP_COMPLETE;
67 67
68 // If the sync service has some kind of error, report to the user. 68 // If the sync service has some kind of error, report to the user.
69 if (service->HasUnrecoverableError()) 69 if (service->HasUnrecoverableError())
70 return SYNC_STARTUP_ERROR; 70 return SYNC_STARTUP_ERROR;
71 71
72 // If we have an auth error and sync is not still waiting for new auth tokens 72 // If we have an auth error and sync is not still waiting for new auth tokens
73 // to be fetched, exit. 73 // to be fetched, exit.
74 if (!service->waiting_for_auth() && 74 if (!service->waiting_for_auth() &&
75 service->GetAuthError().state() != GoogleServiceAuthError::NONE) { 75 service->GetAuthError().state() != GoogleServiceAuthError::NONE) {
76 return SYNC_STARTUP_ERROR; 76 return SYNC_STARTUP_ERROR;
77 } 77 }
78 78
79 // No error detected yet, but the sync backend hasn't started up yet, so 79 // No error detected yet, but the sync backend hasn't started up yet, so
80 // we're in the pending state. 80 // we're in the pending state.
81 return SYNC_STARTUP_PENDING; 81 return SYNC_STARTUP_PENDING;
82 } 82 }
OLDNEW
« no previous file with comments | « chrome/browser/sync/profile_sync_service_mock.h ('k') | chrome/browser/sync/sync_startup_tracker_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698