Index: chrome/browser/ui/webui/options/media_galleries_handler.cc |
diff --git a/chrome/browser/ui/webui/options/media_galleries_handler.cc b/chrome/browser/ui/webui/options/media_galleries_handler.cc |
index 982aaeb2aa5c9a0f0b4f5e0278f870a58431c884..0a676f6a6fb25541a8a4d2f7701bc85c320a6292 100644 |
--- a/chrome/browser/ui/webui/options/media_galleries_handler.cc |
+++ b/chrome/browser/ui/webui/options/media_galleries_handler.cc |
@@ -47,12 +47,15 @@ void MediaGalleriesHandler::GetLocalizedValues(DictionaryValue* values) { |
} |
void MediaGalleriesHandler::InitializePage() { |
- StorageMonitor::GetInstance()->EnsureInitialized( |
- base::Bind(&MediaGalleriesHandler::InitializeOnStorageMonitorInit, |
- weak_ptr_factory_.GetWeakPtr())); |
+ Profile* profile = Profile::FromWebUI(web_ui()); |
+ MediaGalleriesPreferences* preferences = |
+ g_browser_process->media_file_system_registry()->GetPreferences(profile); |
+ preferences->EnsureInitialized(base::Bind( |
+ &MediaGalleriesHandler::InitializeOnMediaGalleriesPreferencesInit, |
+ weak_ptr_factory_.GetWeakPtr())); |
} |
-void MediaGalleriesHandler::InitializeOnStorageMonitorInit() { |
+void MediaGalleriesHandler::InitializeOnMediaGalleriesPreferencesInit() { |
Profile* profile = Profile::FromWebUI(web_ui()); |
if (!MediaGalleriesPreferences::APIHasBeenUsed(profile)) |
return; |
@@ -90,6 +93,7 @@ void MediaGalleriesHandler::OnGalleriesChanged() { |
Profile* profile = Profile::FromWebUI(web_ui()); |
MediaGalleriesPreferences* preferences = |
g_browser_process->media_file_system_registry()->GetPreferences(profile); |
+ DCHECK(preferences->IsInitialized()); |
ListValue list; |
const MediaGalleriesPrefInfoMap& galleries = preferences->known_galleries(); |
@@ -138,6 +142,7 @@ void MediaGalleriesHandler::HandleForgetGallery(const base::ListValue* args) { |
MediaGalleriesPreferences* preferences = |
g_browser_process->media_file_system_registry()->GetPreferences( |
Profile::FromWebUI(web_ui())); |
+ DCHECK(preferences->IsInitialized()); |
preferences->ForgetGalleryById(id); |
} |
@@ -148,6 +153,7 @@ void MediaGalleriesHandler::FileSelected(const base::FilePath& path, |
MediaGalleriesPreferences* preferences = |
g_browser_process->media_file_system_registry()->GetPreferences( |
Profile::FromWebUI(web_ui())); |
+ DCHECK(preferences->IsInitialized()); |
preferences->AddGalleryByPath(path); |
} |