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

Unified Diff: chrome/browser/media_galleries/media_galleries_dialog_controller.cc

Issue 14556015: [Media Galleries] Lazily initialize the storage monitor. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Fix merge 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_galleries_dialog_controller.cc
diff --git a/chrome/browser/media_galleries/media_galleries_dialog_controller.cc b/chrome/browser/media_galleries/media_galleries_dialog_controller.cc
index 2476df9a48ce9597031faffb19aea688af30d713..0dfe3b7dbf10dc3647c14a92e310e64dbf629688 100644
--- a/chrome/browser/media_galleries/media_galleries_dialog_controller.cc
+++ b/chrome/browser/media_galleries/media_galleries_dialog_controller.cc
@@ -98,10 +98,19 @@ MediaGalleriesDialogController::MediaGalleriesDialogController(
: web_contents_(web_contents),
extension_(&extension),
on_finish_(on_finish) {
+ // Passing unretained pointer is safe, since the dialog controller
+ // is self-deleting, and so won't be deleted until it can be shown
+ // and then closed.
+ StorageMonitor::GetInstance()->Initialize(base::Bind(
+ &MediaGalleriesDialogController::OnStorageMonitorInitialized,
+ base::Unretained(this)));
+}
+
+void MediaGalleriesDialogController::OnStorageMonitorInitialized() {
MediaFileSystemRegistry* registry =
g_browser_process->media_file_system_registry();
preferences_ = registry->GetPreferences(
- Profile::FromBrowserContext(web_contents->GetBrowserContext()));
+ Profile::FromBrowserContext(web_contents_->GetBrowserContext()));
InitializePermissions();
dialog_.reset(MediaGalleriesDialog::Create(this));

Powered by Google App Engine
This is Rietveld 408576698