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

Unified Diff: chrome/browser/sync_file_system/drive_file_sync_client.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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/sync_file_system/drive_file_sync_client.cc
diff --git a/chrome/browser/sync_file_system/drive_file_sync_client.cc b/chrome/browser/sync_file_system/drive_file_sync_client.cc
index 027477cac806117c83bfd547a1e21d7951ccb239..c9e65a1aef8e51c6c7fbde5cb780b775be782e45 100644
--- a/chrome/browser/sync_file_system/drive_file_sync_client.cc
+++ b/chrome/browser/sync_file_system/drive_file_sync_client.cc
@@ -71,6 +71,7 @@ DriveFileSyncClient::DriveFileSyncClient(Profile* profile)
"" /* custom_user_agent */));
drive_service_->Initialize(profile);
drive_service_->AddObserver(this);
+ net::NetworkChangeNotifier::AddConnectionTypeObserver(this);
drive_uploader_.reset(new google_apis::DriveUploader(drive_service_.get()));
}
@@ -93,12 +94,14 @@ DriveFileSyncClient::DriveFileSyncClient(
drive_service_ = drive_service.Pass();
drive_service_->Initialize(profile);
drive_service_->AddObserver(this);
+ net::NetworkChangeNotifier::AddConnectionTypeObserver(this);
drive_uploader_ = drive_uploader.Pass();
}
DriveFileSyncClient::~DriveFileSyncClient() {
DCHECK(CalledOnValidThread());
+ net::NetworkChangeNotifier::RemoveConnectionTypeObserver(this);
drive_service_->RemoveObserver(this);
drive_service_->CancelAll();
}
@@ -399,6 +402,14 @@ void DriveFileSyncClient::OnReadyToPerformOperations() {
FOR_EACH_OBSERVER(DriveFileSyncClientObserver, observers_, OnAuthenticated());
}
+void DriveFileSyncClient::OnConnectionTypeChanged(
+ net::NetworkChangeNotifier::ConnectionType type) {
+ DCHECK(CalledOnValidThread());
+ if (type != net::NetworkChangeNotifier::CONNECTION_NONE)
+ FOR_EACH_OBSERVER(DriveFileSyncClientObserver,
+ observers_, OnNetworkConnected());
+}
+
void DriveFileSyncClient::DidGetDocumentFeedData(
const DocumentFeedCallback& callback,
google_apis::GDataErrorCode error,
« no previous file with comments | « chrome/browser/sync_file_system/drive_file_sync_client.h ('k') | chrome/browser/sync_file_system/drive_file_sync_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698