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_read_file_worker.h" | 5 #include "chrome/browser/media_galleries/linux/mtp_read_file_worker.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
10 #include "base/numerics/safe_conversions.h" | 10 #include "base/numerics/safe_conversions.h" |
(...skipping 29 matching lines...) Expand all Loading... |
40 weak_ptr_factory_(this) { | 40 weak_ptr_factory_(this) { |
41 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); | 41 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |
42 DCHECK(!device_handle_.empty()); | 42 DCHECK(!device_handle_.empty()); |
43 } | 43 } |
44 | 44 |
45 MTPReadFileWorker::~MTPReadFileWorker() { | 45 MTPReadFileWorker::~MTPReadFileWorker() { |
46 } | 46 } |
47 | 47 |
48 void MTPReadFileWorker::WriteDataIntoSnapshotFile( | 48 void MTPReadFileWorker::WriteDataIntoSnapshotFile( |
49 const SnapshotRequestInfo& request_info, | 49 const SnapshotRequestInfo& request_info, |
50 const base::PlatformFileInfo& snapshot_file_info) { | 50 const base::File::Info& snapshot_file_info) { |
51 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); | 51 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |
52 ReadDataChunkFromDeviceFile( | 52 ReadDataChunkFromDeviceFile( |
53 make_scoped_ptr(new SnapshotFileDetails(request_info, | 53 make_scoped_ptr(new SnapshotFileDetails(request_info, |
54 snapshot_file_info))); | 54 snapshot_file_info))); |
55 } | 55 } |
56 | 56 |
57 void MTPReadFileWorker::ReadDataChunkFromDeviceFile( | 57 void MTPReadFileWorker::ReadDataChunkFromDeviceFile( |
58 scoped_ptr<SnapshotFileDetails> snapshot_file_details) { | 58 scoped_ptr<SnapshotFileDetails> snapshot_file_details) { |
59 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); | 59 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |
60 DCHECK(snapshot_file_details.get()); | 60 DCHECK(snapshot_file_details.get()); |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 void MTPReadFileWorker::OnDidWriteIntoSnapshotFile( | 121 void MTPReadFileWorker::OnDidWriteIntoSnapshotFile( |
122 scoped_ptr<SnapshotFileDetails> snapshot_file_details) { | 122 scoped_ptr<SnapshotFileDetails> snapshot_file_details) { |
123 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); | 123 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |
124 DCHECK(snapshot_file_details.get()); | 124 DCHECK(snapshot_file_details.get()); |
125 | 125 |
126 if (snapshot_file_details->error_occurred()) { | 126 if (snapshot_file_details->error_occurred()) { |
127 content::BrowserThread::PostTask( | 127 content::BrowserThread::PostTask( |
128 content::BrowserThread::IO, | 128 content::BrowserThread::IO, |
129 FROM_HERE, | 129 FROM_HERE, |
130 base::Bind(snapshot_file_details->error_callback(), | 130 base::Bind(snapshot_file_details->error_callback(), |
131 base::PLATFORM_FILE_ERROR_FAILED)); | 131 base::File::FILE_ERROR_FAILED)); |
132 return; | 132 return; |
133 } | 133 } |
134 content::BrowserThread::PostTask( | 134 content::BrowserThread::PostTask( |
135 content::BrowserThread::IO, | 135 content::BrowserThread::IO, |
136 FROM_HERE, | 136 FROM_HERE, |
137 base::Bind(snapshot_file_details->success_callback(), | 137 base::Bind(snapshot_file_details->success_callback(), |
138 snapshot_file_details->file_info(), | 138 snapshot_file_details->file_info(), |
139 snapshot_file_details->snapshot_file_path())); | 139 snapshot_file_details->snapshot_file_path())); |
140 } | 140 } |
OLD | NEW |