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/safe_numerics.h" | 10 #include "base/safe_numerics.h" |
11 #include "chrome/browser/media_galleries/linux/snapshot_file_details.h" | 11 #include "chrome/browser/media_galleries/linux/snapshot_file_details.h" |
12 #include "chrome/browser/storage_monitor/storage_monitor.h" | 12 #include "chrome/browser/storage_monitor/storage_monitor.h" |
13 #include "content/public/browser/browser_thread.h" | 13 #include "content/public/browser/browser_thread.h" |
14 #include "device/media_transfer_protocol/media_transfer_protocol_manager.h" | 14 #include "device/media_transfer_protocol/media_transfer_protocol_manager.h" |
15 #include "third_party/cros_system_api/dbus/service_constants.h" | 15 #include "third_party/cros_system_api/dbus/service_constants.h" |
16 | 16 |
17 using content::BrowserThread; | 17 using content::BrowserThread; |
18 | 18 |
19 namespace chrome { | |
20 | |
21 namespace { | 19 namespace { |
22 | 20 |
23 // Appends |data| to the snapshot file specified by the |snapshot_file_path| on | 21 // Appends |data| to the snapshot file specified by the |snapshot_file_path| on |
24 // the file thread. | 22 // the file thread. |
25 // Returns the number of bytes written to the snapshot file. In case of failure, | 23 // Returns the number of bytes written to the snapshot file. In case of failure, |
26 // returns zero. | 24 // returns zero. |
27 uint32 WriteDataChunkIntoSnapshotFileOnFileThread( | 25 uint32 WriteDataChunkIntoSnapshotFileOnFileThread( |
28 const base::FilePath& snapshot_file_path, | 26 const base::FilePath& snapshot_file_path, |
29 const std::string& data) { | 27 const std::string& data) { |
30 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::FILE)); | 28 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::FILE)); |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 base::PLATFORM_FILE_ERROR_FAILED)); | 131 base::PLATFORM_FILE_ERROR_FAILED)); |
134 return; | 132 return; |
135 } | 133 } |
136 content::BrowserThread::PostTask( | 134 content::BrowserThread::PostTask( |
137 content::BrowserThread::IO, | 135 content::BrowserThread::IO, |
138 FROM_HERE, | 136 FROM_HERE, |
139 base::Bind(snapshot_file_details->success_callback(), | 137 base::Bind(snapshot_file_details->success_callback(), |
140 snapshot_file_details->file_info(), | 138 snapshot_file_details->file_info(), |
141 snapshot_file_details->snapshot_file_path())); | 139 snapshot_file_details->snapshot_file_path())); |
142 } | 140 } |
143 | |
144 } // namespace chrome | |
OLD | NEW |