| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 // MTPDeviceDelegateImplWin implementation. | 5 // MTPDeviceDelegateImplWin implementation. |
| 6 | 6 |
| 7 #include "chrome/browser/media_gallery/win/mtp_device_delegate_impl_win.h" | 7 #include "chrome/browser/media_gallery/win/mtp_device_delegate_impl_win.h" |
| 8 | 8 |
| 9 #include <portabledevice.h> | 9 #include <portabledevice.h> |
| 10 | 10 |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 const FilePath& local_path, | 160 const FilePath& local_path, |
| 161 base::PlatformFileInfo* file_info) { | 161 base::PlatformFileInfo* file_info) { |
| 162 if (!LazyInit()) | 162 if (!LazyInit()) |
| 163 return base::PLATFORM_FILE_ERROR_FAILED; | 163 return base::PLATFORM_FILE_ERROR_FAILED; |
| 164 string16 file_object_id = GetFileObjectIdFromPath(device_file_path.value()); | 164 string16 file_object_id = GetFileObjectIdFromPath(device_file_path.value()); |
| 165 if (file_object_id.empty()) | 165 if (file_object_id.empty()) |
| 166 return base::PLATFORM_FILE_ERROR_FAILED; | 166 return base::PLATFORM_FILE_ERROR_FAILED; |
| 167 base::PlatformFileError error = GetFileInfo(device_file_path, file_info); | 167 base::PlatformFileError error = GetFileInfo(device_file_path, file_info); |
| 168 if (error != base::PLATFORM_FILE_OK) | 168 if (error != base::PLATFORM_FILE_OK) |
| 169 return error; | 169 return error; |
| 170 if (file_info->is_directory) |
| 171 return base::PLATFORM_FILE_ERROR_NOT_A_FILE; |
| 170 if (!media_transfer_protocol::WriteFileObjectContentToPath(device_.get(), | 172 if (!media_transfer_protocol::WriteFileObjectContentToPath(device_.get(), |
| 171 file_object_id, | 173 file_object_id, |
| 172 local_path)) | 174 local_path)) |
| 173 return base::PLATFORM_FILE_ERROR_FAILED; | 175 return base::PLATFORM_FILE_ERROR_FAILED; |
| 174 | 176 |
| 175 // LocalFileStreamReader is used to read the contents of the snapshot file. | 177 // LocalFileStreamReader is used to read the contents of the snapshot file. |
| 176 // Snapshot file modification time does not match the last modified time | 178 // Snapshot file modification time does not match the last modified time |
| 177 // of the original media file. Therefore, set the last modified time to null | 179 // of the original media file. Therefore, set the last modified time to null |
| 178 // in order to avoid the verification in LocalFileStreamReader. | 180 // in order to avoid the verification in LocalFileStreamReader. |
| 179 // | 181 // |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 230 file_object_id = media_transfer_protocol::GetObjectIdFromName(device_, | 232 file_object_id = media_transfer_protocol::GetObjectIdFromName(device_, |
| 231 parent_id, | 233 parent_id, |
| 232 *path_iter); | 234 *path_iter); |
| 233 if (file_object_id.empty()) | 235 if (file_object_id.empty()) |
| 234 break; | 236 break; |
| 235 parent_id = file_object_id; | 237 parent_id = file_object_id; |
| 236 } | 238 } |
| 237 return file_object_id; | 239 return file_object_id; |
| 238 } | 240 } |
| 239 | 241 |
| 240 } // namespace chrome | 242 } // namespace chrome |
| OLD | NEW |