| 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_GALLERIES_WIN_MTP_DEVICE_DELEGATE_IMPL_WIN_H_ | 5 #ifndef CHROME_BROWSER_MEDIA_GALLERIES_WIN_MTP_DEVICE_DELEGATE_IMPL_WIN_H_ |
| 6 #define CHROME_BROWSER_MEDIA_GALLERIES_WIN_MTP_DEVICE_DELEGATE_IMPL_WIN_H_ | 6 #define CHROME_BROWSER_MEDIA_GALLERIES_WIN_MTP_DEVICE_DELEGATE_IMPL_WIN_H_ |
| 7 | 7 |
| 8 #include <queue> | 8 #include <queue> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 const base::Callback<void(base::File::Error)> reply; | 80 const base::Callback<void(base::File::Error)> reply; |
| 81 }; | 81 }; |
| 82 | 82 |
| 83 // Defers the device initializations until the first file operation request. | 83 // Defers the device initializations until the first file operation request. |
| 84 // Do all the initializations in EnsureInitAndRunTask() function. | 84 // Do all the initializations in EnsureInitAndRunTask() function. |
| 85 MTPDeviceDelegateImplWin(const base::string16& registered_device_path, | 85 MTPDeviceDelegateImplWin(const base::string16& registered_device_path, |
| 86 const base::string16& pnp_device_id, | 86 const base::string16& pnp_device_id, |
| 87 const base::string16& storage_object_id); | 87 const base::string16& storage_object_id); |
| 88 | 88 |
| 89 // Destructed via CancelPendingTasksAndDeleteDelegate(). | 89 // Destructed via CancelPendingTasksAndDeleteDelegate(). |
| 90 virtual ~MTPDeviceDelegateImplWin(); | 90 ~MTPDeviceDelegateImplWin() override; |
| 91 | 91 |
| 92 // MTPDeviceAsyncDelegate: | 92 // MTPDeviceAsyncDelegate: |
| 93 virtual void GetFileInfo(const base::FilePath& file_path, | 93 void GetFileInfo(const base::FilePath& file_path, |
| 94 const GetFileInfoSuccessCallback& success_callback, | 94 const GetFileInfoSuccessCallback& success_callback, |
| 95 const ErrorCallback& error_callback) override; | 95 const ErrorCallback& error_callback) override; |
| 96 virtual void CreateDirectory( | 96 void CreateDirectory( |
| 97 const base::FilePath& directory_path, | 97 const base::FilePath& directory_path, |
| 98 const bool exclusive, | 98 const bool exclusive, |
| 99 const bool recursive, | 99 const bool recursive, |
| 100 const CreateDirectorySuccessCallback& success_callback, | 100 const CreateDirectorySuccessCallback& success_callback, |
| 101 const ErrorCallback& error_callback) override; | 101 const ErrorCallback& error_callback) override; |
| 102 virtual void ReadDirectory( | 102 void ReadDirectory( |
| 103 const base::FilePath& root, | 103 const base::FilePath& root, |
| 104 const ReadDirectorySuccessCallback& success_callback, | 104 const ReadDirectorySuccessCallback& success_callback, |
| 105 const ErrorCallback& error_callback) override; | 105 const ErrorCallback& error_callback) override; |
| 106 virtual void CreateSnapshotFile( | 106 void CreateSnapshotFile( |
| 107 const base::FilePath& device_file_path, | 107 const base::FilePath& device_file_path, |
| 108 const base::FilePath& local_path, | 108 const base::FilePath& local_path, |
| 109 const CreateSnapshotFileSuccessCallback& success_callback, | 109 const CreateSnapshotFileSuccessCallback& success_callback, |
| 110 const ErrorCallback& error_callback) override; | 110 const ErrorCallback& error_callback) override; |
| 111 virtual bool IsStreaming() override; | 111 bool IsStreaming() override; |
| 112 virtual void ReadBytes(const base::FilePath& device_file_path, | 112 void ReadBytes(const base::FilePath& device_file_path, |
| 113 const scoped_refptr<net::IOBuffer>& buf, | 113 const scoped_refptr<net::IOBuffer>& buf, |
| 114 int64 offset, | 114 int64 offset, |
| 115 int buf_len, | 115 int buf_len, |
| 116 const ReadBytesSuccessCallback& success_callback, | 116 const ReadBytesSuccessCallback& success_callback, |
| 117 const ErrorCallback& error_callback) override; | 117 const ErrorCallback& error_callback) override; |
| 118 bool IsReadOnly() const override; | 118 bool IsReadOnly() const override; |
| 119 void CopyFileLocal( | 119 void CopyFileLocal( |
| 120 const base::FilePath& source_file_path, | 120 const base::FilePath& source_file_path, |
| 121 const base::FilePath& device_file_path, | 121 const base::FilePath& device_file_path, |
| 122 const CreateTemporaryFileCallback& create_temporary_file_callback, | 122 const CreateTemporaryFileCallback& create_temporary_file_callback, |
| 123 const CopyFileProgressCallback& progress_callback, | 123 const CopyFileProgressCallback& progress_callback, |
| 124 const CopyFileLocalSuccessCallback& success_callback, | 124 const CopyFileLocalSuccessCallback& success_callback, |
| 125 const ErrorCallback& error_callback) override; | 125 const ErrorCallback& error_callback) override; |
| 126 void MoveFileLocal( | 126 void MoveFileLocal( |
| 127 const base::FilePath& source_file_path, | 127 const base::FilePath& source_file_path, |
| (...skipping 16 matching lines...) Expand all Loading... |
| 144 const base::FilePath& file_path, | 144 const base::FilePath& file_path, |
| 145 const bool recursive, | 145 const bool recursive, |
| 146 const storage::WatcherManager::StatusCallback& callback, | 146 const storage::WatcherManager::StatusCallback& callback, |
| 147 const storage::WatcherManager::NotificationCallback& | 147 const storage::WatcherManager::NotificationCallback& |
| 148 notification_callback) override; | 148 notification_callback) override; |
| 149 void RemoveWatcher( | 149 void RemoveWatcher( |
| 150 const GURL& origin, | 150 const GURL& origin, |
| 151 const base::FilePath& file_path, | 151 const base::FilePath& file_path, |
| 152 const bool recursive, | 152 const bool recursive, |
| 153 const storage::WatcherManager::StatusCallback& callback) override; | 153 const storage::WatcherManager::StatusCallback& callback) override; |
| 154 virtual void CancelPendingTasksAndDeleteDelegate() override; | 154 void CancelPendingTasksAndDeleteDelegate() override; |
| 155 | 155 |
| 156 // Ensures the device is initialized for communication by doing a | 156 // Ensures the device is initialized for communication by doing a |
| 157 // call-and-reply to a blocking pool thread. |task_info.task| runs on a | 157 // call-and-reply to a blocking pool thread. |task_info.task| runs on a |
| 158 // blocking pool thread and |task_info.reply| runs on the IO thread. | 158 // blocking pool thread and |task_info.reply| runs on the IO thread. |
| 159 // | 159 // |
| 160 // If the device is already initialized, post the |task_info.task| | 160 // If the device is already initialized, post the |task_info.task| |
| 161 // immediately on a blocking pool thread. | 161 // immediately on a blocking pool thread. |
| 162 // | 162 // |
| 163 // If the device is uninitialized, store the |task_info| in a pending task | 163 // If the device is uninitialized, store the |task_info| in a pending task |
| 164 // list and then runs all the pending tasks once the device is successfully | 164 // list and then runs all the pending tasks once the device is successfully |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 255 // Used to make sure only one task is in progress at any time. | 255 // Used to make sure only one task is in progress at any time. |
| 256 bool task_in_progress_; | 256 bool task_in_progress_; |
| 257 | 257 |
| 258 // For callbacks that may run after destruction. | 258 // For callbacks that may run after destruction. |
| 259 base::WeakPtrFactory<MTPDeviceDelegateImplWin> weak_ptr_factory_; | 259 base::WeakPtrFactory<MTPDeviceDelegateImplWin> weak_ptr_factory_; |
| 260 | 260 |
| 261 DISALLOW_COPY_AND_ASSIGN(MTPDeviceDelegateImplWin); | 261 DISALLOW_COPY_AND_ASSIGN(MTPDeviceDelegateImplWin); |
| 262 }; | 262 }; |
| 263 | 263 |
| 264 #endif // CHROME_BROWSER_MEDIA_GALLERIES_WIN_MTP_DEVICE_DELEGATE_IMPL_WIN_H_ | 264 #endif // CHROME_BROWSER_MEDIA_GALLERIES_WIN_MTP_DEVICE_DELEGATE_IMPL_WIN_H_ |
| OLD | NEW |