Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(375)

Unified Diff: chrome/browser/media_galleries/media_file_system_registry.h

Issue 14556015: [Media Galleries] Lazily initialize the storage monitor. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Rebase on prefs Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..871f2b10d5d3a5bc6ad4a460393a0c2ebcc72318 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"
@@ -73,16 +74,17 @@ 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
- // MediaGalleriesPreferences directly because this method also ensures that
- // currently attached removable devices are added to the 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);
+ // Note: Caller must ensure that the storage monitor is initialized before
+ // calling this method.
+ virtual MediaGalleriesPreferences* GetPreferences(Profile* profile) OVERRIDE;
vandebo (ex-Chrome) 2013/05/23 15:04:17 Not an override. Does it need to be virtual?
Greg Billock 2013/05/30 22:17:47 Reverted this. (Was from the ::Vendor class I had
// RemovableStorageObserver implementation.
virtual void OnRemovableStorageDetached(const StorageInfo& info) OVERRIDE;
@@ -96,6 +98,12 @@ class MediaFileSystemRegistry : public RemovableStorageObserver {
friend class TestMediaFileSystemContext;
class MediaFileSystemContextImpl;
+ // Bottom half of |GetMediaFileSystemsForExtension|. Called when the
+ // storage monitor is fully initialized.
+ void GetMediaFileSystemsPostInit(const content::RenderViewHost* rvh,
+ const extensions::Extension* extension,
+ const MediaFileSystemsCallback& callback);
+
// Map an extension to the ExtensionGalleriesHost.
typedef std::map<std::string /*extension_id*/,
scoped_refptr<ExtensionGalleriesHost> > ExtensionHostMap;
@@ -135,6 +143,8 @@ class MediaFileSystemRegistry : public RemovableStorageObserver {
scoped_ptr<MediaFileSystemContext> file_system_context_;
+ base::WeakPtrFactory<MediaFileSystemRegistry> weak_ptr_factory_;
+
DISALLOW_COPY_AND_ASSIGN(MediaFileSystemRegistry);
};

Powered by Google App Engine
This is Rietveld 408576698