OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_file_system/drive_backend/sync_worker.h" | 5 #include "chrome/browser/sync_file_system/drive_backend/sync_worker.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "chrome/browser/drive/drive_service_interface.h" | 10 #include "chrome/browser/drive/drive_service_interface.h" |
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
330 void SyncWorker::OnNotificationReceived() { | 330 void SyncWorker::OnNotificationReceived() { |
331 DCHECK(sequence_checker_.CalledOnValidSequencedThread()); | 331 DCHECK(sequence_checker_.CalledOnValidSequencedThread()); |
332 | 332 |
333 if (service_state_ == REMOTE_SERVICE_TEMPORARY_UNAVAILABLE) | 333 if (service_state_ == REMOTE_SERVICE_TEMPORARY_UNAVAILABLE) |
334 UpdateServiceState(REMOTE_SERVICE_OK, "Got push notification for Drive."); | 334 UpdateServiceState(REMOTE_SERVICE_OK, "Got push notification for Drive."); |
335 | 335 |
336 should_check_remote_change_ = true; | 336 should_check_remote_change_ = true; |
337 MaybeScheduleNextTask(); | 337 MaybeScheduleNextTask(); |
338 } | 338 } |
339 | 339 |
340 void SyncWorker::OnReadyToSendRequests(const std::string& account_id) { | 340 void SyncWorker::OnReadyToSendRequests() { |
341 DCHECK(sequence_checker_.CalledOnValidSequencedThread()); | 341 DCHECK(sequence_checker_.CalledOnValidSequencedThread()); |
342 | 342 |
343 has_refresh_token_ = true; | 343 has_refresh_token_ = true; |
344 | 344 |
345 if (service_state_ == REMOTE_SERVICE_OK) | 345 if (service_state_ == REMOTE_SERVICE_OK) |
346 return; | 346 return; |
347 UpdateServiceState(REMOTE_SERVICE_OK, "Authenticated"); | 347 UpdateServiceState(REMOTE_SERVICE_OK, "Authenticated"); |
348 | 348 |
349 if (!GetMetadataDatabase() && !account_id.empty()) { | 349 if (!GetMetadataDatabase()) { |
350 GetDriveService()->Initialize(account_id); | |
351 PostInitializeTask(); | 350 PostInitializeTask(); |
352 return; | 351 return; |
353 } | 352 } |
354 | 353 |
355 should_check_remote_change_ = true; | 354 should_check_remote_change_ = true; |
356 MaybeScheduleNextTask(); | 355 MaybeScheduleNextTask(); |
357 } | 356 } |
358 | 357 |
359 void SyncWorker::OnRefreshTokenInvalid() { | 358 void SyncWorker::OnRefreshTokenInvalid() { |
360 DCHECK(sequence_checker_.CalledOnValidSequencedThread()); | 359 DCHECK(sequence_checker_.CalledOnValidSequencedThread()); |
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
743 "Service state changed: %d->%d: %s", | 742 "Service state changed: %d->%d: %s", |
744 old_state, GetCurrentState(), description.c_str()); | 743 old_state, GetCurrentState(), description.c_str()); |
745 | 744 |
746 FOR_EACH_OBSERVER( | 745 FOR_EACH_OBSERVER( |
747 Observer, observers_, | 746 Observer, observers_, |
748 UpdateServiceState(GetCurrentState(), description)); | 747 UpdateServiceState(GetCurrentState(), description)); |
749 } | 748 } |
750 | 749 |
751 } // namespace drive_backend | 750 } // namespace drive_backend |
752 } // namespace sync_file_system | 751 } // namespace sync_file_system |
OLD | NEW |