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

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: Adjustments 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..3f8daeebdc5127d3136b0f4e096f2d0092b044c6 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,17 +74,10 @@ 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,
vandebo (ex-Chrome) 2013/05/22 21:40:34 why?
Greg Billock 2013/05/23 00:55:59 Needed to make a RenderViewHostObserver
+ 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.
- // Called on the UI thread.
- MediaGalleriesPreferences* GetPreferences(Profile* profile);
-
// RemovableStorageObserver implementation.
virtual void OnRemovableStorageDetached(const StorageInfo& info) OVERRIDE;
@@ -92,10 +86,24 @@ class MediaFileSystemRegistry : public RemovableStorageObserver {
// See TransientDeviceIds::GetTransientIdForDeviceId().
uint64 GetTransientIdForDeviceId(const std::string& device_id);
+ // 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.
+ // 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/22 21:40:34 I think you want to undo the changes here.
Greg Billock 2013/05/23 00:55:59 Done, but the comment is edited somewhat. Put it b
+
private:
friend class TestMediaFileSystemContext;
class MediaFileSystemContextImpl;
+ // Bottom half of |GetMediaFileSystemsForExtension|. Called when the
+ // storage monitor is fully initialized.
+ void GetMediaFileSystemsPostInit(const content::RenderViewHost* rvh,
vandebo (ex-Chrome) 2013/05/22 21:40:34 I guess this plus the dialog controller is a narro
Greg Billock 2013/05/23 00:55:59 Oh, I see what you're saying. Hmmm. Let me think a
+ 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