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 #include "chrome/browser/media_galleries/win/mtp_device_operations_util.h" | 5 #include "chrome/browser/media_galleries/win/mtp_device_operations_util.h" |
6 | 6 |
7 #include <portabledevice.h> | 7 #include <portabledevice.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 | 10 |
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
309 return base::win::ScopedComPtr<IPortableDevice>(); | 309 return base::win::ScopedComPtr<IPortableDevice>(); |
310 | 310 |
311 hr = device->Open(pnp_device_id.c_str(), client_info.get()); | 311 hr = device->Open(pnp_device_id.c_str(), client_info.get()); |
312 if (SUCCEEDED(hr)) | 312 if (SUCCEEDED(hr)) |
313 return device; | 313 return device; |
314 if (hr == E_ACCESSDENIED) | 314 if (hr == E_ACCESSDENIED) |
315 DPLOG(ERROR) << "Access denied to open the device"; | 315 DPLOG(ERROR) << "Access denied to open the device"; |
316 return base::win::ScopedComPtr<IPortableDevice>(); | 316 return base::win::ScopedComPtr<IPortableDevice>(); |
317 } | 317 } |
318 | 318 |
319 base::PlatformFileError GetFileEntryInfo( | 319 base::File::Error GetFileEntryInfo( |
320 IPortableDevice* device, | 320 IPortableDevice* device, |
321 const base::string16& object_id, | 321 const base::string16& object_id, |
322 base::PlatformFileInfo* file_entry_info) { | 322 base::File::Info* file_entry_info) { |
323 DCHECK(device); | 323 DCHECK(device); |
324 DCHECK(!object_id.empty()); | 324 DCHECK(!object_id.empty()); |
325 DCHECK(file_entry_info); | 325 DCHECK(file_entry_info); |
326 MTPDeviceObjectEntry entry; | 326 MTPDeviceObjectEntry entry; |
327 if (!GetMTPDeviceObjectEntry(device, object_id, &entry)) | 327 if (!GetMTPDeviceObjectEntry(device, object_id, &entry)) |
328 return base::PLATFORM_FILE_ERROR_NOT_FOUND; | 328 return base::File::FILE_ERROR_NOT_FOUND; |
329 | 329 |
330 file_entry_info->size = entry.size; | 330 file_entry_info->size = entry.size; |
331 file_entry_info->is_directory = entry.is_directory; | 331 file_entry_info->is_directory = entry.is_directory; |
332 file_entry_info->is_symbolic_link = false; | 332 file_entry_info->is_symbolic_link = false; |
333 file_entry_info->last_modified = entry.last_modified_time; | 333 file_entry_info->last_modified = entry.last_modified_time; |
334 file_entry_info->last_accessed = entry.last_modified_time; | 334 file_entry_info->last_accessed = entry.last_modified_time; |
335 file_entry_info->creation_time = base::Time(); | 335 file_entry_info->creation_time = base::Time(); |
336 return base::PLATFORM_FILE_OK; | 336 return base::File::FILE_OK; |
337 } | 337 } |
338 | 338 |
339 bool GetDirectoryEntries(IPortableDevice* device, | 339 bool GetDirectoryEntries(IPortableDevice* device, |
340 const base::string16& directory_object_id, | 340 const base::string16& directory_object_id, |
341 MTPDeviceObjectEntries* object_entries) { | 341 MTPDeviceObjectEntries* object_entries) { |
342 return GetMTPDeviceObjectEntries(device, directory_object_id, | 342 return GetMTPDeviceObjectEntries(device, directory_object_id, |
343 base::string16(), object_entries); | 343 base::string16(), object_entries); |
344 } | 344 } |
345 | 345 |
346 HRESULT GetFileStreamForObject(IPortableDevice* device, | 346 HRESULT GetFileStreamForObject(IPortableDevice* device, |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
402 object_entries.empty()) | 402 object_entries.empty()) |
403 return base::string16(); | 403 return base::string16(); |
404 // TODO(thestig): This DCHECK can fail. Multiple MTP objects can have | 404 // TODO(thestig): This DCHECK can fail. Multiple MTP objects can have |
405 // the same name. Handle the situation gracefully. Refer to crbug.com/169930 | 405 // the same name. Handle the situation gracefully. Refer to crbug.com/169930 |
406 // for more details. | 406 // for more details. |
407 DCHECK_EQ(1U, object_entries.size()); | 407 DCHECK_EQ(1U, object_entries.size()); |
408 return object_entries[0].object_id; | 408 return object_entries[0].object_id; |
409 } | 409 } |
410 | 410 |
411 } // namespace media_transfer_protocol | 411 } // namespace media_transfer_protocol |
OLD | NEW |