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

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: 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_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 56243441a859c7a2fbf6d1202add9d090952a82f..cdc075585ffc7f5083eac29b15b0c82b1ab8e9ac 100644
--- a/chrome/browser/media_galleries/media_galleries_dialog_controller.cc
+++ b/chrome/browser/media_galleries/media_galleries_dialog_controller.cc
@@ -98,11 +98,18 @@ MediaGalleriesDialogController::MediaGalleriesDialogController(
const base::Closure& on_finish)
: web_contents_(web_contents),
extension_(&extension),
- on_finish_(on_finish) {
+ on_finish_(on_finish),
+ weak_ptr_factory_(this) {
+ StorageMonitor::GetInstance()->Initialize(base::Bind(
+ &MediaGalleriesDialogController::OnStorageMonitorInitialized,
+ weak_ptr_factory_.GetWeakPtr()));
+}
+
+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));
@@ -117,7 +124,8 @@ MediaGalleriesDialogController::MediaGalleriesDialogController(
MediaGalleriesDialogController::MediaGalleriesDialogController()
: web_contents_(NULL),
extension_(NULL),
- preferences_(NULL) {}
+ preferences_(NULL),
+ weak_ptr_factory_(this) {}
vandebo (ex-Chrome) 2013/05/22 21:40:34 Controller is self owned (see media_galleries/medi
Greg Billock 2013/05/23 00:55:59 Done.
MediaGalleriesDialogController::~MediaGalleriesDialogController() {
StorageMonitor* monitor = StorageMonitor::GetInstance();

Powered by Google App Engine
This is Rietveld 408576698