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 |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 #include "base/bind.h" | 13 #include "base/bind.h" |
14 #include "base/files/file_path.h" | 14 #include "base/files/file_path.h" |
15 #include "base/logging.h" | 15 #include "base/logging.h" |
16 #include "base/memory/ref_counted.h" | 16 #include "base/memory/ref_counted.h" |
17 #include "base/sequenced_task_runner.h" | 17 #include "base/sequenced_task_runner.h" |
18 #include "base/stl_util.h" | 18 #include "base/stl_util.h" |
19 #include "base/strings/string_split.h" | 19 #include "base/strings/string_split.h" |
20 #include "base/strings/string_util.h" | 20 #include "base/strings/string_util.h" |
21 #include "base/strings/utf_string_conversions.h" | 21 #include "base/strings/utf_string_conversions.h" |
22 #include "base/task_runner_util.h" | 22 #include "base/task_runner_util.h" |
23 #include "base/threading/sequenced_worker_pool.h" | 23 #include "base/threading/sequenced_worker_pool.h" |
24 #include "base/threading/thread_restrictions.h" | 24 #include "base/threading/thread_restrictions.h" |
25 #include "chrome/browser/media_galleries/fileapi/media_file_system_mount_point_p
rovider.h" | 25 #include "chrome/browser/media_galleries/fileapi/media_file_system_backend.h" |
26 #include "chrome/browser/media_galleries/win/mtp_device_object_entry.h" | 26 #include "chrome/browser/media_galleries/win/mtp_device_object_entry.h" |
27 #include "chrome/browser/media_galleries/win/mtp_device_object_enumerator.h" | 27 #include "chrome/browser/media_galleries/win/mtp_device_object_enumerator.h" |
28 #include "chrome/browser/media_galleries/win/mtp_device_operations_util.h" | 28 #include "chrome/browser/media_galleries/win/mtp_device_operations_util.h" |
29 #include "chrome/browser/media_galleries/win/portable_device_map_service.h" | 29 #include "chrome/browser/media_galleries/win/portable_device_map_service.h" |
30 #include "chrome/browser/media_galleries/win/snapshot_file_details.h" | 30 #include "chrome/browser/media_galleries/win/snapshot_file_details.h" |
31 #include "chrome/browser/storage_monitor/storage_monitor.h" | 31 #include "chrome/browser/storage_monitor/storage_monitor.h" |
32 #include "content/public/browser/browser_thread.h" | 32 #include "content/public/browser/browser_thread.h" |
33 #include "webkit/common/fileapi/file_system_util.h" | 33 #include "webkit/common/fileapi/file_system_util.h" |
34 | 34 |
35 namespace chrome { | 35 namespace chrome { |
(...skipping 17 matching lines...) Expand all Loading... |
53 StorageMonitor* monitor = StorageMonitor::GetInstance(); | 53 StorageMonitor* monitor = StorageMonitor::GetInstance(); |
54 DCHECK(monitor); | 54 DCHECK(monitor); |
55 return monitor->GetMTPStorageInfoFromDeviceId( | 55 return monitor->GetMTPStorageInfoFromDeviceId( |
56 UTF16ToUTF8(storage_device_id), pnp_device_id, storage_object_id); | 56 UTF16ToUTF8(storage_device_id), pnp_device_id, storage_object_id); |
57 } | 57 } |
58 | 58 |
59 scoped_refptr<base::SequencedTaskRunner> GetSequencedTaskRunner() { | 59 scoped_refptr<base::SequencedTaskRunner> GetSequencedTaskRunner() { |
60 base::SequencedWorkerPool* pool = content::BrowserThread::GetBlockingPool(); | 60 base::SequencedWorkerPool* pool = content::BrowserThread::GetBlockingPool(); |
61 base::SequencedWorkerPool::SequenceToken media_sequence_token = | 61 base::SequencedWorkerPool::SequenceToken media_sequence_token = |
62 pool->GetNamedSequenceToken( | 62 pool->GetNamedSequenceToken( |
63 MediaFileSystemMountPointProvider::kMediaTaskRunnerName); | 63 MediaFileSystemBackend::kMediaTaskRunnerName); |
64 return pool->GetSequencedTaskRunner(media_sequence_token); | 64 return pool->GetSequencedTaskRunner(media_sequence_token); |
65 } | 65 } |
66 | 66 |
67 // Returns the object id of the file object specified by the |file_path|, | 67 // Returns the object id of the file object specified by the |file_path|, |
68 // e.g. if the |file_path| is "\\MTP:StorageSerial:SID-{1001,,192}:125\DCIM" | 68 // e.g. if the |file_path| is "\\MTP:StorageSerial:SID-{1001,,192}:125\DCIM" |
69 // and |device_info.registered_device_path_| is | 69 // and |device_info.registered_device_path_| is |
70 // "\\MTP:StorageSerial:SID-{1001,,192}:125", this function returns the | 70 // "\\MTP:StorageSerial:SID-{1001,,192}:125", this function returns the |
71 // identifier of the "DCIM" folder object. | 71 // identifier of the "DCIM" folder object. |
72 // | 72 // |
73 // Returns an empty string if the device is detached while the request is in | 73 // Returns an empty string if the device is detached while the request is in |
(...skipping 540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
614 } else { | 614 } else { |
615 current_snapshot_details_->request_info().error_callback.Run( | 615 current_snapshot_details_->request_info().error_callback.Run( |
616 base::PLATFORM_FILE_ERROR_FAILED); | 616 base::PLATFORM_FILE_ERROR_FAILED); |
617 } | 617 } |
618 task_in_progress_ = false; | 618 task_in_progress_ = false; |
619 current_snapshot_details_.reset(); | 619 current_snapshot_details_.reset(); |
620 ProcessNextPendingRequest(); | 620 ProcessNextPendingRequest(); |
621 } | 621 } |
622 | 622 |
623 } // namespace chrome | 623 } // namespace chrome |
OLD | NEW |