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

Unified Diff: chrome/browser/sync_file_system/drive_backend/sync_worker.cc

Issue 309253002: [SyncFS] SyncWorker cache refresh token status (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rename again Created 6 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_file_system/drive_backend/sync_worker.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/sync_file_system/drive_backend/sync_worker.cc
diff --git a/chrome/browser/sync_file_system/drive_backend/sync_worker.cc b/chrome/browser/sync_file_system/drive_backend/sync_worker.cc
index 884198940690157003b4fb00b99e3db75dec4842..6a95d61f583ca88bc46c9b6b3514c29fc82376e8 100644
--- a/chrome/browser/sync_file_system/drive_backend/sync_worker.cc
+++ b/chrome/browser/sync_file_system/drive_backend/sync_worker.cc
@@ -102,6 +102,7 @@ SyncWorker::SyncWorker(
network_available_(false),
extension_service_(extension_service),
context_(sync_engine_context.Pass()),
+ has_refresh_token_(false),
weak_ptr_factory_(this) {}
SyncWorker::~SyncWorker() {}
@@ -124,7 +125,7 @@ void SyncWorker::Initialize() {
void SyncWorker::RegisterOrigin(
const GURL& origin,
const SyncStatusCallback& callback) {
- if (!GetMetadataDatabase() && GetDriveService()->HasRefreshToken())
+ if (!GetMetadataDatabase() && has_refresh_token_)
PostInitializeTask();
scoped_ptr<RegisterAppTask> task(
@@ -346,6 +347,7 @@ void SyncWorker::OnNotificationReceived() {
}
void SyncWorker::OnReadyToSendRequests(const std::string& account_id) {
+ has_refresh_token_ = true;
if (service_state_ == REMOTE_SERVICE_OK)
return;
UpdateServiceState(REMOTE_SERVICE_OK, "Authenticated");
@@ -361,6 +363,8 @@ void SyncWorker::OnReadyToSendRequests(const std::string& account_id) {
}
void SyncWorker::OnRefreshTokenInvalid() {
+ has_refresh_token_ = false;
+
UpdateServiceState(
REMOTE_SERVICE_AUTHENTICATION_REQUIRED,
"Found invalid refresh token.");
@@ -442,7 +446,7 @@ void SyncWorker::PostInitializeTask() {
void SyncWorker::DidInitialize(SyncEngineInitializer* initializer,
SyncStatusCode status) {
if (status != SYNC_STATUS_OK) {
- if (GetDriveService()->HasRefreshToken()) {
+ if (has_refresh_token_) {
UpdateServiceState(REMOTE_SERVICE_TEMPORARY_UNAVAILABLE,
"Could not initialize remote service");
} else {
@@ -671,7 +675,7 @@ void SyncWorker::UpdateServiceStateFromSyncStatusCode(
case SYNC_STATUS_NETWORK_ERROR:
case SYNC_STATUS_ABORT:
case SYNC_STATUS_FAILED:
- if (GetDriveService()->HasRefreshToken()) {
+ if (has_refresh_token_) {
UpdateServiceState(REMOTE_SERVICE_TEMPORARY_UNAVAILABLE,
"Network or temporary service error.");
} else {
« no previous file with comments | « chrome/browser/sync_file_system/drive_backend/sync_worker.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698