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

Unified Diff: chrome/browser/chromeos/drive/drive_system_service.h

Issue 13866050: drive: Introduce DriveSystemServiceObserver (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 8 months 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/chromeos/drive/drive_system_service.h
diff --git a/chrome/browser/chromeos/drive/drive_system_service.h b/chrome/browser/chromeos/drive/drive_system_service.h
index 7e63a12915ce50769a031c47023d13dceb354827..cb130441643fcac1a550363da81770352806f01f 100644
--- a/chrome/browser/chromeos/drive/drive_system_service.h
+++ b/chrome/browser/chromeos/drive/drive_system_service.h
@@ -11,6 +11,7 @@
#include "base/memory/scoped_ptr.h"
#include "base/memory/singleton.h"
#include "base/memory/weak_ptr.h"
+#include "base/observer_list.h"
#include "base/threading/sequenced_worker_pool.h"
#include "chrome/browser/chromeos/drive/drive_file_error.h"
#include "chrome/browser/chromeos/drive/drive_file_system_util.h"
@@ -40,6 +41,22 @@ class EventLogger;
class FileWriteHelper;
class StaleCacheFilesRemover;
+// Interface for classes that need to observe events from DriveSystemService.
+// All events are notified on UI thread.
+class DriveSystemServiceObserver {
+ public:
+ // Triggered when the file system is mounted.
+ virtual void OnFileSystemMounted() {
+ }
+
+ // Triggered when the file system is being unmounted.
+ virtual void OnFileSystemBeingUnmounted() {
+ }
+
+ protected:
+ virtual ~DriveSystemServiceObserver() {}
+};
+
// DriveSystemService runs the Drive system, including the Drive file system
// implementation for the file manager, and some other sub systems.
//
@@ -65,6 +82,10 @@ class DriveSystemService : public ProfileKeyedService,
// ProfileKeyedService override:
virtual void Shutdown() OVERRIDE;
+ // Adds and removes the observer.
+ void AddObserver(DriveSystemServiceObserver* observer);
+ void RemoveObserver(DriveSystemServiceObserver* observer);
+
google_apis::DriveServiceInterface* drive_service() {
return drive_service_.get();
}
@@ -152,6 +173,8 @@ class DriveSystemService : public ProfileKeyedService,
scoped_ptr<StaleCacheFilesRemover> stale_cache_files_remover_;
scoped_refptr<DriveFileSystemProxy> file_system_proxy_;
+ ObserverList<DriveSystemServiceObserver> observers_;
+
// Note: This should remain the last member so it'll be destroyed and
// invalidate its weak pointers before any other members are destroyed.
base::WeakPtrFactory<DriveSystemService> weak_ptr_factory_;
« no previous file with comments | « chrome/browser/chromeos/drive/drive_file_system_observer.h ('k') | chrome/browser/chromeos/drive/drive_system_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698