| 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 #ifndef CHROME_BROWSER_MEDIA_GALLERY_WIN_MTP_DEVICE_DELEGATE_IMPL_WIN_H_ | 5 #ifndef CHROME_BROWSER_MEDIA_GALLERY_WIN_MTP_DEVICE_DELEGATE_IMPL_WIN_H_ |
| 6 #define CHROME_BROWSER_MEDIA_GALLERY_WIN_MTP_DEVICE_DELEGATE_IMPL_WIN_H_ | 6 #define CHROME_BROWSER_MEDIA_GALLERY_WIN_MTP_DEVICE_DELEGATE_IMPL_WIN_H_ |
| 7 | 7 |
| 8 #include <portabledeviceapi.h> | 8 #include <portabledeviceapi.h> |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| 11 | 11 |
| 12 #include "base/platform_file.h" | 12 #include "base/platform_file.h" |
| 13 #include "base/sequenced_task_runner_helpers.h" | 13 #include "base/sequenced_task_runner_helpers.h" |
| 14 #include "base/string16.h" | 14 #include "base/string16.h" |
| 15 #include "base/synchronization/lock.h" | 15 #include "base/synchronization/lock.h" |
| 16 #include "base/win/scoped_comptr.h" | 16 #include "base/win/scoped_comptr.h" |
| 17 #include "chrome/browser/media_gallery/mtp_device_delegate_impl.h" | 17 #include "chrome/browser/media_gallery/mtp_device_delegate_impl.h" |
| 18 #include "webkit/fileapi/file_system_file_util.h" | 18 #include "webkit/fileapi/file_system_file_util.h" |
| 19 #include "webkit/fileapi/media/mtp_device_delegate.h" | 19 #include "webkit/fileapi/media/mtp_device_delegate.h" |
| 20 | 20 |
| 21 namespace base { |
| 21 class FilePath; | 22 class FilePath; |
| 22 | |
| 23 namespace base { | |
| 24 class SequencedTaskRunner; | 23 class SequencedTaskRunner; |
| 25 } | 24 } |
| 26 | 25 |
| 27 namespace chrome { | 26 namespace chrome { |
| 28 | 27 |
| 29 // MTPDeviceDelegateImplWin is used to communicate with the media transfer | 28 // MTPDeviceDelegateImplWin is used to communicate with the media transfer |
| 30 // protocol (MTP) device to complete isolated file system operations. MTP | 29 // protocol (MTP) device to complete isolated file system operations. MTP |
| 31 // device can have multiple data storage partitions. MTPDeviceDelegateImplWin | 30 // device can have multiple data storage partitions. MTPDeviceDelegateImplWin |
| 32 // is instantiated per MTP device storage partition using | 31 // is instantiated per MTP device storage partition using |
| 33 // CreateMTPDeviceDelegate(). MTPDeviceDelegateImplWin lives on a sequenced | 32 // CreateMTPDeviceDelegate(). MTPDeviceDelegateImplWin lives on a sequenced |
| (...skipping 15 matching lines...) Expand all Loading... |
| 49 MTPDeviceDelegateImplWin(const string16& fs_root_path, | 48 MTPDeviceDelegateImplWin(const string16& fs_root_path, |
| 50 const string16& pnp_device_id, | 49 const string16& pnp_device_id, |
| 51 const string16& storage_object_id, | 50 const string16& storage_object_id, |
| 52 base::SequencedTaskRunner* media_task_runner); | 51 base::SequencedTaskRunner* media_task_runner); |
| 53 | 52 |
| 54 // Destructed via CancelPendingTasksAndDeleteDelegate(). | 53 // Destructed via CancelPendingTasksAndDeleteDelegate(). |
| 55 virtual ~MTPDeviceDelegateImplWin(); | 54 virtual ~MTPDeviceDelegateImplWin(); |
| 56 | 55 |
| 57 // MTPDeviceDelegate: | 56 // MTPDeviceDelegate: |
| 58 virtual base::PlatformFileError GetFileInfo( | 57 virtual base::PlatformFileError GetFileInfo( |
| 59 const FilePath& file_path, | 58 const base::FilePath& file_path, |
| 60 base::PlatformFileInfo* file_info) OVERRIDE; | 59 base::PlatformFileInfo* file_info) OVERRIDE; |
| 61 virtual scoped_ptr<fileapi::FileSystemFileUtil::AbstractFileEnumerator> | 60 virtual scoped_ptr<fileapi::FileSystemFileUtil::AbstractFileEnumerator> |
| 62 CreateFileEnumerator(const FilePath& root, | 61 CreateFileEnumerator(const base::FilePath& root, |
| 63 bool recursive) OVERRIDE; | 62 bool recursive) OVERRIDE; |
| 64 virtual base::PlatformFileError CreateSnapshotFile( | 63 virtual base::PlatformFileError CreateSnapshotFile( |
| 65 const FilePath& device_file_path, | 64 const base::FilePath& device_file_path, |
| 66 const FilePath& local_path, | 65 const base::FilePath& local_path, |
| 67 base::PlatformFileInfo* file_info) OVERRIDE; | 66 base::PlatformFileInfo* file_info) OVERRIDE; |
| 68 virtual void CancelPendingTasksAndDeleteDelegate() OVERRIDE; | 67 virtual void CancelPendingTasksAndDeleteDelegate() OVERRIDE; |
| 69 | 68 |
| 70 // Returns whether the device is ready for communication. | 69 // Returns whether the device is ready for communication. |
| 71 bool LazyInit(); | 70 bool LazyInit(); |
| 72 | 71 |
| 73 // Returns the object id of the file object specified by the |file_path|, | 72 // Returns the object id of the file object specified by the |file_path|, |
| 74 // e.g. if the |file_path| is "\\MTP:StorageSerial:SID-{1001,,192}:125\DCIM" | 73 // e.g. if the |file_path| is "\\MTP:StorageSerial:SID-{1001,,192}:125\DCIM" |
| 75 // and |registered_device_path_| is "\\MTP:StorageSerial:SID-{1001,,192}:125", | 74 // and |registered_device_path_| is "\\MTP:StorageSerial:SID-{1001,,192}:125", |
| 76 // this function returns the identifier of the "DCIM" folder object. | 75 // this function returns the identifier of the "DCIM" folder object. |
| (...skipping 30 matching lines...) Expand all Loading... |
| 107 // (4) User revoked the MTP device gallery permission. | 106 // (4) User revoked the MTP device gallery permission. |
| 108 base::Lock cancel_tasks_lock_; | 107 base::Lock cancel_tasks_lock_; |
| 109 bool cancel_pending_tasks_; | 108 bool cancel_pending_tasks_; |
| 110 | 109 |
| 111 DISALLOW_COPY_AND_ASSIGN(MTPDeviceDelegateImplWin); | 110 DISALLOW_COPY_AND_ASSIGN(MTPDeviceDelegateImplWin); |
| 112 }; | 111 }; |
| 113 | 112 |
| 114 } // namespace chrome | 113 } // namespace chrome |
| 115 | 114 |
| 116 #endif // CHROME_BROWSER_MEDIA_GALLERY_WIN_MTP_DEVICE_DELEGATE_IMPL_WIN_H_ | 115 #endif // CHROME_BROWSER_MEDIA_GALLERY_WIN_MTP_DEVICE_DELEGATE_IMPL_WIN_H_ |
| OLD | NEW |