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

Side by Side Diff: chrome/browser/sync_file_system/drive_file_sync_service.cc

Issue 11419281: DriveFileSyncService listens to OnNetworkConnected event to restart synchronization (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 8 years 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/sync_file_system/drive_file_sync_service.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_file_system/drive_file_sync_service.h" 5 #include "chrome/browser/sync_file_system/drive_file_sync_service.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after
533 DVLOG(1) << "OnAuthenticated"; 533 DVLOG(1) << "OnAuthenticated";
534 if (state_ == REMOTE_SERVICE_AUTHENTICATION_REQUIRED || 534 if (state_ == REMOTE_SERVICE_AUTHENTICATION_REQUIRED ||
535 state_ == REMOTE_SERVICE_TEMPORARY_UNAVAILABLE) { 535 state_ == REMOTE_SERVICE_TEMPORARY_UNAVAILABLE) {
536 state_ = REMOTE_SERVICE_OK; 536 state_ = REMOTE_SERVICE_OK;
537 FOR_EACH_OBSERVER( 537 FOR_EACH_OBSERVER(
538 Observer, observers_, 538 Observer, observers_,
539 OnRemoteServiceStateUpdated(state_, "Authenticated")); 539 OnRemoteServiceStateUpdated(state_, "Authenticated"));
540 } 540 }
541 } 541 }
542 542
543 void DriveFileSyncService::OnNetworkConnected() {
544 DVLOG(1) << "OnNetworkConnected";
545 if (state_ == REMOTE_SERVICE_AUTHENTICATION_REQUIRED ||
546 state_ == REMOTE_SERVICE_TEMPORARY_UNAVAILABLE) {
547 state_ = REMOTE_SERVICE_OK;
548 FOR_EACH_OBSERVER(
549 Observer, observers_,
550 OnRemoteServiceStateUpdated(state_, "Network connected"));
551 }
552 }
553
543 // Called by CreateForTesting. 554 // Called by CreateForTesting.
544 DriveFileSyncService::DriveFileSyncService( 555 DriveFileSyncService::DriveFileSyncService(
545 const FilePath& base_dir, 556 const FilePath& base_dir,
546 scoped_ptr<DriveFileSyncClient> sync_client, 557 scoped_ptr<DriveFileSyncClient> sync_client,
547 scoped_ptr<DriveMetadataStore> metadata_store) 558 scoped_ptr<DriveMetadataStore> metadata_store)
548 : last_operation_status_(fileapi::SYNC_STATUS_OK), 559 : last_operation_status_(fileapi::SYNC_STATUS_OK),
549 state_(REMOTE_SERVICE_OK), 560 state_(REMOTE_SERVICE_OK),
550 largest_fetched_changestamp_(0), 561 largest_fetched_changestamp_(0),
551 polling_enabled_(false), 562 polling_enabled_(false),
552 weak_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) { 563 weak_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) {
(...skipping 954 matching lines...) Expand 10 before | Expand all | Expand 10 after
1507 fileapi::SyncStatusCode 1518 fileapi::SyncStatusCode
1508 DriveFileSyncService::GDataErrorCodeToSyncStatusCodeWrapper( 1519 DriveFileSyncService::GDataErrorCodeToSyncStatusCodeWrapper(
1509 google_apis::GDataErrorCode error) const { 1520 google_apis::GDataErrorCode error) const {
1510 fileapi::SyncStatusCode status = GDataErrorCodeToSyncStatusCode(error); 1521 fileapi::SyncStatusCode status = GDataErrorCodeToSyncStatusCode(error);
1511 if (status != fileapi::SYNC_STATUS_OK && !sync_client_->IsAuthenticated()) 1522 if (status != fileapi::SYNC_STATUS_OK && !sync_client_->IsAuthenticated())
1512 return fileapi::SYNC_STATUS_AUTHENTICATION_FAILED; 1523 return fileapi::SYNC_STATUS_AUTHENTICATION_FAILED;
1513 return status; 1524 return status;
1514 } 1525 }
1515 1526
1516 } // namespace sync_file_system 1527 } // namespace sync_file_system
OLDNEW
« no previous file with comments | « chrome/browser/sync_file_system/drive_file_sync_service.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698