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

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: 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 483 matching lines...) Expand 10 before | Expand all | Expand 10 after
494 } 494 }
495 NOTREACHED(); 495 NOTREACHED();
496 DidApplyLocalChange(token.Pass(), url, google_apis::GDATA_OTHER_ERROR, 496 DidApplyLocalChange(token.Pass(), url, google_apis::GDATA_OTHER_ERROR,
497 callback, fileapi::SYNC_STATUS_FAILED); 497 callback, fileapi::SYNC_STATUS_FAILED);
498 } 498 }
499 499
500 void DriveFileSyncService::OnAuthenticated() { 500 void DriveFileSyncService::OnAuthenticated() {
501 DVLOG(1) << "OnAuthenticated"; 501 DVLOG(1) << "OnAuthenticated";
502 state_ = REMOTE_SERVICE_OK; 502 state_ = REMOTE_SERVICE_OK;
503 FOR_EACH_OBSERVER( 503 FOR_EACH_OBSERVER(
504 Observer, observers_, 504 Observer, observers_,
505 OnRemoteServiceStateUpdated(state_, "Authenticated")); 505 OnRemoteServiceStateUpdated(state_, "Authenticated"));
506 }
507
508 void DriveFileSyncService::OnNetworkConnected() {
509 DVLOG(1) << "OnNetworkConnected";
510 state_ = REMOTE_SERVICE_OK;
kinuko 2012/12/03 06:18:48 as in OnAuthenticated() maybe we should flip this
nhiroki 2012/12/03 06:48:54 Done.
511 FOR_EACH_OBSERVER(
512 Observer, observers_,
513 OnRemoteServiceStateUpdated(state_, "Network connected"));
506 } 514 }
507 515
508 // Called by CreateForTesting. 516 // Called by CreateForTesting.
509 DriveFileSyncService::DriveFileSyncService( 517 DriveFileSyncService::DriveFileSyncService(
510 const FilePath& base_dir, 518 const FilePath& base_dir,
511 scoped_ptr<DriveFileSyncClient> sync_client, 519 scoped_ptr<DriveFileSyncClient> sync_client,
512 scoped_ptr<DriveMetadataStore> metadata_store) 520 scoped_ptr<DriveMetadataStore> metadata_store)
513 : last_operation_status_(fileapi::SYNC_STATUS_OK), 521 : last_operation_status_(fileapi::SYNC_STATUS_OK),
514 state_(REMOTE_SERVICE_OK), 522 state_(REMOTE_SERVICE_OK),
515 largest_changestamp_(0), 523 largest_changestamp_(0),
(...skipping 822 matching lines...) Expand 10 before | Expand all | Expand 10 after
1338 fileapi::SyncStatusCode 1346 fileapi::SyncStatusCode
1339 DriveFileSyncService::GDataErrorCodeToSyncStatusCodeWrapper( 1347 DriveFileSyncService::GDataErrorCodeToSyncStatusCodeWrapper(
1340 google_apis::GDataErrorCode error) const { 1348 google_apis::GDataErrorCode error) const {
1341 fileapi::SyncStatusCode status = GDataErrorCodeToSyncStatusCode(error); 1349 fileapi::SyncStatusCode status = GDataErrorCodeToSyncStatusCode(error);
1342 if (status != fileapi::SYNC_STATUS_OK && !sync_client_->IsAuthenticated()) 1350 if (status != fileapi::SYNC_STATUS_OK && !sync_client_->IsAuthenticated())
1343 return fileapi::SYNC_STATUS_AUTHENTICATION_FAILED; 1351 return fileapi::SYNC_STATUS_AUTHENTICATION_FAILED;
1344 return status; 1352 return status;
1345 } 1353 }
1346 1354
1347 } // namespace sync_file_system 1355 } // 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