OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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 #include "chrome/browser/media_galleries/linux/mtp_device_task_helper.h" | 5 #include "chrome/browser/media_galleries/linux/mtp_device_task_helper.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "chrome/browser/media_galleries/linux/mtp_device_object_enumerator.h" | 8 #include "chrome/browser/media_galleries/linux/mtp_device_object_enumerator.h" |
9 #include "chrome/browser/media_galleries/linux/mtp_read_file_worker.h" | 9 #include "chrome/browser/media_galleries/linux/mtp_read_file_worker.h" |
10 #include "chrome/browser/media_galleries/linux/snapshot_file_details.h" | 10 #include "chrome/browser/media_galleries/linux/snapshot_file_details.h" |
| 11 #include "chrome/browser/storage_monitor/storage_monitor.h" |
11 #include "content/public/browser/browser_thread.h" | 12 #include "content/public/browser/browser_thread.h" |
12 #include "device/media_transfer_protocol/media_transfer_protocol_manager.h" | 13 #include "device/media_transfer_protocol/media_transfer_protocol_manager.h" |
13 #include "third_party/cros_system_api/dbus/service_constants.h" | 14 #include "third_party/cros_system_api/dbus/service_constants.h" |
14 #include "webkit/fileapi/async_file_util.h" | 15 #include "webkit/fileapi/async_file_util.h" |
15 #include "webkit/fileapi/file_system_util.h" | 16 #include "webkit/fileapi/file_system_util.h" |
16 | 17 |
17 namespace chrome { | 18 namespace chrome { |
18 | 19 |
19 namespace { | 20 namespace { |
20 | 21 |
21 // Does nothing. | 22 // Does nothing. |
22 // This method is used to handle the results of | 23 // This method is used to handle the results of |
23 // MediaTransferProtocolManager::CloseStorage method call. | 24 // MediaTransferProtocolManager::CloseStorage method call. |
24 void DoNothing(bool error) { | 25 void DoNothing(bool error) { |
25 } | 26 } |
26 | 27 |
27 device::MediaTransferProtocolManager* GetMediaTransferProtocolManager() { | 28 device::MediaTransferProtocolManager* GetMediaTransferProtocolManager() { |
28 device::MediaTransferProtocolManager* mtp_device_mgr = | 29 return StorageMonitor::GetInstance()->media_transfer_protocol_manager(); |
29 device::MediaTransferProtocolManager::GetInstance(); | |
30 DCHECK(mtp_device_mgr); | |
31 return mtp_device_mgr; | |
32 } | 30 } |
33 | 31 |
34 } // namespace | 32 } // namespace |
35 | 33 |
36 MTPDeviceTaskHelper::MTPDeviceTaskHelper() | 34 MTPDeviceTaskHelper::MTPDeviceTaskHelper() |
37 : ALLOW_THIS_IN_INITIALIZER_LIST(weak_ptr_factory_(this)) { | 35 : ALLOW_THIS_IN_INITIALIZER_LIST(weak_ptr_factory_(this)) { |
38 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); | 36 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |
39 } | 37 } |
40 | 38 |
41 MTPDeviceTaskHelper::~MTPDeviceTaskHelper() { | 39 MTPDeviceTaskHelper::~MTPDeviceTaskHelper() { |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 void MTPDeviceTaskHelper::HandleDeviceError( | 177 void MTPDeviceTaskHelper::HandleDeviceError( |
180 const ErrorCallback& error_callback, | 178 const ErrorCallback& error_callback, |
181 base::PlatformFileError error) const { | 179 base::PlatformFileError error) const { |
182 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); | 180 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |
183 content::BrowserThread::PostTask(content::BrowserThread::IO, | 181 content::BrowserThread::PostTask(content::BrowserThread::IO, |
184 FROM_HERE, | 182 FROM_HERE, |
185 base::Bind(error_callback, error)); | 183 base::Bind(error_callback, error)); |
186 } | 184 } |
187 | 185 |
188 } // namespace chrome | 186 } // namespace chrome |
OLD | NEW |