| 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 4687e7d6951cfb270dfddeabac2849dcb644fe07..6c95e67241cdb91b26f6052304ff2c27e4b80d0a 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/media_galleries_preferences.h"
|
| #include "chrome/browser/media_galleries/mtp_device_delegate_impl.h"
|
| @@ -65,7 +66,8 @@ struct MediaFileSystemInfo {
|
| typedef base::Callback<void(const std::vector<MediaFileSystemInfo>&)>
|
| MediaFileSystemsCallback;
|
|
|
| -class MediaFileSystemRegistry : public RemovableStorageObserver {
|
| +class MediaFileSystemRegistry : public RemovableStorageObserver,
|
| + public MediaGalleriesPreferences::Vendor {
|
| public:
|
| MediaFileSystemRegistry();
|
| virtual ~MediaFileSystemRegistry();
|
| @@ -73,16 +75,19 @@ class MediaFileSystemRegistry : public RemovableStorageObserver {
|
| // Passes to |callback| the list of media filesystem IDs and paths for a
|
| // given RVH. Called on the UI thread.
|
| void GetMediaFileSystemsForExtension(
|
| - const content::RenderViewHost* rvh,
|
| + content::RenderViewHost* rvh,
|
| 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 vendor.
|
| + // 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(
|
| + base::Callback<void(MediaGalleriesPreferences::Vendor*)> callback);
|
|
|
| // RemovableStorageObserver implementation.
|
| virtual void OnRemovableStorageDetached(const StorageInfo& info) OVERRIDE;
|
| @@ -92,10 +97,25 @@ class MediaFileSystemRegistry : public RemovableStorageObserver {
|
| // See TransientDeviceIds::GetTransientIdForDeviceId().
|
| uint64 GetTransientIdForDeviceId(const std::string& device_id);
|
|
|
| + // MediaGalleriesPreferences::Vendor
|
| + virtual MediaGalleriesPreferences* GetPreferences(Profile* profile) OVERRIDE;
|
| +
|
| private:
|
| friend class TestMediaFileSystemContext;
|
| class MediaFileSystemContextImpl;
|
|
|
| + // Bottom half of |GetMediaFileSystemsForExtensions|, called after the
|
| + // StorageMonitor is initialized.
|
| + void GetMediaFileSystemsWithPreferences(
|
| + const content::RenderViewHost* rvh,
|
| + const extensions::Extension* extension,
|
| + const MediaFileSystemsCallback& callback,
|
| + MediaGalleriesPreferences::Vendor* vendor);
|
| +
|
| + // Notify the registry when the storage monitor has been initialized.
|
| + void OnStorageMonitorInitialized(
|
| + base::Callback<void(MediaGalleriesPreferences::Vendor*)> callback);
|
| +
|
| // Map an extension to the ExtensionGalleriesHost.
|
| typedef std::map<std::string /*extension_id*/,
|
| scoped_refptr<ExtensionGalleriesHost> > ExtensionHostMap;
|
| @@ -135,6 +155,8 @@ class MediaFileSystemRegistry : public RemovableStorageObserver {
|
|
|
| scoped_ptr<MediaFileSystemContext> file_system_context_;
|
|
|
| + base::WeakPtrFactory<MediaFileSystemRegistry> weak_ptr_factory_;
|
| +
|
| DISALLOW_COPY_AND_ASSIGN(MediaFileSystemRegistry);
|
| };
|
|
|
|
|