OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_delegate_impl_linux.h" | 5 #include "chrome/browser/media_galleries/linux/mtp_device_delegate_impl_linux.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 void ReadDirectoryOnUIThread( | 94 void ReadDirectoryOnUIThread( |
95 const std::string& storage_name, | 95 const std::string& storage_name, |
96 uint32 dir_id, | 96 uint32 dir_id, |
97 const MTPDeviceTaskHelper::ReadDirectorySuccessCallback& success_callback, | 97 const MTPDeviceTaskHelper::ReadDirectorySuccessCallback& success_callback, |
98 const MTPDeviceTaskHelper::ErrorCallback& error_callback) { | 98 const MTPDeviceTaskHelper::ErrorCallback& error_callback) { |
99 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 99 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
100 MTPDeviceTaskHelper* task_helper = | 100 MTPDeviceTaskHelper* task_helper = |
101 GetDeviceTaskHelperForStorage(storage_name); | 101 GetDeviceTaskHelperForStorage(storage_name); |
102 if (!task_helper) | 102 if (!task_helper) |
103 return; | 103 return; |
104 task_helper->ReadDirectoryById(dir_id, success_callback, error_callback); | 104 task_helper->ReadDirectory(dir_id, success_callback, error_callback); |
105 } | 105 } |
106 | 106 |
107 // Gets the |file_path| details. | 107 // Gets the |file_path| details. |
108 // | 108 // |
109 // Called on the UI thread to dispatch the request to the | 109 // Called on the UI thread to dispatch the request to the |
110 // MediaTransferProtocolManager. | 110 // MediaTransferProtocolManager. |
111 // | 111 // |
112 // |storage_name| specifies the name of the storage device. | 112 // |storage_name| specifies the name of the storage device. |
113 // |success_callback| is called when the GetFileInfo request succeeds. | 113 // |success_callback| is called when the GetFileInfo request succeeds. |
114 // |error_callback| is called when the GetFileInfo request fails. | 114 // |error_callback| is called when the GetFileInfo request fails. |
115 // |success_callback| and |error_callback| runs on the IO thread. | 115 // |success_callback| and |error_callback| runs on the IO thread. |
116 void GetFileInfoOnUIThread( | 116 void GetFileInfoOnUIThread( |
117 const std::string& storage_name, | 117 const std::string& storage_name, |
118 uint32 file_id, | 118 uint32 file_id, |
119 const MTPDeviceTaskHelper::GetFileInfoSuccessCallback& success_callback, | 119 const MTPDeviceTaskHelper::GetFileInfoSuccessCallback& success_callback, |
120 const MTPDeviceTaskHelper::ErrorCallback& error_callback) { | 120 const MTPDeviceTaskHelper::ErrorCallback& error_callback) { |
121 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 121 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
122 MTPDeviceTaskHelper* task_helper = | 122 MTPDeviceTaskHelper* task_helper = |
123 GetDeviceTaskHelperForStorage(storage_name); | 123 GetDeviceTaskHelperForStorage(storage_name); |
124 if (!task_helper) | 124 if (!task_helper) |
125 return; | 125 return; |
126 task_helper->GetFileInfoById(file_id, success_callback, error_callback); | 126 task_helper->GetFileInfo(file_id, success_callback, error_callback); |
127 } | 127 } |
128 | 128 |
129 // Copies the contents of |device_file_path| to |snapshot_file_path|. | 129 // Copies the contents of |device_file_path| to |snapshot_file_path|. |
130 // | 130 // |
131 // Called on the UI thread to dispatch the request to the | 131 // Called on the UI thread to dispatch the request to the |
132 // MediaTransferProtocolManager. | 132 // MediaTransferProtocolManager. |
133 // | 133 // |
134 // |storage_name| specifies the name of the storage device. | 134 // |storage_name| specifies the name of the storage device. |
135 // |device_file_path| specifies the media device file path. | 135 // |device_file_path| specifies the media device file path. |
136 // |snapshot_file_path| specifies the platform path of the snapshot file. | 136 // |snapshot_file_path| specifies the platform path of the snapshot file. |
(...skipping 761 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
898 *id = current_node->file_id(); | 898 *id = current_node->file_id(); |
899 return true; | 899 return true; |
900 } | 900 } |
901 | 901 |
902 void CreateMTPDeviceAsyncDelegate( | 902 void CreateMTPDeviceAsyncDelegate( |
903 const std::string& device_location, | 903 const std::string& device_location, |
904 const CreateMTPDeviceAsyncDelegateCallback& callback) { | 904 const CreateMTPDeviceAsyncDelegateCallback& callback) { |
905 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); | 905 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); |
906 callback.Run(new MTPDeviceDelegateImplLinux(device_location)); | 906 callback.Run(new MTPDeviceDelegateImplLinux(device_location)); |
907 } | 907 } |
OLD | NEW |