| 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 455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 466 | 466 |
| 467 // Create an empty entry so the initialization code below only gets called | 467 // Create an empty entry so the initialization code below only gets called |
| 468 // once per profile. | 468 // once per profile. |
| 469 extension_hosts_map_[profile] = ExtensionHostMap(); | 469 extension_hosts_map_[profile] = ExtensionHostMap(); |
| 470 | 470 |
| 471 // TODO(gbillock): Move this stanza to MediaGalleriesPreferences init code. | 471 // TODO(gbillock): Move this stanza to MediaGalleriesPreferences init code. |
| 472 // StorageMonitor may be NULL in unit tests. | 472 // StorageMonitor may be NULL in unit tests. |
| 473 StorageMonitor* monitor = StorageMonitor::GetInstance(); | 473 StorageMonitor* monitor = StorageMonitor::GetInstance(); |
| 474 if (!monitor) | 474 if (!monitor) |
| 475 return preferences; | 475 return preferences; |
| 476 std::vector<StorageInfo> existing_devices = monitor->GetAttachedStorage(); | 476 std::vector<StorageInfo> existing_devices = |
| 477 monitor->GetAttachedRemovableStorages(); |
| 477 for (size_t i = 0; i < existing_devices.size(); i++) { | 478 for (size_t i = 0; i < existing_devices.size(); i++) { |
| 478 if (!StorageInfo::IsMediaDevice(existing_devices[i].device_id())) | 479 if (!StorageInfo::IsMediaDevice(existing_devices[i].device_id())) |
| 479 continue; | 480 continue; |
| 480 if (!existing_devices[i].name().empty()) { | 481 if (!existing_devices[i].name().empty()) { |
| 481 preferences->AddGalleryWithName(existing_devices[i].device_id(), | 482 preferences->AddGalleryWithName(existing_devices[i].device_id(), |
| 482 existing_devices[i].name(), | 483 existing_devices[i].name(), |
| 483 base::FilePath(), | 484 base::FilePath(), |
| 484 false /*not user added*/); | 485 false /*not user added*/); |
| 485 } else { | 486 } else { |
| 486 preferences->AddGallery(existing_devices[i].device_id(), | 487 preferences->AddGallery(existing_devices[i].device_id(), |
| (...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 730 // previously used. | 731 // previously used. |
| 731 PrefChangeRegistrarMap::iterator pref_it = | 732 PrefChangeRegistrarMap::iterator pref_it = |
| 732 pref_change_registrar_map_.find(profile); | 733 pref_change_registrar_map_.find(profile); |
| 733 DCHECK(pref_it != pref_change_registrar_map_.end()); | 734 DCHECK(pref_it != pref_change_registrar_map_.end()); |
| 734 delete pref_it->second; | 735 delete pref_it->second; |
| 735 pref_change_registrar_map_.erase(pref_it); | 736 pref_change_registrar_map_.erase(pref_it); |
| 736 } | 737 } |
| 737 } | 738 } |
| 738 | 739 |
| 739 } // namespace chrome | 740 } // namespace chrome |
| OLD | NEW |