Chromium Code Reviews| 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|. Registers all the media devices found in system monitor as | |
|
vandebo (ex-Chrome)
2012/10/29 21:15:17
nit: |profile|. This method should be used instea
kmadhusu
2012/10/29 21:23:35
Done.
| |
| 95 // auto-detected galleries if required. Called on the UI thread. | |
| 96 MediaGalleriesPreferences* GetProfilePreferences(Profile* profile); | |
|
vandebo (ex-Chrome)
2012/10/29 21:15:17
GetPreferences
kmadhusu
2012/10/29 21:23:35
Done.
| |
| 97 | |
| 93 // base::SystemMonitor::DevicesChangedObserver implementation. | 98 // base::SystemMonitor::DevicesChangedObserver implementation. |
| 94 virtual void OnRemovableStorageAttached( | 99 virtual void OnRemovableStorageAttached( |
| 95 const std::string& id, const string16& name, | 100 const std::string& id, const string16& name, |
| 96 const FilePath::StringType& location) OVERRIDE; | 101 const FilePath::StringType& location) OVERRIDE; |
| 97 virtual void OnRemovableStorageDetached(const std::string& id) OVERRIDE; | 102 virtual void OnRemovableStorageDetached(const std::string& id) OVERRIDE; |
| 98 | 103 |
| 99 private: | 104 private: |
| 100 friend struct base::DefaultLazyInstanceTraits<MediaFileSystemRegistry>; | 105 friend struct base::DefaultLazyInstanceTraits<MediaFileSystemRegistry>; |
| 101 class MediaFileSystemContextImpl; | 106 class MediaFileSystemContextImpl; |
| 102 | 107 |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 122 // Returns ScopedMtpDeviceMapEntry object for the given |device_location|. | 127 // Returns ScopedMtpDeviceMapEntry object for the given |device_location|. |
| 123 ScopedMtpDeviceMapEntry* GetOrCreateScopedMtpDeviceMapEntry( | 128 ScopedMtpDeviceMapEntry* GetOrCreateScopedMtpDeviceMapEntry( |
| 124 const FilePath::StringType& device_location); | 129 const FilePath::StringType& device_location); |
| 125 | 130 |
| 126 // Removes the ScopedMtpDeviceMapEntry associated with the given | 131 // Removes the ScopedMtpDeviceMapEntry associated with the given |
| 127 // |device_location|. | 132 // |device_location|. |
| 128 void RemoveScopedMtpDeviceMapEntry( | 133 void RemoveScopedMtpDeviceMapEntry( |
| 129 const FilePath::StringType& device_location); | 134 const FilePath::StringType& device_location); |
| 130 #endif | 135 #endif |
| 131 | 136 |
| 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, | 137 void OnExtensionGalleriesHostEmpty(Profile* profile, |
| 137 const std::string& extension_id); | 138 const std::string& extension_id); |
| 138 | 139 |
| 139 // Only accessed on the UI thread. This map owns all the | 140 // Only accessed on the UI thread. This map owns all the |
| 140 // ExtensionGalleriesHost objects created. | 141 // ExtensionGalleriesHost objects created. |
| 141 ExtensionGalleriesHostMap extension_hosts_map_; | 142 ExtensionGalleriesHostMap extension_hosts_map_; |
| 142 | 143 |
| 143 #if defined(SUPPORT_MTP_DEVICE_FILESYSTEM) | 144 #if defined(SUPPORT_MTP_DEVICE_FILESYSTEM) |
| 144 // Only accessed on the UI thread. | 145 // Only accessed on the UI thread. |
| 145 MTPDeviceDelegateMap mtp_delegate_map_; | 146 MTPDeviceDelegateMap mtp_delegate_map_; |
| 146 #endif | 147 #endif |
| 147 | 148 |
| 148 scoped_ptr<MediaFileSystemContext> file_system_context_; | 149 scoped_ptr<MediaFileSystemContext> file_system_context_; |
| 149 | 150 |
| 150 DISALLOW_COPY_AND_ASSIGN(MediaFileSystemRegistry); | 151 DISALLOW_COPY_AND_ASSIGN(MediaFileSystemRegistry); |
| 151 }; | 152 }; |
| 152 | 153 |
| 153 } // namespace chrome | 154 } // namespace chrome |
| 154 | 155 |
| 156 | |
| 155 #endif // CHROME_BROWSER_MEDIA_GALLERY_MEDIA_FILE_SYSTEM_REGISTRY_H_ | 157 #endif // CHROME_BROWSER_MEDIA_GALLERY_MEDIA_FILE_SYSTEM_REGISTRY_H_ |
| OLD | NEW |