| 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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 // The instance is lazily created per browser process. | 83 // The instance is lazily created per browser process. |
| 84 static MediaFileSystemRegistry* GetInstance(); | 84 static MediaFileSystemRegistry* GetInstance(); |
| 85 | 85 |
| 86 // Passes to |callback| the list of media filesystem IDs and paths for a | 86 // Passes to |callback| the list of media filesystem IDs and paths for a |
| 87 // given RVH. Called on the UI thread. | 87 // given RVH. Called on the UI thread. |
| 88 void GetMediaFileSystemsForExtension( | 88 void GetMediaFileSystemsForExtension( |
| 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 // Returns the initialized media galleries preferences for the specified |
| 94 // |profile|. This method should be used instead of calling |
| 95 // MediaGalleriesPreferences directly because this method also ensures that |
| 96 // currently attached removable devices are added to the preferences. |
| 97 // Called on the UI thread. |
| 98 MediaGalleriesPreferences* GetPreferences(Profile* profile); |
| 99 |
| 93 // base::SystemMonitor::DevicesChangedObserver implementation. | 100 // base::SystemMonitor::DevicesChangedObserver implementation. |
| 94 virtual void OnRemovableStorageAttached( | 101 virtual void OnRemovableStorageAttached( |
| 95 const std::string& id, const string16& name, | 102 const std::string& id, const string16& name, |
| 96 const FilePath::StringType& location) OVERRIDE; | 103 const FilePath::StringType& location) OVERRIDE; |
| 97 virtual void OnRemovableStorageDetached(const std::string& id) OVERRIDE; | 104 virtual void OnRemovableStorageDetached(const std::string& id) OVERRIDE; |
| 98 | 105 |
| 99 private: | 106 private: |
| 100 friend struct base::DefaultLazyInstanceTraits<MediaFileSystemRegistry>; | 107 friend struct base::DefaultLazyInstanceTraits<MediaFileSystemRegistry>; |
| 101 class MediaFileSystemContextImpl; | 108 class MediaFileSystemContextImpl; |
| 102 | 109 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 122 // Returns ScopedMtpDeviceMapEntry object for the given |device_location|. | 129 // Returns ScopedMtpDeviceMapEntry object for the given |device_location|. |
| 123 ScopedMtpDeviceMapEntry* GetOrCreateScopedMtpDeviceMapEntry( | 130 ScopedMtpDeviceMapEntry* GetOrCreateScopedMtpDeviceMapEntry( |
| 124 const FilePath::StringType& device_location); | 131 const FilePath::StringType& device_location); |
| 125 | 132 |
| 126 // Removes the ScopedMtpDeviceMapEntry associated with the given | 133 // Removes the ScopedMtpDeviceMapEntry associated with the given |
| 127 // |device_location|. | 134 // |device_location|. |
| 128 void RemoveScopedMtpDeviceMapEntry( | 135 void RemoveScopedMtpDeviceMapEntry( |
| 129 const FilePath::StringType& device_location); | 136 const FilePath::StringType& device_location); |
| 130 #endif | 137 #endif |
| 131 | 138 |
| 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, | 139 void OnExtensionGalleriesHostEmpty(Profile* profile, |
| 137 const std::string& extension_id); | 140 const std::string& extension_id); |
| 138 | 141 |
| 139 // Only accessed on the UI thread. This map owns all the | 142 // Only accessed on the UI thread. This map owns all the |
| 140 // ExtensionGalleriesHost objects created. | 143 // ExtensionGalleriesHost objects created. |
| 141 ExtensionGalleriesHostMap extension_hosts_map_; | 144 ExtensionGalleriesHostMap extension_hosts_map_; |
| 142 | 145 |
| 143 #if defined(SUPPORT_MTP_DEVICE_FILESYSTEM) | 146 #if defined(SUPPORT_MTP_DEVICE_FILESYSTEM) |
| 144 // Only accessed on the UI thread. | 147 // Only accessed on the UI thread. |
| 145 MTPDeviceDelegateMap mtp_delegate_map_; | 148 MTPDeviceDelegateMap mtp_delegate_map_; |
| 146 #endif | 149 #endif |
| 147 | 150 |
| 148 scoped_ptr<MediaFileSystemContext> file_system_context_; | 151 scoped_ptr<MediaFileSystemContext> file_system_context_; |
| 149 | 152 |
| 150 DISALLOW_COPY_AND_ASSIGN(MediaFileSystemRegistry); | 153 DISALLOW_COPY_AND_ASSIGN(MediaFileSystemRegistry); |
| 151 }; | 154 }; |
| 152 | 155 |
| 153 } // namespace chrome | 156 } // namespace chrome |
| 154 | 157 |
| 155 #endif // CHROME_BROWSER_MEDIA_GALLERY_MEDIA_FILE_SYSTEM_REGISTRY_H_ | 158 #endif // CHROME_BROWSER_MEDIA_GALLERY_MEDIA_FILE_SYSTEM_REGISTRY_H_ |
| OLD | NEW |