diff options
author | thestig@chromium.org <thestig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-10-16 21:15:25 +0000 |
---|---|---|
committer | thestig@chromium.org <thestig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-10-16 21:15:25 +0000 |
commit | 0ce203793a8481d8f7b4849f1e610f496133065b (patch) | |
tree | d07099db4b354a2b52a7af4e8cb4118cba07fbee /chrome/browser/extensions | |
parent | ad0655372571681cc502756e97fb930b93bc4d05 (diff) | |
download | chromium_src-0ce203793a8481d8f7b4849f1e610f496133065b.zip chromium_src-0ce203793a8481d8f7b4849f1e610f496133065b.tar.gz chromium_src-0ce203793a8481d8f7b4849f1e610f496133065b.tar.bz2 |
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
Diffstat (limited to 'chrome/browser/extensions')
-rw-r--r-- | chrome/browser/extensions/api/media_galleries_private/media_galleries_private_event_router.cc | 11 |
1 files changed, 10 insertions, 1 deletions
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<base::SystemMonitor::RemovableStorageInfo> 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() { |