| 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 #ifndef WEBKIT_FILEAPI_SANDBOX_FILE_STREAM_WRITER_H_ | 5 #ifndef WEBKIT_FILEAPI_SANDBOX_FILE_STREAM_WRITER_H_ |
| 6 #define WEBKIT_FILEAPI_SANDBOX_FILE_STREAM_WRITER_H_ | 6 #define WEBKIT_FILEAPI_SANDBOX_FILE_STREAM_WRITER_H_ |
| 7 | 7 |
| 8 #include "base/file_path.h" | 8 #include "base/file_path.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/platform_file.h" | 10 #include "base/platform_file.h" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 private: | 45 private: |
| 46 // Performs quota calculation and calls local_file_writer_->Write(). | 46 // Performs quota calculation and calls local_file_writer_->Write(). |
| 47 int WriteInternal(net::IOBuffer* buf, int buf_len, | 47 int WriteInternal(net::IOBuffer* buf, int buf_len, |
| 48 const net::CompletionCallback& callback); | 48 const net::CompletionCallback& callback); |
| 49 | 49 |
| 50 // Callbacks that are chained for the first write. This eventually calls | 50 // Callbacks that are chained for the first write. This eventually calls |
| 51 // WriteInternal. | 51 // WriteInternal. |
| 52 void DidGetFileInfo(const net::CompletionCallback& callback, | 52 void DidGetFileInfo(const net::CompletionCallback& callback, |
| 53 base::PlatformFileError file_error, | 53 base::PlatformFileError file_error, |
| 54 const base::PlatformFileInfo& file_info, | 54 const base::PlatformFileInfo& file_info, |
| 55 const FilePath& platform_path); | 55 const base::FilePath& platform_path); |
| 56 void DidGetUsageAndQuota(const net::CompletionCallback& callback, | 56 void DidGetUsageAndQuota(const net::CompletionCallback& callback, |
| 57 quota::QuotaStatusCode status, | 57 quota::QuotaStatusCode status, |
| 58 int64 usage, int64 quota); | 58 int64 usage, int64 quota); |
| 59 void DidInitializeForWrite(net::IOBuffer* buf, int buf_len, | 59 void DidInitializeForWrite(net::IOBuffer* buf, int buf_len, |
| 60 const net::CompletionCallback& callback, | 60 const net::CompletionCallback& callback, |
| 61 int init_status); | 61 int init_status); |
| 62 | 62 |
| 63 void DidWrite(const net::CompletionCallback& callback, int write_response); | 63 void DidWrite(const net::CompletionCallback& callback, int write_response); |
| 64 | 64 |
| 65 // Stops the in-flight operation, calls |cancel_callback_| and returns true | 65 // Stops the in-flight operation, calls |cancel_callback_| and returns true |
| 66 // if there's a pending cancel request. | 66 // if there's a pending cancel request. |
| 67 bool CancelIfRequested(); | 67 bool CancelIfRequested(); |
| 68 | 68 |
| 69 scoped_refptr<FileSystemContext> file_system_context_; | 69 scoped_refptr<FileSystemContext> file_system_context_; |
| 70 FileSystemURL url_; | 70 FileSystemURL url_; |
| 71 int64 initial_offset_; | 71 int64 initial_offset_; |
| 72 scoped_ptr<LocalFileStreamWriter> local_file_writer_; | 72 scoped_ptr<LocalFileStreamWriter> local_file_writer_; |
| 73 net::CompletionCallback cancel_callback_; | 73 net::CompletionCallback cancel_callback_; |
| 74 | 74 |
| 75 UpdateObserverList observers_; | 75 UpdateObserverList observers_; |
| 76 | 76 |
| 77 FilePath file_path_; | 77 base::FilePath file_path_; |
| 78 int64 file_size_; | 78 int64 file_size_; |
| 79 int64 total_bytes_written_; | 79 int64 total_bytes_written_; |
| 80 int64 allowed_bytes_to_write_; | 80 int64 allowed_bytes_to_write_; |
| 81 bool has_pending_operation_; | 81 bool has_pending_operation_; |
| 82 | 82 |
| 83 int64 default_quota_; | 83 int64 default_quota_; |
| 84 | 84 |
| 85 base::WeakPtrFactory<SandboxFileStreamWriter> weak_factory_; | 85 base::WeakPtrFactory<SandboxFileStreamWriter> weak_factory_; |
| 86 | 86 |
| 87 DISALLOW_COPY_AND_ASSIGN(SandboxFileStreamWriter); | 87 DISALLOW_COPY_AND_ASSIGN(SandboxFileStreamWriter); |
| 88 }; | 88 }; |
| 89 | 89 |
| 90 } // namespace fileapi | 90 } // namespace fileapi |
| 91 | 91 |
| 92 #endif // WEBKIT_FILEAPI_SANDBOX_FILE_STREAM_WRITER_H_ | 92 #endif // WEBKIT_FILEAPI_SANDBOX_FILE_STREAM_WRITER_H_ |
| OLD | NEW |