| 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 | 10 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 // |storage_path| on the UI thread. Returns true if the storage details are | 37 // |storage_path| on the UI thread. Returns true if the storage details are |
| 38 // valid and returns false otherwise. | 38 // valid and returns false otherwise. |
| 39 bool GetStorageInfoOnUIThread(const string16& storage_path, | 39 bool GetStorageInfoOnUIThread(const string16& storage_path, |
| 40 string16* pnp_device_id, | 40 string16* pnp_device_id, |
| 41 string16* storage_object_id) { | 41 string16* storage_object_id) { |
| 42 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); | 42 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |
| 43 DCHECK(!storage_path.empty()); | 43 DCHECK(!storage_path.empty()); |
| 44 DCHECK(pnp_device_id); | 44 DCHECK(pnp_device_id); |
| 45 DCHECK(storage_object_id); | 45 DCHECK(storage_object_id); |
| 46 string16 storage_device_id; | 46 string16 storage_device_id; |
| 47 RemoveChars(storage_path, L"\\\\", &storage_device_id); | 47 base::RemoveChars(storage_path, L"\\\\", &storage_device_id); |
| 48 DCHECK(!storage_device_id.empty()); | 48 DCHECK(!storage_device_id.empty()); |
| 49 // TODO(gbillock): Take the StorageMonitor as an argument. | 49 // TODO(gbillock): Take the StorageMonitor as an argument. |
| 50 StorageMonitor* monitor = StorageMonitor::GetInstance(); | 50 StorageMonitor* monitor = StorageMonitor::GetInstance(); |
| 51 DCHECK(monitor); | 51 DCHECK(monitor); |
| 52 return monitor->GetMTPStorageInfoFromDeviceId( | 52 return monitor->GetMTPStorageInfoFromDeviceId( |
| 53 UTF16ToUTF8(storage_device_id), pnp_device_id, storage_object_id); | 53 UTF16ToUTF8(storage_device_id), pnp_device_id, storage_object_id); |
| 54 } | 54 } |
| 55 | 55 |
| 56 // Returns the object id of the file object specified by the |file_path|, | 56 // Returns the object id of the file object specified by the |file_path|, |
| 57 // e.g. if the |file_path| is "\\MTP:StorageSerial:SID-{1001,,192}:125\DCIM" | 57 // e.g. if the |file_path| is "\\MTP:StorageSerial:SID-{1001,,192}:125\DCIM" |
| (...skipping 543 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 601 current_snapshot_details_->file_info(), | 601 current_snapshot_details_->file_info(), |
| 602 current_snapshot_details_->request_info().snapshot_file_path); | 602 current_snapshot_details_->request_info().snapshot_file_path); |
| 603 } else { | 603 } else { |
| 604 current_snapshot_details_->request_info().error_callback.Run( | 604 current_snapshot_details_->request_info().error_callback.Run( |
| 605 base::PLATFORM_FILE_ERROR_FAILED); | 605 base::PLATFORM_FILE_ERROR_FAILED); |
| 606 } | 606 } |
| 607 task_in_progress_ = false; | 607 task_in_progress_ = false; |
| 608 current_snapshot_details_.reset(); | 608 current_snapshot_details_.reset(); |
| 609 ProcessNextPendingRequest(); | 609 ProcessNextPendingRequest(); |
| 610 } | 610 } |
| OLD | NEW |