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/fileapi/sandbox_file_stream_writer.h" | 5 #include "webkit/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 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 callback)); | 114 callback)); |
115 if (result != net::ERR_IO_PENDING) | 115 if (result != net::ERR_IO_PENDING) |
116 has_pending_operation_ = false; | 116 has_pending_operation_ = false; |
117 return result; | 117 return result; |
118 } | 118 } |
119 | 119 |
120 void SandboxFileStreamWriter::DidGetFileInfo( | 120 void SandboxFileStreamWriter::DidGetFileInfo( |
121 const net::CompletionCallback& callback, | 121 const net::CompletionCallback& callback, |
122 base::PlatformFileError file_error, | 122 base::PlatformFileError file_error, |
123 const base::PlatformFileInfo& file_info, | 123 const base::PlatformFileInfo& file_info, |
124 const FilePath& platform_path) { | 124 const base::FilePath& platform_path) { |
125 if (CancelIfRequested()) | 125 if (CancelIfRequested()) |
126 return; | 126 return; |
127 if (file_error != base::PLATFORM_FILE_OK) { | 127 if (file_error != base::PLATFORM_FILE_OK) { |
128 callback.Run(net::PlatformFileErrorToNetError(file_error)); | 128 callback.Run(net::PlatformFileErrorToNetError(file_error)); |
129 return; | 129 return; |
130 } | 130 } |
131 if (file_info.is_directory) { | 131 if (file_info.is_directory) { |
132 // We should not be writing to a directory. | 132 // We should not be writing to a directory. |
133 callback.Run(net::ERR_ACCESS_DENIED); | 133 callback.Run(net::ERR_ACCESS_DENIED); |
134 return; | 134 return; |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 return true; | 234 return true; |
235 } | 235 } |
236 | 236 |
237 int SandboxFileStreamWriter::Flush(const net::CompletionCallback& callback) { | 237 int SandboxFileStreamWriter::Flush(const net::CompletionCallback& callback) { |
238 // For now, Flush is meaningful only for local native file access. It is no-op | 238 // For now, Flush is meaningful only for local native file access. It is no-op |
239 // for sandboxed filesystem files (see the discussion in crbug.com/144790). | 239 // for sandboxed filesystem files (see the discussion in crbug.com/144790). |
240 return net::OK; | 240 return net::OK; |
241 } | 241 } |
242 | 242 |
243 } // namespace fileapi | 243 } // namespace fileapi |
OLD | NEW |