OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/chromeos/drive/fileapi/webkit_file_stream_writer_impl.h
" | 5 #include "chrome/browser/chromeos/drive/fileapi/webkit_file_stream_writer_impl.h
" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/callback_helpers.h" | 8 #include "base/callback_helpers.h" |
9 #include "chrome/browser/chromeos/drive/file_system_util.h" | 9 #include "chrome/browser/chromeos/drive/file_system_util.h" |
10 #include "chrome/browser/chromeos/drive/fileapi/fileapi_worker.h" | 10 #include "chrome/browser/chromeos/drive/fileapi/fileapi_worker.h" |
11 #include "content/public/browser/browser_thread.h" | 11 #include "content/public/browser/browser_thread.h" |
12 #include "google_apis/drive/task_util.h" | 12 #include "google_apis/drive/task_util.h" |
13 #include "net/base/io_buffer.h" | 13 #include "net/base/io_buffer.h" |
14 #include "net/base/net_errors.h" | 14 #include "net/base/net_errors.h" |
15 #include "storage/browser/fileapi/file_stream_writer.h" | 15 #include "storage/browser/fileapi/file_stream_writer.h" |
16 | 16 |
17 using content::BrowserThread; | 17 using content::BrowserThread; |
18 | 18 |
19 namespace drive { | 19 namespace drive { |
20 namespace internal { | 20 namespace internal { |
21 namespace { | 21 namespace { |
22 | 22 |
23 // Creates a writable snapshot file of the |drive_path|. | 23 // Creates a writable snapshot file of the |drive_path|. |
24 void CreateWritableSnapshotFile( | 24 void CreateWritableSnapshotFile( |
25 const WebkitFileStreamWriterImpl::FileSystemGetter& file_system_getter, | 25 const WebkitFileStreamWriterImpl::FileSystemGetter& file_system_getter, |
26 const base::FilePath& drive_path, | 26 const base::FilePath& drive_path, |
27 const fileapi_internal::CreateWritableSnapshotFileCallback& callback) { | 27 const fileapi_internal::CreateWritableSnapshotFileCallback& callback) { |
28 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 28 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
29 | 29 |
30 BrowserThread::PostTask( | 30 BrowserThread::PostTask( |
31 BrowserThread::UI, | 31 BrowserThread::UI, |
32 FROM_HERE, | 32 FROM_HERE, |
33 base::Bind( | 33 base::Bind( |
34 &fileapi_internal::RunFileSystemCallback, | 34 &fileapi_internal::RunFileSystemCallback, |
35 file_system_getter, | 35 file_system_getter, |
36 base::Bind(&fileapi_internal::CreateWritableSnapshotFile, | 36 base::Bind(&fileapi_internal::CreateWritableSnapshotFile, |
37 drive_path, google_apis::CreateRelayCallback(callback)), | 37 drive_path, google_apis::CreateRelayCallback(callback)), |
38 google_apis::CreateRelayCallback(base::Bind( | 38 google_apis::CreateRelayCallback(base::Bind( |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 local_path, | 173 local_path, |
174 offset_, | 174 offset_, |
175 storage::FileStreamWriter::OPEN_EXISTING_FILE)); | 175 storage::FileStreamWriter::OPEN_EXISTING_FILE)); |
176 int result = local_file_writer_->Write(buf, buf_len, callback); | 176 int result = local_file_writer_->Write(buf, buf_len, callback); |
177 if (result != net::ERR_IO_PENDING) | 177 if (result != net::ERR_IO_PENDING) |
178 callback.Run(result); | 178 callback.Run(result); |
179 } | 179 } |
180 | 180 |
181 } // namespace internal | 181 } // namespace internal |
182 } // namespace drive | 182 } // namespace drive |
OLD | NEW |