| 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 "webkit/browser/fileapi/sandbox_file_stream_writer.h" | 5 #include "webkit/browser/fileapi/sandbox_file_stream_writer.h" |
| 6 | 6 |
| 7 #include "base/files/file_util_proxy.h" | 7 #include "base/files/file_util_proxy.h" |
| 8 #include "base/platform_file.h" | 8 #include "base/platform_file.h" |
| 9 #include "base/sequenced_task_runner.h" | 9 #include "base/sequenced_task_runner.h" |
| 10 #include "net/base/io_buffer.h" | 10 #include "net/base/io_buffer.h" |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 has_pending_operation_ = false; | 109 has_pending_operation_ = false; |
| 110 return result; | 110 return result; |
| 111 } | 111 } |
| 112 | 112 |
| 113 void SandboxFileStreamWriter::DidCreateSnapshotFile( | 113 void SandboxFileStreamWriter::DidCreateSnapshotFile( |
| 114 const net::CompletionCallback& callback, | 114 const net::CompletionCallback& callback, |
| 115 base::PlatformFileError file_error, | 115 base::PlatformFileError file_error, |
| 116 const base::PlatformFileInfo& file_info, | 116 const base::PlatformFileInfo& file_info, |
| 117 const base::FilePath& platform_path, | 117 const base::FilePath& platform_path, |
| 118 const scoped_refptr<webkit_blob::ShareableFileReference>& file_ref) { | 118 const scoped_refptr<webkit_blob::ShareableFileReference>& file_ref) { |
| 119 DCHECK(!file_ref); | 119 DCHECK(!file_ref.get()); |
| 120 | 120 |
| 121 if (CancelIfRequested()) | 121 if (CancelIfRequested()) |
| 122 return; | 122 return; |
| 123 if (file_error != base::PLATFORM_FILE_OK) { | 123 if (file_error != base::PLATFORM_FILE_OK) { |
| 124 callback.Run(net::PlatformFileErrorToNetError(file_error)); | 124 callback.Run(net::PlatformFileErrorToNetError(file_error)); |
| 125 return; | 125 return; |
| 126 } | 126 } |
| 127 if (file_info.is_directory) { | 127 if (file_info.is_directory) { |
| 128 // We should not be writing to a directory. | 128 // We should not be writing to a directory. |
| 129 callback.Run(net::ERR_ACCESS_DENIED); | 129 callback.Run(net::ERR_ACCESS_DENIED); |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 DCHECK(cancel_callback_.is_null()); | 235 DCHECK(cancel_callback_.is_null()); |
| 236 | 236 |
| 237 // Write() is not called yet, so there's nothing to flush. | 237 // Write() is not called yet, so there's nothing to flush. |
| 238 if (!local_file_writer_) | 238 if (!local_file_writer_) |
| 239 return net::OK; | 239 return net::OK; |
| 240 | 240 |
| 241 return local_file_writer_->Flush(callback); | 241 return local_file_writer_->Flush(callback); |
| 242 } | 242 } |
| 243 | 243 |
| 244 } // namespace fileapi | 244 } // namespace fileapi |
| OLD | NEW |