| 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 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 319 base::FilePath path = gallery_info.AbsolutePath(); | 319 base::FilePath path = gallery_info.AbsolutePath(); |
| 320 if (!MediaStorageUtil::CanCreateFileSystem(device_id, path)) | 320 if (!MediaStorageUtil::CanCreateFileSystem(device_id, path)) |
| 321 continue; | 321 continue; |
| 322 | 322 |
| 323 std::string fsid = | 323 std::string fsid = |
| 324 file_system_context_->RegisterFileSystem(device_id, path); | 324 file_system_context_->RegisterFileSystem(device_id, path); |
| 325 if (fsid.empty()) | 325 if (fsid.empty()) |
| 326 continue; | 326 continue; |
| 327 | 327 |
| 328 MediaFileSystemInfo new_entry( | 328 MediaFileSystemInfo new_entry( |
| 329 gallery_info.GetGalleryDisplayName(), | 329 MediaStorageUtil::GetGalleryDisplayNameFromPath( |
| 330 gallery_info.AbsolutePath()), |
| 330 path, | 331 path, |
| 331 fsid, | 332 fsid, |
| 332 pref_id, | 333 pref_id, |
| 333 GetTransientIdForRemovableDeviceId(device_id), | 334 GetTransientIdForRemovableDeviceId(device_id), |
| 334 StorageInfo::IsRemovableDevice(device_id), | 335 StorageInfo::IsRemovableDevice(device_id), |
| 335 StorageInfo::IsMediaDevice(device_id)); | 336 StorageInfo::IsMediaDevice(device_id)); |
| 336 result.push_back(new_entry); | 337 result.push_back(new_entry); |
| 337 new_galleries.insert(pref_id); | 338 new_galleries.insert(pref_id); |
| 338 pref_id_map_[pref_id] = new_entry; | 339 pref_id_map_[pref_id] = new_entry; |
| 339 } | 340 } |
| (...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 665 DCHECK_EQ(1U, erase_count); | 666 DCHECK_EQ(1U, erase_count); |
| 666 if (extension_hosts->second.empty()) { | 667 if (extension_hosts->second.empty()) { |
| 667 // When a profile has no ExtensionGalleriesHosts left, remove the | 668 // When a profile has no ExtensionGalleriesHosts left, remove the |
| 668 // matching gallery-change-watcher since it is no longer needed. Leave the | 669 // matching gallery-change-watcher since it is no longer needed. Leave the |
| 669 // |extension_hosts| entry alone, since it indicates the profile has been | 670 // |extension_hosts| entry alone, since it indicates the profile has been |
| 670 // previously used. | 671 // previously used. |
| 671 MediaGalleriesPreferences* preferences = GetPreferences(profile); | 672 MediaGalleriesPreferences* preferences = GetPreferences(profile); |
| 672 preferences->RemoveGalleryChangeObserver(this); | 673 preferences->RemoveGalleryChangeObserver(this); |
| 673 } | 674 } |
| 674 } | 675 } |
| OLD | NEW |