summaryrefslogtreecommitdiffstats
path: root/chrome/browser/chromeos/gdata/drive_cache.h
diff options
context:
space:
mode:
authormtomasz@chromium.org <mtomasz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-10-10 04:48:01 +0000
committermtomasz@chromium.org <mtomasz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-10-10 04:48:01 +0000
commita0927550607ce907dd4733ff94d9671d0598d7ec (patch)
tree872366d34a48eaca042e61e31272e3abba489f06 /chrome/browser/chromeos/gdata/drive_cache.h
parent11387d28032c36724cfe108c544b639c33a6109a (diff)
downloadchromium_src-a0927550607ce907dd4733ff94d9671d0598d7ec.zip
chromium_src-a0927550607ce907dd4733ff94d9671d0598d7ec.tar.gz
chromium_src-a0927550607ce907dd4733ff94d9671d0598d7ec.tar.bz2
Externalized observer classes in gdata files.
Formerly nested observer classes are now refactored to top-level classes in separate files. Therefore, now to implement an observer we need to include only the *_observer.h file. OperationRegistryObserver has not been moved to separate file because it uses another nested structures. Also, redundant includes were removed and changed into required forward declarations. BUG=141261 TEST=unit_tests Review URL: https://chromiumcodereview.appspot.com/10914191 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@161044 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/chromeos/gdata/drive_cache.h')
-rw-r--r--chrome/browser/chromeos/gdata/drive_cache.h25
1 files changed, 4 insertions, 21 deletions
diff --git a/chrome/browser/chromeos/gdata/drive_cache.h b/chrome/browser/chromeos/gdata/drive_cache.h
index 19fd4cc..17bc6fc 100644
--- a/chrome/browser/chromeos/gdata/drive_cache.h
+++ b/chrome/browser/chromeos/gdata/drive_cache.h
@@ -27,6 +27,7 @@ namespace gdata {
class DriveCacheEntry;
class DriveCacheMetadata;
+class DriveCacheObserver;
// Callback for SetMountedStateOnUIThread and ClearAllOnUIThread.
typedef base::Callback<void(DriveFileError error,
@@ -109,24 +110,6 @@ class DriveCache {
FILE_OPERATION_COPY,
};
- // Used to notify events. All events are notified on UI thread.
- class Observer {
- public:
- // Triggered when a file has been pinned successfully.
- virtual void OnCachePinned(const std::string& resource_id,
- const std::string& md5) {}
-
- // Triggered when a file has been unpinned successfully.
- virtual void OnCacheUnpinned(const std::string& resource_id,
- const std::string& md5) {}
-
- // Triggered when a dirty file has been committed (saved) successfully.
- virtual void OnCacheCommitted(const std::string& resource_id) {}
-
- protected:
- virtual ~Observer() {}
- };
-
// Returns the sub-directory under drive cache directory for the given sub
// directory type. Example: <user_profile_dir>/GCache/v1/tmp
//
@@ -149,11 +132,11 @@ class DriveCache {
// Adds observer.
// Must be called on UI thread.
- void AddObserver(Observer* observer);
+ void AddObserver(DriveCacheObserver* observer);
// Removes observer.
// Must be called on UI thread.
- void RemoveObserver(Observer* observer);
+ void RemoveObserver(DriveCacheObserver* observer);
// Gets the cache entry by the given resource ID and MD5.
// See also GetCacheEntry().
@@ -452,7 +435,7 @@ class DriveCache {
scoped_ptr<DriveCacheMetadata> metadata_;
// List of observers, this member must be accessed on UI thread.
- ObserverList<Observer> observers_;
+ ObserverList<DriveCacheObserver> observers_;
// Note: This should remain the last member so it'll be destroyed and
// invalidate its weak pointers before any other members are destroyed.