| 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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 const content::RenderViewHost* rvh, | 89 const content::RenderViewHost* rvh, |
| 90 const extensions::Extension* extension, | 90 const extensions::Extension* extension, |
| 91 const MediaFileSystemsCallback& callback); | 91 const MediaFileSystemsCallback& callback); |
| 92 | 92 |
| 93 // base::SystemMonitor::DevicesChangedObserver implementation. | 93 // base::SystemMonitor::DevicesChangedObserver implementation. |
| 94 virtual void OnRemovableStorageAttached( | 94 virtual void OnRemovableStorageAttached( |
| 95 const std::string& id, const string16& name, | 95 const std::string& id, const string16& name, |
| 96 const FilePath::StringType& location) OVERRIDE; | 96 const FilePath::StringType& location) OVERRIDE; |
| 97 virtual void OnRemovableStorageDetached(const std::string& id) OVERRIDE; | 97 virtual void OnRemovableStorageDetached(const std::string& id) OVERRIDE; |
| 98 | 98 |
| 99 // Register all the media devices found in system monitor as auto-detected |
| 100 // galleries for a given RVH profile preferences. Called on the UI thread. |
| 101 void AddAttachedMediaDeviceGalleries(const content::RenderViewHost* rvh); |
| 102 |
| 99 private: | 103 private: |
| 100 friend struct base::DefaultLazyInstanceTraits<MediaFileSystemRegistry>; | 104 friend struct base::DefaultLazyInstanceTraits<MediaFileSystemRegistry>; |
| 101 class MediaFileSystemContextImpl; | 105 class MediaFileSystemContextImpl; |
| 102 | 106 |
| 103 // Map an extension to the ExtensionGalleriesHost. | 107 // Map an extension to the ExtensionGalleriesHost. |
| 104 typedef std::map<std::string /*extension_id*/, | 108 typedef std::map<std::string /*extension_id*/, |
| 105 scoped_refptr<ExtensionGalleriesHost> > ExtensionHostMap; | 109 scoped_refptr<ExtensionGalleriesHost> > ExtensionHostMap; |
| 106 // Map a profile and extension to the ExtensionGalleriesHost. | 110 // Map a profile and extension to the ExtensionGalleriesHost. |
| 107 typedef std::map<Profile*, ExtensionHostMap> ExtensionGalleriesHostMap; | 111 typedef std::map<Profile*, ExtensionHostMap> ExtensionGalleriesHostMap; |
| 108 | 112 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 122 // Returns ScopedMtpDeviceMapEntry object for the given |device_location|. | 126 // Returns ScopedMtpDeviceMapEntry object for the given |device_location|. |
| 123 ScopedMtpDeviceMapEntry* GetOrCreateScopedMtpDeviceMapEntry( | 127 ScopedMtpDeviceMapEntry* GetOrCreateScopedMtpDeviceMapEntry( |
| 124 const FilePath::StringType& device_location); | 128 const FilePath::StringType& device_location); |
| 125 | 129 |
| 126 // Removes the ScopedMtpDeviceMapEntry associated with the given | 130 // Removes the ScopedMtpDeviceMapEntry associated with the given |
| 127 // |device_location|. | 131 // |device_location|. |
| 128 void RemoveScopedMtpDeviceMapEntry( | 132 void RemoveScopedMtpDeviceMapEntry( |
| 129 const FilePath::StringType& device_location); | 133 const FilePath::StringType& device_location); |
| 130 #endif | 134 #endif |
| 131 | 135 |
| 132 // Register all the media devices found in system monitor as auto-detected | |
| 133 // galleries for the passed |preferences|. | |
| 134 void AddAttachedMediaDeviceGalleries(MediaGalleriesPreferences* preferences); | |
| 135 | |
| 136 void OnExtensionGalleriesHostEmpty(Profile* profile, | 136 void OnExtensionGalleriesHostEmpty(Profile* profile, |
| 137 const std::string& extension_id); | 137 const std::string& extension_id); |
| 138 | 138 |
| 139 // Only accessed on the UI thread. This map owns all the | 139 // Only accessed on the UI thread. This map owns all the |
| 140 // ExtensionGalleriesHost objects created. | 140 // ExtensionGalleriesHost objects created. |
| 141 ExtensionGalleriesHostMap extension_hosts_map_; | 141 ExtensionGalleriesHostMap extension_hosts_map_; |
| 142 | 142 |
| 143 #if defined(SUPPORT_MTP_DEVICE_FILESYSTEM) | 143 #if defined(SUPPORT_MTP_DEVICE_FILESYSTEM) |
| 144 // Only accessed on the UI thread. | 144 // Only accessed on the UI thread. |
| 145 MTPDeviceDelegateMap mtp_delegate_map_; | 145 MTPDeviceDelegateMap mtp_delegate_map_; |
| 146 #endif | 146 #endif |
| 147 | 147 |
| 148 scoped_ptr<MediaFileSystemContext> file_system_context_; | 148 scoped_ptr<MediaFileSystemContext> file_system_context_; |
| 149 | 149 |
| 150 DISALLOW_COPY_AND_ASSIGN(MediaFileSystemRegistry); | 150 DISALLOW_COPY_AND_ASSIGN(MediaFileSystemRegistry); |
| 151 }; | 151 }; |
| 152 | 152 |
| 153 } // namespace chrome | 153 } // namespace chrome |
| 154 | 154 |
| 155 #endif // CHROME_BROWSER_MEDIA_GALLERY_MEDIA_FILE_SYSTEM_REGISTRY_H_ | 155 #endif // CHROME_BROWSER_MEDIA_GALLERY_MEDIA_FILE_SYSTEM_REGISTRY_H_ |
| OLD | NEW |