Index: webkit/browser/fileapi/local_file_stream_writer.cc |
diff --git a/webkit/browser/fileapi/local_file_stream_writer.cc b/webkit/browser/fileapi/local_file_stream_writer.cc |
index 3f779c969ed0619ffe8c27c2b93789a7d68fe271..743baa630b7c4c2bceadc7cb0bfc5a11acd8fbf9 100644 |
--- a/webkit/browser/fileapi/local_file_stream_writer.cc |
+++ b/webkit/browser/fileapi/local_file_stream_writer.cc |
@@ -17,13 +17,18 @@ namespace { |
const int kOpenFlagsForWrite = base::PLATFORM_FILE_OPEN | |
base::PLATFORM_FILE_WRITE | |
base::PLATFORM_FILE_ASYNC; |
+const int kCreateFlagsForWrite = base::PLATFORM_FILE_CREATE | |
+ base::PLATFORM_FILE_WRITE | |
+ base::PLATFORM_FILE_ASYNC; |
} // namespace |
LocalFileStreamWriter::LocalFileStreamWriter(base::TaskRunner* task_runner, |
const base::FilePath& file_path, |
- int64 initial_offset) |
+ int64 initial_offset, |
+ bool open_not_create) |
: file_path_(file_path), |
+ open_not_create_(open_not_create), |
initial_offset_(initial_offset), |
has_pending_operation_(false), |
weak_factory_(this), |
@@ -90,7 +95,8 @@ int LocalFileStreamWriter::InitiateOpen( |
stream_impl_.reset(new net::FileStream(NULL, task_runner_)); |
return stream_impl_->Open(file_path_, |
- kOpenFlagsForWrite, |
+ open_not_create_ ? kOpenFlagsForWrite : |
+ kCreateFlagsForWrite, |
base::Bind(&LocalFileStreamWriter::DidOpen, |
weak_factory_.GetWeakPtr(), |
error_callback, |