| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // MediaFileSystemRegistry registers pictures directories and media devices as | 5 // MediaFileSystemRegistry registers pictures directories and media devices as |
| 6 // File API filesystems and keeps track of the path to filesystem ID mappings. | 6 // File API filesystems and keeps track of the path to filesystem ID mappings. |
| 7 | 7 |
| 8 #ifndef CHROME_BROWSER_MEDIA_GALLERY_MEDIA_FILE_SYSTEM_REGISTRY_H_ | 8 #ifndef CHROME_BROWSER_MEDIA_GALLERY_MEDIA_FILE_SYSTEM_REGISTRY_H_ |
| 9 #define CHROME_BROWSER_MEDIA_GALLERY_MEDIA_FILE_SYSTEM_REGISTRY_H_ | 9 #define CHROME_BROWSER_MEDIA_GALLERY_MEDIA_FILE_SYSTEM_REGISTRY_H_ |
| 10 | 10 |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 private: | 65 private: |
| 66 friend struct base::DefaultLazyInstanceTraits<MediaFileSystemRegistry>; | 66 friend struct base::DefaultLazyInstanceTraits<MediaFileSystemRegistry>; |
| 67 | 67 |
| 68 // Mapping of media directories to filesystem IDs. | 68 // Mapping of media directories to filesystem IDs. |
| 69 typedef std::map<FilePath, std::string> MediaPathToFSIDMap; | 69 typedef std::map<FilePath, std::string> MediaPathToFSIDMap; |
| 70 | 70 |
| 71 // Mapping of RPH to MediaPathToFSIDMaps. | 71 // Mapping of RPH to MediaPathToFSIDMaps. |
| 72 typedef std::map<const content::RenderProcessHost*, | 72 typedef std::map<const content::RenderProcessHost*, |
| 73 MediaPathToFSIDMap> ChildIdToMediaFSMap; | 73 MediaPathToFSIDMap> ChildIdToMediaFSMap; |
| 74 | 74 |
| 75 // Mapping of device id to mount path. | 75 // Mapping of device id to media device info. |
| 76 typedef std::map<std::string, FilePath> DeviceIdToMediaPathMap; | 76 typedef std::map<std::string, base::SystemMonitor::MediaDeviceInfo> |
| 77 DeviceIdToInfoMap; |
| 77 | 78 |
| 78 // Obtain an instance of this class via GetInstance(). | 79 // Obtain an instance of this class via GetInstance(). |
| 79 MediaFileSystemRegistry(); | 80 MediaFileSystemRegistry(); |
| 80 virtual ~MediaFileSystemRegistry(); | 81 virtual ~MediaFileSystemRegistry(); |
| 81 | 82 |
| 82 // Helper functions to register / unregister listening for renderer process | 83 // Helper functions to register / unregister listening for renderer process |
| 83 // closed / terminiated notifications. | 84 // closed / terminiated notifications. |
| 84 void RegisterForRPHGoneNotifications(const content::RenderProcessHost* rph); | 85 void RegisterForRPHGoneNotifications(const content::RenderProcessHost* rph); |
| 85 void UnregisterForRPHGoneNotifications(const content::RenderProcessHost* rph); | 86 void UnregisterForRPHGoneNotifications(const content::RenderProcessHost* rph); |
| 86 | 87 |
| 87 // Registers a path as a media file system and return the filesystem id. | 88 // Registers a path as a media file system and return the filesystem id. |
| 88 std::string RegisterPathAsFileSystem(const FilePath& path); | 89 std::string RegisterPathAsFileSystem( |
| 90 const base::SystemMonitor::MediaDeviceType& device_type, |
| 91 const FilePath& path); |
| 92 |
| 89 | 93 |
| 90 // Revoke a media file system with a given |path|. | 94 // Revoke a media file system with a given |path|. |
| 91 void RevokeMediaFileSystem(const FilePath& path); | 95 void RevokeMediaFileSystem( |
| 96 const base::SystemMonitor::MediaDeviceType& device_type, |
| 97 const FilePath& path); |
| 92 | 98 |
| 93 // Only accessed on the UI thread. | 99 // Only accessed on the UI thread. |
| 94 ChildIdToMediaFSMap media_fs_map_; | 100 ChildIdToMediaFSMap media_fs_map_; |
| 95 | 101 |
| 96 // Only accessed on the UI thread. | 102 // Only accessed on the UI thread. |
| 97 DeviceIdToMediaPathMap device_id_map_; | 103 DeviceIdToInfoMap device_id_map_; |
| 98 | 104 |
| 99 // Is only used on the UI thread. | 105 // Is only used on the UI thread. |
| 100 content::NotificationRegistrar registrar_; | 106 content::NotificationRegistrar registrar_; |
| 101 | 107 |
| 102 DISALLOW_COPY_AND_ASSIGN(MediaFileSystemRegistry); | 108 DISALLOW_COPY_AND_ASSIGN(MediaFileSystemRegistry); |
| 103 }; | 109 }; |
| 104 | 110 |
| 105 } // namespace chrome | 111 } // namespace chrome |
| 106 | 112 |
| 107 #endif // CHROME_BROWSER_MEDIA_GALLERY_MEDIA_FILE_SYSTEM_REGISTRY_H_ | 113 #endif // CHROME_BROWSER_MEDIA_GALLERY_MEDIA_FILE_SYSTEM_REGISTRY_H_ |
| OLD | NEW |