| 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_gallery/media_file_system_registry.h" | 7 #include "chrome/browser/media_gallery/media_file_system_registry.h" |
| 8 | 8 |
| 9 #include <set> | 9 #include <set> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 394 } else { | 394 } else { |
| 395 RevokeOldGalleries(new_galleries); | 395 RevokeOldGalleries(new_galleries); |
| 396 } | 396 } |
| 397 | 397 |
| 398 callback.Run(result); | 398 callback.Run(result); |
| 399 } | 399 } |
| 400 | 400 |
| 401 uint64 GetTransientIdForRemovableDeviceId(const std::string& device_id) { | 401 uint64 GetTransientIdForRemovableDeviceId(const std::string& device_id) { |
| 402 if (!MediaStorageUtil::IsRemovableDevice(device_id)) | 402 if (!MediaStorageUtil::IsRemovableDevice(device_id)) |
| 403 return 0; | 403 return 0; |
| 404 MediaFileSystemRegistry* registry = | 404 RemovableStorageNotifications* storage_notifications = |
| 405 file_system_context_->GetMediaFileSystemRegistry(); | 405 RemovableStorageNotifications::GetInstance(); |
| 406 return registry->GetTransientIdForDeviceId(device_id); | 406 return storage_notifications->GetTransientIdForDeviceId(device_id); |
| 407 } | 407 } |
| 408 | 408 |
| 409 // This code is deprecated and should be removed. See http://crbug.com/170138 | 409 // This code is deprecated and should be removed. See http://crbug.com/170138 |
| 410 // Make a JSON string out of |name|, |pref_id| and |device_id|. The IDs makes | 410 // Make a JSON string out of |name|, |pref_id| and |device_id|. The IDs makes |
| 411 // the combined name unique. The JSON string should not contain any slashes. | 411 // the combined name unique. The JSON string should not contain any slashes. |
| 412 std::string MakeJSONFileSystemName(const string16& name, | 412 std::string MakeJSONFileSystemName(const string16& name, |
| 413 const MediaGalleryPrefId& pref_id, | 413 const MediaGalleryPrefId& pref_id, |
| 414 const std::string& device_id) { | 414 const std::string& device_id) { |
| 415 string16 sanitized_name; | 415 string16 sanitized_name; |
| 416 string16 separators = | 416 string16 separators = |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 621 (*extension_host_it)->RevokeGalleryByPrefId(*pref_id_it); | 621 (*extension_host_it)->RevokeGalleryByPrefId(*pref_id_it); |
| 622 } | 622 } |
| 623 } | 623 } |
| 624 } | 624 } |
| 625 } | 625 } |
| 626 | 626 |
| 627 size_t MediaFileSystemRegistry::GetExtensionHostCountForTests() const { | 627 size_t MediaFileSystemRegistry::GetExtensionHostCountForTests() const { |
| 628 return extension_hosts_map_.size(); | 628 return extension_hosts_map_.size(); |
| 629 } | 629 } |
| 630 | 630 |
| 631 uint64 MediaFileSystemRegistry::GetTransientIdForDeviceId( | |
| 632 const std::string& device_id) { | |
| 633 return transient_device_ids_.GetTransientIdForDeviceId(device_id); | |
| 634 } | |
| 635 | |
| 636 /****************** | 631 /****************** |
| 637 * Private methods | 632 * Private methods |
| 638 ******************/ | 633 ******************/ |
| 639 | 634 |
| 640 class MediaFileSystemRegistry::MediaFileSystemContextImpl | 635 class MediaFileSystemRegistry::MediaFileSystemContextImpl |
| 641 : public MediaFileSystemContext { | 636 : public MediaFileSystemContext { |
| 642 public: | 637 public: |
| 643 explicit MediaFileSystemContextImpl(MediaFileSystemRegistry* registry) | 638 explicit MediaFileSystemContextImpl(MediaFileSystemRegistry* registry) |
| 644 : registry_(registry) { | 639 : registry_(registry) { |
| 645 DCHECK(registry_); // Suppresses unused warning on Android. | 640 DCHECK(registry_); // Suppresses unused warning on Android. |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 807 | 802 |
| 808 PrefChangeRegistrarMap::iterator pref_it = | 803 PrefChangeRegistrarMap::iterator pref_it = |
| 809 pref_change_registrar_map_.find(profile); | 804 pref_change_registrar_map_.find(profile); |
| 810 DCHECK(pref_it != pref_change_registrar_map_.end()); | 805 DCHECK(pref_it != pref_change_registrar_map_.end()); |
| 811 delete pref_it->second; | 806 delete pref_it->second; |
| 812 pref_change_registrar_map_.erase(pref_it); | 807 pref_change_registrar_map_.erase(pref_it); |
| 813 } | 808 } |
| 814 } | 809 } |
| 815 | 810 |
| 816 } // namespace chrome | 811 } // namespace chrome |
| OLD | NEW |