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

Unified Diff: chrome/browser/sync_file_system/drive_file_sync_client.h

Issue 11414253: DriveFileSyncService listens to OnAuthenticated event to recover from unavailable state (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix Created 8 years, 1 month 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 | « no previous file | chrome/browser/sync_file_system/drive_file_sync_client.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/sync_file_system/drive_file_sync_client.h
diff --git a/chrome/browser/sync_file_system/drive_file_sync_client.h b/chrome/browser/sync_file_system/drive_file_sync_client.h
index e2b43f6f8b746caa12f6e5e12b4fe1689018c668..9ebddd8d9cf480de6d50289f3cbd181bf91b132d 100644
--- a/chrome/browser/sync_file_system/drive_file_sync_client.h
+++ b/chrome/browser/sync_file_system/drive_file_sync_client.h
@@ -10,6 +10,7 @@
#include "base/callback_forward.h"
#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
+#include "base/observer_list.h"
#include "base/threading/non_thread_safe.h"
#include "chrome/browser/google_apis/drive_service_interface.h"
#include "chrome/browser/google_apis/drive_upload_error.h"
@@ -25,10 +26,21 @@ class DriveUploaderInterface;
namespace sync_file_system {
+class DriveFileSyncClientObserver {
+ public:
+ DriveFileSyncClientObserver() {}
+ virtual ~DriveFileSyncClientObserver() {}
+ virtual void OnAuthenticated() {}
kinuko 2012/11/30 06:26:50 I prefer leaving this pure virtual
nhiroki 2012/11/30 08:27:41 Done.
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(DriveFileSyncClientObserver);
+};
+
// This class is responsible for talking to the Drive service to get and put
// Drive directories, files and metadata.
// This class is owned by DriveFileSyncService.
-class DriveFileSyncClient : public base::NonThreadSafe,
+class DriveFileSyncClient : public google_apis::DriveServiceObserver,
+ public base::NonThreadSafe,
public base::SupportsWeakPtr<DriveFileSyncClient> {
public:
typedef base::Callback<void(google_apis::GDataErrorCode error)>
@@ -52,9 +64,19 @@ class DriveFileSyncClient : public base::NonThreadSafe,
scoped_ptr<google_apis::DocumentEntry> entry)>
DocumentEntryCallback;
+ class Observer {
+ public:
+ Observer() {}
+ virtual ~Observer() {}
+ virtual void OnAuthenticated();
+ };
kinuko 2012/11/30 06:26:50 Not used?
nhiroki 2012/11/30 08:27:41 Done.
+
explicit DriveFileSyncClient(Profile* profile);
virtual ~DriveFileSyncClient();
+ void AddObserver(DriveFileSyncClientObserver* observer);
+ void RemoveObserver(DriveFileSyncClientObserver* observer);
+
static scoped_ptr<DriveFileSyncClient> CreateForTesting(
Profile* profile,
scoped_ptr<google_apis::DriveServiceInterface> drive_service,
@@ -145,6 +167,9 @@ class DriveFileSyncClient : public base::NonThreadSafe,
const std::string& remote_file_md5,
const GDataErrorCallback& callback);
+ // DriveServiceObserver override.
+ virtual void OnReadyToPerformOperations() OVERRIDE;
+
private:
friend class DriveFileSyncClientTest;
friend class DriveFileSyncServiceTest;
@@ -233,6 +258,8 @@ class DriveFileSyncClient : public base::NonThreadSafe,
scoped_ptr<google_apis::DriveServiceInterface> drive_service_;
scoped_ptr<google_apis::DriveUploaderInterface> drive_uploader_;
+ ObserverList<DriveFileSyncClientObserver> observers_;
+
DISALLOW_COPY_AND_ASSIGN(DriveFileSyncClient);
};
« no previous file with comments | « no previous file | chrome/browser/sync_file_system/drive_file_sync_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698