Chromium Code Reviews| Index: chrome/browser/media_galleries/media_file_system_registry.h |
| diff --git a/chrome/browser/media_galleries/media_file_system_registry.h b/chrome/browser/media_galleries/media_file_system_registry.h |
| index 6843c3a0f87826bfbae243f8c4512987ddb54626..4d7eb92d150fe6467ca8b00ef17097d0a24695b0 100644 |
| --- a/chrome/browser/media_galleries/media_file_system_registry.h |
| +++ b/chrome/browser/media_galleries/media_file_system_registry.h |
| @@ -16,6 +16,7 @@ |
| #include "base/basictypes.h" |
| #include "base/files/file_path.h" |
| #include "base/memory/ref_counted.h" |
| +#include "base/memory/weak_ptr.h" |
| #include "base/prefs/pref_change_registrar.h" |
| #include "chrome/browser/media_galleries/fileapi/mtp_device_file_system_config.h" |
| #include "chrome/browser/media_galleries/media_galleries_preferences.h" |
| @@ -81,12 +82,16 @@ class MediaFileSystemRegistry : public RemovableStorageObserver { |
| const extensions::Extension* extension, |
| const MediaFileSystemsCallback& callback); |
| - // Returns the initialized media galleries preferences for the specified |
| - // |profile|. This method should be used instead of calling |
| + // Call the given callback with preferences. This is asynchronous so that |
| + // StorageMonitor may be initialized lazily in order to set up the returned |
| + // preferences. |
| + // This method should be used instead of calling |
| // MediaGalleriesPreferences directly because this method also ensures that |
| // currently attached removable devices are added to the preferences. |
| // Called on the UI thread. |
| - MediaGalleriesPreferences* GetPreferences(Profile* profile); |
| + void GetPreferencesAsync( |
|
vandebo (ex-Chrome)
2013/05/17 22:19:58
nit picky: maybe leave this name the same and rena
Greg Billock
2013/05/18 06:28:40
Fiddled this with the new interface.
|
| + Profile* profile, |
| + base::Callback<void(MediaGalleriesPreferences*)> callback); |
| // RemovableStorageObserver implementation. |
| virtual void OnRemovableStorageDetached(const StorageInfo& info) OVERRIDE; |
| @@ -100,6 +105,21 @@ class MediaFileSystemRegistry : public RemovableStorageObserver { |
| friend class TestMediaFileSystemContext; |
| class MediaFileSystemContextImpl; |
| + MediaGalleriesPreferences* GetPreferences(Profile* profile); |
| + |
| + // Bottom half of |GetMediaFileSystemsForExtensions|, called after the |
| + // StorageMonitor is initialized. |
| + void GetMediaFileSystemsPostStorageMonitorInit( |
|
vandebo (ex-Chrome)
2013/05/17 22:19:58
GetMediaFileSystemsWithPreferences ?
Greg Billock
2013/05/18 06:28:40
Done.
|
| + const content::RenderViewHost* rvh, |
| + const extensions::Extension* extension, |
| + const MediaFileSystemsCallback& callback, |
| + MediaGalleriesPreferences* preferences); |
| + |
| + // Notify the registry when the storage monitor has been initialized. |
| + void OnStorageMonitorInitialized( |
| + Profile* profile, |
| + base::Callback<void(MediaGalleriesPreferences*)> callback); |
| + |
| // Map an extension to the ExtensionGalleriesHost. |
| typedef std::map<std::string /*extension_id*/, |
| scoped_refptr<ExtensionGalleriesHost> > ExtensionHostMap; |
| @@ -145,6 +165,8 @@ class MediaFileSystemRegistry : public RemovableStorageObserver { |
| scoped_ptr<MediaFileSystemContext> file_system_context_; |
| + base::WeakPtrFactory<MediaFileSystemRegistry> weak_ptr_factory_; |
| + |
| DISALLOW_COPY_AND_ASSIGN(MediaFileSystemRegistry); |
| }; |