| Index: chrome/browser/media_gallery/media_file_system_registry.h
|
| diff --git a/chrome/browser/media_gallery/media_file_system_registry.h b/chrome/browser/media_gallery/media_file_system_registry.h
|
| index 459705d1d02ce4112dcc5c720a1eadf6de781c5a..ef303ad35ffd275c73f4d2bab19fa144e22e1cf6 100644
|
| --- a/chrome/browser/media_gallery/media_file_system_registry.h
|
| +++ b/chrome/browser/media_gallery/media_file_system_registry.h
|
| @@ -22,7 +22,7 @@
|
| class FilePath;
|
|
|
| namespace content {
|
| -class RenderProcessHost;
|
| +class RenderViewHost;
|
| }
|
|
|
| namespace extensions {
|
| @@ -35,9 +35,10 @@ class IsolatedContext;
|
|
|
| namespace chrome {
|
|
|
| +class ExtensionGalleriesHost
|
| +
|
| class MediaFileSystemRegistry
|
| - : public base::SystemMonitor::DevicesChangedObserver,
|
| - public content::NotificationObserver {
|
| + : public base::SystemMonitor::DevicesChangedObserver {
|
| public:
|
| struct MediaFSInfo {
|
| std::string name;
|
| @@ -48,59 +49,37 @@ class MediaFileSystemRegistry
|
| // The instance is lazily created per browser process.
|
| static MediaFileSystemRegistry* GetInstance();
|
|
|
| - // Returns the list of media filesystem IDs and paths for a given RPH.
|
| + // Returns the list of media filesystem IDs and paths for a given RVH.
|
| // Called on the UI thread.
|
| std::vector<MediaFSInfo> GetMediaFileSystemsForExtension(
|
| - const content::RenderProcessHost* rph,
|
| - const extensions::Extension& extension);
|
| + const content::RenderViewHost* rph,
|
| + const extensions::Extension* extension);
|
|
|
| // base::SystemMonitor::DevicesChangedObserver implementation.
|
| virtual void OnMediaDeviceDetached(const std::string& id) OVERRIDE;
|
|
|
| - // content::NotificationObserver implementation.
|
| - virtual void Observe(int type,
|
| - const content::NotificationSource& source,
|
| - const content::NotificationDetails& details) OVERRIDE;
|
| -
|
| std::string GetDeviceIdFromPath(const FilePath& path) const;
|
|
|
| private:
|
| friend struct base::DefaultLazyInstanceTraits<MediaFileSystemRegistry>;
|
|
|
| - // Mapping of media directories to filesystem IDs.
|
| - typedef std::map<FilePath, std::string> MediaPathToFSIDMap;
|
| -
|
| - // Mapping of RPH to MediaPathToFSIDMaps.
|
| - typedef std::map<const content::RenderProcessHost*,
|
| - MediaPathToFSIDMap> ChildIdToMediaFSMap;
|
| -
|
| - // Mapping of device id to media device info.
|
| - typedef std::map<std::string, base::SystemMonitor::MediaDeviceInfo>
|
| - DeviceIdToInfoMap;
|
| + // Map an extension to the ExtensionGalleriesHost.
|
| + typedef std::map<const extensions::Extension*,
|
| + scoped_ptr<ExtensionGalleriesHost> > ExtensionHostMap;
|
| + // Map a profile and extension to the ExtensionGallerisHost.
|
| + typedef std::map<const Profile*, ExtensionHostMap>
|
| + ExtensionGalleriesHostMap;
|
|
|
| // Obtain an instance of this class via GetInstance().
|
| MediaFileSystemRegistry();
|
| virtual ~MediaFileSystemRegistry();
|
|
|
| - // Helper functions to register / unregister listening for renderer process
|
| - // closed / terminiated notifications.
|
| - void RegisterForRPHGoneNotifications(const content::RenderProcessHost* rph);
|
| - void UnregisterForRPHGoneNotifications(const content::RenderProcessHost* rph);
|
| -
|
| - // Registers a path as a media file system and return the filesystem id.
|
| - std::string RegisterPathAsFileSystem(const FilePath& path);
|
| -
|
| - // Revoke a media file system with a given |path|.
|
| - void RevokeMediaFileSystem(const FilePath& path);
|
| -
|
| - // Only accessed on the UI thread.
|
| - ChildIdToMediaFSMap media_fs_map_;
|
| -
|
| - // Only accessed on the UI thread.
|
| - DeviceIdToInfoMap device_id_map_;
|
| + void OnExtensionGalleriesHostEmpty(const Profile* profile,
|
| + const extensions::Extension* extension);
|
|
|
| - // Is only used on the UI thread.
|
| - content::NotificationRegistrar registrar_;
|
| + // Only accessed on the UI thread. This map owns all the
|
| + // ExtensionGalleriesHost objects created.
|
| + ExtensionGalleriesHostMap extension_host_map_;
|
|
|
| DISALLOW_COPY_AND_ASSIGN(MediaFileSystemRegistry);
|
| };
|
|
|