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

Side by Side 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: Windows compile tweaks 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 unified diff | Download patch
OLDNEW
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_GALLERIES_MEDIA_FILE_SYSTEM_REGISTRY_H_ 8 #ifndef CHROME_BROWSER_MEDIA_GALLERIES_MEDIA_FILE_SYSTEM_REGISTRY_H_
9 #define CHROME_BROWSER_MEDIA_GALLERIES_MEDIA_FILE_SYSTEM_REGISTRY_H_ 9 #define CHROME_BROWSER_MEDIA_GALLERIES_MEDIA_FILE_SYSTEM_REGISTRY_H_
10 10
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 MediaFileSystemRegistry(); 74 MediaFileSystemRegistry();
75 virtual ~MediaFileSystemRegistry(); 75 virtual ~MediaFileSystemRegistry();
76 76
77 // Passes to |callback| the list of media filesystem IDs and paths for a 77 // Passes to |callback| the list of media filesystem IDs and paths for a
78 // given RVH. Called on the UI thread. 78 // given RVH. Called on the UI thread.
79 void GetMediaFileSystemsForExtension( 79 void GetMediaFileSystemsForExtension(
80 const content::RenderViewHost* rvh, 80 const content::RenderViewHost* rvh,
81 const extensions::Extension* extension, 81 const extensions::Extension* extension,
82 const MediaFileSystemsCallback& callback); 82 const MediaFileSystemsCallback& callback);
83 83
84 // Bottom half of |GetMediaFileSystemsForExtensions|, called after we
Lei Zhang 2013/05/10 05:24:43 nit: drop the we.
Greg Billock 2013/05/10 16:20:27 Done.
85 // make sure that the StorageMonitor is initialized.
86 void GetMediaFileSystemsPostStorageMonitorInit(
Lei Zhang 2013/05/10 05:24:43 Also private.
Greg Billock 2013/05/10 16:20:27 Done.
87 const content::RenderViewHost* rvh,
88 const extensions::Extension* extension,
89 const MediaFileSystemsCallback& callback,
90 MediaGalleriesPreferences* preferences);
91
84 // Returns the initialized media galleries preferences for the specified 92 // Returns the initialized media galleries preferences for the specified
85 // |profile|. This method should be used instead of calling 93 // |profile|. This method should be used instead of calling
86 // MediaGalleriesPreferences directly because this method also ensures that 94 // MediaGalleriesPreferences directly because this method also ensures that
87 // currently attached removable devices are added to the preferences. 95 // currently attached removable devices are added to the preferences.
88 // Called on the UI thread. 96 // Called on the UI thread. Do not call from outside this class.
89 MediaGalleriesPreferences* GetPreferences(Profile* profile); 97 MediaGalleriesPreferences* GetPreferences(Profile* profile);
90 98
99 // Notify the registry when the storage monitor has been initialized.
100 void OnStorageMonitorInitialized(
Lei Zhang 2013/05/10 05:24:43 also private.
Greg Billock 2013/05/10 16:20:27 Done.
101 Profile* profile,
102 base::Callback<void(MediaGalleriesPreferences*)> callback);
103
104 // Call the given callback with preferences. This is asynchronous so that
105 // StorageMonitor may be initialized lazily in order to set up the returned
106 // preferences.
107 void GetPreferencesAsync(
108 Profile* profile,
109 base::Callback<void(MediaGalleriesPreferences*)> callback);
110
91 // RemovableStorageObserver implementation. 111 // RemovableStorageObserver implementation.
92 virtual void OnRemovableStorageDetached(const StorageInfo& info) OVERRIDE; 112 virtual void OnRemovableStorageDetached(const StorageInfo& info) OVERRIDE;
93 113
94 size_t GetExtensionGalleriesHostCountForTests() const; 114 size_t GetExtensionGalleriesHostCountForTests() const;
95 115
96 // See TransientDeviceIds::GetTransientIdForDeviceId(). 116 // See TransientDeviceIds::GetTransientIdForDeviceId().
97 uint64 GetTransientIdForDeviceId(const std::string& device_id); 117 uint64 GetTransientIdForDeviceId(const std::string& device_id);
98 118
99 private: 119 private:
100 friend class TestMediaFileSystemContext; 120 friend class TestMediaFileSystemContext;
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 #endif 164 #endif
145 165
146 scoped_ptr<MediaFileSystemContext> file_system_context_; 166 scoped_ptr<MediaFileSystemContext> file_system_context_;
147 167
148 DISALLOW_COPY_AND_ASSIGN(MediaFileSystemRegistry); 168 DISALLOW_COPY_AND_ASSIGN(MediaFileSystemRegistry);
149 }; 169 };
150 170
151 } // namespace chrome 171 } // namespace chrome
152 172
153 #endif // CHROME_BROWSER_MEDIA_GALLERIES_MEDIA_FILE_SYSTEM_REGISTRY_H_ 173 #endif // CHROME_BROWSER_MEDIA_GALLERIES_MEDIA_FILE_SYSTEM_REGISTRY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698