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

Unified Diff: chrome/browser/system_monitor/removable_storage_notifications.h

Issue 12147002: Add a receiver interface to RemovableStorageNotifications. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Merging Created 7 years, 10 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/system_monitor/removable_storage_notifications.h
diff --git a/chrome/browser/system_monitor/removable_storage_notifications.h b/chrome/browser/system_monitor/removable_storage_notifications.h
index 6f704344ce19d6051556bb062a6310d9d4c8666e..e916dea83fdc0ed3f1fadb65729e269f983a5234 100644
--- a/chrome/browser/system_monitor/removable_storage_notifications.h
+++ b/chrome/browser/system_monitor/removable_storage_notifications.h
@@ -10,10 +10,13 @@
#include "base/string16.h"
#include "base/synchronization/lock.h"
+class ChromeBrowserMainPartsLinux;
+class ChromeBrowserMainPartsMac;
class MediaGalleriesPrivateApiTest;
namespace chrome {
+class MediaFileSystemRegistryTest;
class RemovableStorageObserver;
// Base class for platform-specific instances watching for removable storage
@@ -36,7 +39,16 @@ class RemovableStorageNotifications {
base::FilePath::StringType location;
};
- virtual ~RemovableStorageNotifications();
+ // This interface is provided to generators of storage notifications.
+ class Receiver {
+ public:
+ virtual ~Receiver();
+
+ virtual void ProcessAttach(const std::string& id,
+ const string16& name,
+ const base::FilePath::StringType& location) = 0;
+ virtual void ProcessDetach(const std::string& id) = 0;
+ };
// Returns a pointer to an object owned by the BrowserMainParts, with lifetime
// somewhat shorter than a process Singleton.
@@ -73,24 +85,27 @@ class RemovableStorageNotifications {
protected:
RemovableStorageNotifications();
+ virtual ~RemovableStorageNotifications();
- friend class MediaFileSystemRegistryTest;
+ // TODO(gbillock): Clean up ownerships and get rid of these friends.
+ friend class ::ChromeBrowserMainPartsLinux;
+ friend class ::ChromeBrowserMainPartsMac;
friend class ::MediaGalleriesPrivateApiTest;
- friend class MediaStorageUtilTest;
- // TODO(gbillock): remove these friends by making the classes owned by the
- // platform-specific implementation.
- friend class MediaTransferProtocolDeviceObserverLinux;
- friend class PortableDeviceWatcherWin;
- friend class VolumeMountWatcherWin;
-
- void ProcessAttach(const std::string& id,
- const string16& name,
- const base::FilePath::StringType& location);
- void ProcessDetach(const std::string& id);
+ friend class MediaFileSystemRegistryTest;
+
+ virtual Receiver* receiver() const;
private:
+ class ReceiverImpl;
+ friend class ReceiverImpl;
+
typedef std::map<std::string, StorageInfo> RemovableStorageMap;
+ void ProcessAttach(const StorageInfo& storage);
+ void ProcessDetach(const std::string& id);
+
+ scoped_ptr<Receiver> receiver_;
+
scoped_refptr<ObserverListThreadSafe<RemovableStorageObserver> >
observer_list_;

Powered by Google App Engine
This is Rietveld 408576698