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 683 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
694 mtp_device_delegate_map_.find(device_location); | 694 mtp_device_delegate_map_.find(device_location); |
695 if (delegate_it != mtp_device_delegate_map_.end()) | 695 if (delegate_it != mtp_device_delegate_map_.end()) |
696 return delegate_it->second; | 696 return delegate_it->second; |
697 scoped_refptr<ScopedMTPDeviceMapEntry> mtp_device_host = | 697 scoped_refptr<ScopedMTPDeviceMapEntry> mtp_device_host = |
698 new ScopedMTPDeviceMapEntry( | 698 new ScopedMTPDeviceMapEntry( |
699 device_location, | 699 device_location, |
700 base::Bind(&MediaFileSystemRegistry::RemoveScopedMTPDeviceMapEntry, | 700 base::Bind(&MediaFileSystemRegistry::RemoveScopedMTPDeviceMapEntry, |
701 base::Unretained(this), | 701 base::Unretained(this), |
702 device_location)); | 702 device_location)); |
703 mtp_device_host->Init(); | 703 mtp_device_host->Init(); |
704 mtp_device_delegate_map_[device_location] = mtp_device_host; | 704 mtp_device_delegate_map_[device_location] = mtp_device_host.get(); |
705 return mtp_device_host; | 705 return mtp_device_host; |
706 } | 706 } |
707 | 707 |
708 void MediaFileSystemRegistry::RemoveScopedMTPDeviceMapEntry( | 708 void MediaFileSystemRegistry::RemoveScopedMTPDeviceMapEntry( |
709 const base::FilePath::StringType& device_location) { | 709 const base::FilePath::StringType& device_location) { |
710 MTPDeviceDelegateMap::iterator delegate_it = | 710 MTPDeviceDelegateMap::iterator delegate_it = |
711 mtp_device_delegate_map_.find(device_location); | 711 mtp_device_delegate_map_.find(device_location); |
712 DCHECK(delegate_it != mtp_device_delegate_map_.end()); | 712 DCHECK(delegate_it != mtp_device_delegate_map_.end()); |
713 mtp_device_delegate_map_.erase(delegate_it); | 713 mtp_device_delegate_map_.erase(delegate_it); |
714 } | 714 } |
(...skipping 15 matching lines...) Expand all Loading... |
730 // previously used. | 730 // previously used. |
731 PrefChangeRegistrarMap::iterator pref_it = | 731 PrefChangeRegistrarMap::iterator pref_it = |
732 pref_change_registrar_map_.find(profile); | 732 pref_change_registrar_map_.find(profile); |
733 DCHECK(pref_it != pref_change_registrar_map_.end()); | 733 DCHECK(pref_it != pref_change_registrar_map_.end()); |
734 delete pref_it->second; | 734 delete pref_it->second; |
735 pref_change_registrar_map_.erase(pref_it); | 735 pref_change_registrar_map_.erase(pref_it); |
736 } | 736 } |
737 } | 737 } |
738 | 738 |
739 } // namespace chrome | 739 } // namespace chrome |
OLD | NEW |