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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 virtual ~MTPDeviceDelegateImplWin(); |
91 | 91 |
92 // MTPDeviceAsyncDelegate: | 92 // MTPDeviceAsyncDelegate: |
93 virtual void GetFileInfo( | 93 virtual void GetFileInfo( |
94 const base::FilePath& file_path, | 94 const base::FilePath& file_path, |
95 const GetFileInfoSuccessCallback& success_callback, | 95 const GetFileInfoSuccessCallback& success_callback, |
96 const ErrorCallback& error_callback) OVERRIDE; | 96 const ErrorCallback& error_callback) override; |
97 virtual void ReadDirectory( | 97 virtual void ReadDirectory( |
98 const base::FilePath& root, | 98 const base::FilePath& root, |
99 const ReadDirectorySuccessCallback& success_callback, | 99 const ReadDirectorySuccessCallback& success_callback, |
100 const ErrorCallback& error_callback) OVERRIDE; | 100 const ErrorCallback& error_callback) override; |
101 virtual void CreateSnapshotFile( | 101 virtual void CreateSnapshotFile( |
102 const base::FilePath& device_file_path, | 102 const base::FilePath& device_file_path, |
103 const base::FilePath& local_path, | 103 const base::FilePath& local_path, |
104 const CreateSnapshotFileSuccessCallback& success_callback, | 104 const CreateSnapshotFileSuccessCallback& success_callback, |
105 const ErrorCallback& error_callback) OVERRIDE; | 105 const ErrorCallback& error_callback) override; |
106 virtual bool IsStreaming() OVERRIDE; | 106 virtual bool IsStreaming() override; |
107 virtual void ReadBytes(const base::FilePath& device_file_path, | 107 virtual void ReadBytes(const base::FilePath& device_file_path, |
108 const scoped_refptr<net::IOBuffer>& buf, | 108 const scoped_refptr<net::IOBuffer>& buf, |
109 int64 offset, | 109 int64 offset, |
110 int buf_len, | 110 int buf_len, |
111 const ReadBytesSuccessCallback& success_callback, | 111 const ReadBytesSuccessCallback& success_callback, |
112 const ErrorCallback& error_callback) OVERRIDE; | 112 const ErrorCallback& error_callback) override; |
113 virtual void CancelPendingTasksAndDeleteDelegate() OVERRIDE; | 113 virtual void CancelPendingTasksAndDeleteDelegate() override; |
114 | 114 |
115 // Ensures the device is initialized for communication by doing a | 115 // Ensures the device is initialized for communication by doing a |
116 // call-and-reply to a blocking pool thread. |task_info.task| runs on a | 116 // call-and-reply to a blocking pool thread. |task_info.task| runs on a |
117 // blocking pool thread and |task_info.reply| runs on the IO thread. | 117 // blocking pool thread and |task_info.reply| runs on the IO thread. |
118 // | 118 // |
119 // If the device is already initialized, post the |task_info.task| | 119 // If the device is already initialized, post the |task_info.task| |
120 // immediately on a blocking pool thread. | 120 // immediately on a blocking pool thread. |
121 // | 121 // |
122 // If the device is uninitialized, store the |task_info| in a pending task | 122 // If the device is uninitialized, store the |task_info| in a pending task |
123 // list and then runs all the pending tasks once the device is successfully | 123 // 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... |
214 // Used to make sure only one task is in progress at any time. | 214 // Used to make sure only one task is in progress at any time. |
215 bool task_in_progress_; | 215 bool task_in_progress_; |
216 | 216 |
217 // For callbacks that may run after destruction. | 217 // For callbacks that may run after destruction. |
218 base::WeakPtrFactory<MTPDeviceDelegateImplWin> weak_ptr_factory_; | 218 base::WeakPtrFactory<MTPDeviceDelegateImplWin> weak_ptr_factory_; |
219 | 219 |
220 DISALLOW_COPY_AND_ASSIGN(MTPDeviceDelegateImplWin); | 220 DISALLOW_COPY_AND_ASSIGN(MTPDeviceDelegateImplWin); |
221 }; | 221 }; |
222 | 222 |
223 #endif // CHROME_BROWSER_MEDIA_GALLERIES_WIN_MTP_DEVICE_DELEGATE_IMPL_WIN_H_ | 223 #endif // CHROME_BROWSER_MEDIA_GALLERIES_WIN_MTP_DEVICE_DELEGATE_IMPL_WIN_H_ |
OLD | NEW |