| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // MediaFileSystemRegistry implementation. | 5 // MediaFileSystemRegistry implementation. |
| 6 | 6 |
| 7 #include "chrome/browser/media_galleries/media_file_system_registry.h" | 7 #include "chrome/browser/media_galleries/media_file_system_registry.h" |
| 8 | 8 |
| 9 #include <set> | 9 #include <set> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 458 MediaGalleriesPreferencesFactory::GetForProfile(profile); | 458 MediaGalleriesPreferencesFactory::GetForProfile(profile); |
| 459 if (ContainsKey(extension_hosts_map_, profile)) | 459 if (ContainsKey(extension_hosts_map_, profile)) |
| 460 return preferences; | 460 return preferences; |
| 461 | 461 |
| 462 // Create an empty entry so the initialization code below only gets called | 462 // Create an empty entry so the initialization code below only gets called |
| 463 // once per profile. | 463 // once per profile. |
| 464 extension_hosts_map_[profile] = ExtensionHostMap(); | 464 extension_hosts_map_[profile] = ExtensionHostMap(); |
| 465 | 465 |
| 466 // TODO(gbillock): Move this stanza to MediaGalleriesPreferences init code. | 466 // TODO(gbillock): Move this stanza to MediaGalleriesPreferences init code. |
| 467 StorageMonitor* monitor = StorageMonitor::GetInstance(); | 467 StorageMonitor* monitor = StorageMonitor::GetInstance(); |
| 468 std::vector<StorageInfo> existing_devices = monitor->GetAttachedStorage(); | 468 std::vector<StorageInfo> existing_devices = |
| 469 monitor->GetAllAvailableStorages(); |
| 469 for (size_t i = 0; i < existing_devices.size(); i++) { | 470 for (size_t i = 0; i < existing_devices.size(); i++) { |
| 470 if (!StorageInfo::IsMediaDevice(existing_devices[i].device_id())) | 471 if (!(StorageInfo::IsMediaDevice(existing_devices[i].device_id()) && |
| 472 StorageInfo::IsRemovableDevice(existing_devices[i].device_id()))) |
| 471 continue; | 473 continue; |
| 472 if (!existing_devices[i].name().empty()) { | 474 if (!existing_devices[i].name().empty()) { |
| 473 preferences->AddGalleryWithName(existing_devices[i].device_id(), | 475 preferences->AddGalleryWithName(existing_devices[i].device_id(), |
| 474 existing_devices[i].name(), | 476 existing_devices[i].name(), |
| 475 base::FilePath(), | 477 base::FilePath(), |
| 476 false /*not user added*/); | 478 false /*not user added*/); |
| 477 } else { | 479 } else { |
| 478 preferences->AddGallery(existing_devices[i].device_id(), | 480 preferences->AddGallery(existing_devices[i].device_id(), |
| 479 base::FilePath(), | 481 base::FilePath(), |
| 480 false, | 482 false, |
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 705 // previously used. | 707 // previously used. |
| 706 PrefChangeRegistrarMap::iterator pref_it = | 708 PrefChangeRegistrarMap::iterator pref_it = |
| 707 pref_change_registrar_map_.find(profile); | 709 pref_change_registrar_map_.find(profile); |
| 708 DCHECK(pref_it != pref_change_registrar_map_.end()); | 710 DCHECK(pref_it != pref_change_registrar_map_.end()); |
| 709 delete pref_it->second; | 711 delete pref_it->second; |
| 710 pref_change_registrar_map_.erase(pref_it); | 712 pref_change_registrar_map_.erase(pref_it); |
| 711 } | 713 } |
| 712 } | 714 } |
| 713 | 715 |
| 714 } // namespace chrome | 716 } // namespace chrome |
| OLD | NEW |