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

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: Created 7 years, 11 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 c04dab338ce2f4226eb8c0f4e396b3d1ddfa56ba..f1d9de0510e97e5e8d0124f811860ad12dedf330 100644
--- a/chrome/browser/system_monitor/removable_storage_notifications.h
+++ b/chrome/browser/system_monitor/removable_storage_notifications.h
@@ -10,6 +10,8 @@
#include "base/string16.h"
#include "base/synchronization/lock.h"
+class ChromeBrowserMainPartsLinux;
+class ChromeBrowserMainPartsMac;
class MediaGalleriesPrivateApiTest;
namespace chrome {
@@ -36,7 +38,14 @@ class RemovableStorageNotifications {
FilePath::StringType location;
};
- virtual ~RemovableStorageNotifications();
+ // This interface is provided to generators of storage notifications.
+ class Receiver {
+ public:
+ virtual ~Receiver() {}
vandebo (ex-Chrome) 2013/01/31 23:51:29 Put the implementation in the .cc file.
Greg Billock 2013/02/01 18:28:43 Done.
+
+ virtual void ProcessAttach(const StorageInfo& info) = 0;
vandebo (ex-Chrome) 2013/01/31 23:51:29 nit: Take the components here and make the Storage
Greg Billock 2013/02/01 18:28:43 I think we'll end up with more components -- we ne
vandebo (ex-Chrome) 2013/02/01 18:59:55 We used to have the type as a separate component a
Greg Billock 2013/02/01 23:05:42 OK, I can put it back that way. I've been regardin
+ 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 +82,24 @@ 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 FilePath::StringType& location);
- void ProcessDetach(const std::string& id);
+
+ scoped_ptr<Receiver> receiver_;
vandebo (ex-Chrome) 2013/01/31 23:51:29 Make this private and add a protected getter
Greg Billock 2013/02/01 18:28:43 Done.
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_refptr<ObserverListThreadSafe<RemovableStorageObserver> >
observer_list_;

Powered by Google App Engine
This is Rietveld 408576698