| 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 #include "chrome/browser/media_galleries/mac/mtp_device_delegate_impl_mac.h" | 5 #include "chrome/browser/media_galleries/mac/mtp_device_delegate_impl_mac.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 | 10 |
| (...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 290 content::BrowserThread::PostTask(content::BrowserThread::UI, FROM_HERE, | 290 content::BrowserThread::PostTask(content::BrowserThread::UI, FROM_HERE, |
| 291 base::Bind(&MTPDeviceDelegateImplMac::CancelAndDelete, | 291 base::Bind(&MTPDeviceDelegateImplMac::CancelAndDelete, |
| 292 base::Unretained(this))); | 292 base::Unretained(this))); |
| 293 } | 293 } |
| 294 | 294 |
| 295 void MTPDeviceDelegateImplMac::GetFileInfoImpl( | 295 void MTPDeviceDelegateImplMac::GetFileInfoImpl( |
| 296 const base::FilePath& file_path, | 296 const base::FilePath& file_path, |
| 297 base::File::Info* file_info, | 297 base::File::Info* file_info, |
| 298 base::File::Error* error) { | 298 base::File::Error* error) { |
| 299 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 299 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
| 300 base::hash_map<base::FilePath::StringType, | 300 auto i = file_info_.find(file_path.value()); |
| 301 base::File::Info>::const_iterator i = | |
| 302 file_info_.find(file_path.value()); | |
| 303 if (i == file_info_.end()) { | 301 if (i == file_info_.end()) { |
| 304 *error = base::File::FILE_ERROR_NOT_FOUND; | 302 *error = base::File::FILE_ERROR_NOT_FOUND; |
| 305 return; | 303 return; |
| 306 } | 304 } |
| 307 *file_info = i->second; | 305 *file_info = i->second; |
| 308 *error = base::File::FILE_OK; | 306 *error = base::File::FILE_OK; |
| 309 } | 307 } |
| 310 | 308 |
| 311 void MTPDeviceDelegateImplMac::ReadDirectoryImpl( | 309 void MTPDeviceDelegateImplMac::ReadDirectoryImpl( |
| 312 const base::FilePath& root, | 310 const base::FilePath& root, |
| (...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 569 std::string device_name = base::FilePath(device_location).BaseName().value(); | 567 std::string device_name = base::FilePath(device_location).BaseName().value(); |
| 570 std::string device_id; | 568 std::string device_id; |
| 571 storage_monitor::StorageInfo::Type type; | 569 storage_monitor::StorageInfo::Type type; |
| 572 bool cracked = storage_monitor::StorageInfo::CrackDeviceId( | 570 bool cracked = storage_monitor::StorageInfo::CrackDeviceId( |
| 573 device_name, &type, &device_id); | 571 device_name, &type, &device_id); |
| 574 DCHECK(cracked); | 572 DCHECK(cracked); |
| 575 DCHECK_EQ(storage_monitor::StorageInfo::MAC_IMAGE_CAPTURE, type); | 573 DCHECK_EQ(storage_monitor::StorageInfo::MAC_IMAGE_CAPTURE, type); |
| 576 | 574 |
| 577 cb.Run(new MTPDeviceDelegateImplMac(device_id, device_location)); | 575 cb.Run(new MTPDeviceDelegateImplMac(device_id, device_location)); |
| 578 } | 576 } |
| OLD | NEW |