From 0ce203793a8481d8f7b4849f1e610f496133065b Mon Sep 17 00:00:00 2001 From: "thestig@chromium.org" Date: Tue, 16 Oct 2012 21:15:25 +0000 Subject: Media Galleries: Initialize the internal state of MediaGalleriesPrivateEventRouter with the list of already attached storage devices. BUG=156024 Review URL: https://chromiumcodereview.appspot.com/11164003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@162251 0039d316-1c4b-4281-b951-d872f2087c98 --- .../media_galleries_private_event_router.cc | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'chrome/browser/extensions') diff --git a/chrome/browser/extensions/api/media_galleries_private/media_galleries_private_event_router.cc b/chrome/browser/extensions/api/media_galleries_private/media_galleries_private_event_router.cc index 06691e5..bdd2032 100644 --- a/chrome/browser/extensions/api/media_galleries_private/media_galleries_private_event_router.cc +++ b/chrome/browser/extensions/api/media_galleries_private/media_galleries_private_event_router.cc @@ -88,8 +88,17 @@ MediaGalleriesPrivateEventRouter::MediaGalleriesPrivateEventRouter( Profile* profile) : profile_(profile) { base::SystemMonitor* system_monitor = base::SystemMonitor::Get(); - if (system_monitor) + if (system_monitor) { system_monitor->AddDevicesChangedObserver(this); + + // Add the devices that were already present before + // MediaGalleriesPrivateEventRouter creation. + std::vector storage_info = + system_monitor->GetAttachedRemovableStorage(); + TransientDeviceIds* device_ids = TransientDeviceIds::GetInstance(); + for (size_t i = 0; i < storage_info.size(); ++i) + device_ids->DeviceAttached(storage_info[i].device_id); + } } MediaGalleriesPrivateEventRouter::~MediaGalleriesPrivateEventRouter() { -- cgit v1.1