| 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_galleries/win/mtp_device_delegate_impl_win.h" | 7 #include "chrome/browser/media_galleries/win/mtp_device_delegate_impl_win.h" |
| 8 | 8 |
| 9 #include <portabledevice.h> | 9 #include <portabledevice.h> |
| 10 #include <stddef.h> | 10 #include <stddef.h> |
| (...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 240 device_info, | 240 device_info, |
| 241 file_details->request_info().device_file_path, | 241 file_details->request_info().device_file_path, |
| 242 &file_info); | 242 &file_info); |
| 243 if (error != base::File::FILE_OK) | 243 if (error != base::File::FILE_OK) |
| 244 return error; | 244 return error; |
| 245 | 245 |
| 246 DWORD optimal_transfer_size = 0; | 246 DWORD optimal_transfer_size = 0; |
| 247 base::win::ScopedComPtr<IStream> file_stream; | 247 base::win::ScopedComPtr<IStream> file_stream; |
| 248 if (file_info.size > 0) { | 248 if (file_info.size > 0) { |
| 249 HRESULT hr = media_transfer_protocol::GetFileStreamForObject( | 249 HRESULT hr = media_transfer_protocol::GetFileStreamForObject( |
| 250 device, | 250 device, file_object_id, file_stream.GetAddressOf(), |
| 251 file_object_id, | |
| 252 file_stream.Receive(), | |
| 253 &optimal_transfer_size); | 251 &optimal_transfer_size); |
| 254 if (hr != S_OK) | 252 if (hr != S_OK) |
| 255 return base::File::FILE_ERROR_FAILED; | 253 return base::File::FILE_ERROR_FAILED; |
| 256 } | 254 } |
| 257 | 255 |
| 258 // LocalFileStreamReader is used to read the contents of the snapshot file. | 256 // LocalFileStreamReader is used to read the contents of the snapshot file. |
| 259 // Snapshot file modification time does not match the last modified time | 257 // Snapshot file modification time does not match the last modified time |
| 260 // of the original media file. Therefore, set the last modified time to null | 258 // of the original media file. Therefore, set the last modified time to null |
| 261 // in order to avoid the verification in LocalFileStreamReader. | 259 // in order to avoid the verification in LocalFileStreamReader. |
| 262 // | 260 // |
| (...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 695 current_snapshot_details_->file_info(), | 693 current_snapshot_details_->file_info(), |
| 696 current_snapshot_details_->request_info().snapshot_file_path); | 694 current_snapshot_details_->request_info().snapshot_file_path); |
| 697 } else { | 695 } else { |
| 698 current_snapshot_details_->request_info().error_callback.Run( | 696 current_snapshot_details_->request_info().error_callback.Run( |
| 699 base::File::FILE_ERROR_FAILED); | 697 base::File::FILE_ERROR_FAILED); |
| 700 } | 698 } |
| 701 task_in_progress_ = false; | 699 task_in_progress_ = false; |
| 702 current_snapshot_details_.reset(); | 700 current_snapshot_details_.reset(); |
| 703 ProcessNextPendingRequest(); | 701 ProcessNextPendingRequest(); |
| 704 } | 702 } |
| OLD | NEW |