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

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: 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
« 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 368209a8326b8b259061fde690bcb7c4c585290f..60d2ce49f958de8fdc006b7551263bda818e76e0 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() = 0;
+
+ 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)>
@@ -55,6 +67,9 @@ class DriveFileSyncClient : public base::NonThreadSafe,
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,
@@ -153,6 +168,9 @@ class DriveFileSyncClient : public base::NonThreadSafe,
static std::string OriginToDirectoryTitle(const GURL& origin);
static GURL DirectoryTitleToOrigin(const std::string& title);
+ // DriveServiceObserver overrides.
+ virtual void OnReadyToPerformOperations() OVERRIDE;
+
private:
friend class DriveFileSyncClientTest;
friend class DriveFileSyncServiceTest;
@@ -241,6 +259,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