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 #ifndef CHROME_BROWSER_CHROMEOS_DRIVE_FILEAPI_WEBKIT_FILE_STREAM_WRITER_IMPL_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_DRIVE_FILEAPI_WEBKIT_FILE_STREAM_WRITER_IMPL_H_ |
6 #define CHROME_BROWSER_CHROMEOS_DRIVE_FILEAPI_WEBKIT_FILE_STREAM_WRITER_IMPL_H_ | 6 #define CHROME_BROWSER_CHROMEOS_DRIVE_FILEAPI_WEBKIT_FILE_STREAM_WRITER_IMPL_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "base/files/file.h" | 10 #include "base/files/file.h" |
(...skipping 26 matching lines...) Expand all Loading... |
37 typedef base::Callback<FileSystemInterface*()> FileSystemGetter; | 37 typedef base::Callback<FileSystemInterface*()> FileSystemGetter; |
38 | 38 |
39 // Creates a writer for a file at |file_path| on FileSystem returned by | 39 // Creates a writer for a file at |file_path| on FileSystem returned by |
40 // |file_system_getter| that starts writing from |offset|. | 40 // |file_system_getter| that starts writing from |offset|. |
41 // When invalid parameters are set, the first call to Write() method fails. | 41 // When invalid parameters are set, the first call to Write() method fails. |
42 // Uses |file_task_runner| for local file operations. | 42 // Uses |file_task_runner| for local file operations. |
43 WebkitFileStreamWriterImpl(const FileSystemGetter& file_system_getter, | 43 WebkitFileStreamWriterImpl(const FileSystemGetter& file_system_getter, |
44 base::TaskRunner* file_task_runner, | 44 base::TaskRunner* file_task_runner, |
45 const base::FilePath& file_path, | 45 const base::FilePath& file_path, |
46 int64 offset); | 46 int64 offset); |
47 virtual ~WebkitFileStreamWriterImpl(); | 47 ~WebkitFileStreamWriterImpl() override; |
48 | 48 |
49 // FileWriter override. | 49 // FileWriter override. |
50 virtual int Write(net::IOBuffer* buf, int buf_len, | 50 int Write(net::IOBuffer* buf, |
51 const net::CompletionCallback& callback) override; | 51 int buf_len, |
52 virtual int Cancel(const net::CompletionCallback& callback) override; | 52 const net::CompletionCallback& callback) override; |
53 virtual int Flush(const net::CompletionCallback& callback) override; | 53 int Cancel(const net::CompletionCallback& callback) override; |
| 54 int Flush(const net::CompletionCallback& callback) override; |
54 | 55 |
55 private: | 56 private: |
56 // Part of Write(). Called after CreateWritableSnapshotFile is completed. | 57 // Part of Write(). Called after CreateWritableSnapshotFile is completed. |
57 void WriteAfterCreateWritableSnapshotFile( | 58 void WriteAfterCreateWritableSnapshotFile( |
58 net::IOBuffer* buf, | 59 net::IOBuffer* buf, |
59 int buf_len, | 60 int buf_len, |
60 base::File::Error open_result, | 61 base::File::Error open_result, |
61 const base::FilePath& local_path, | 62 const base::FilePath& local_path, |
62 const base::Closure& close_callback_on_ui_thread); | 63 const base::Closure& close_callback_on_ui_thread); |
63 | 64 |
(...skipping 11 matching lines...) Expand all Loading... |
75 // invalidate the weak pointers before any other members are destroyed. | 76 // invalidate the weak pointers before any other members are destroyed. |
76 base::WeakPtrFactory<WebkitFileStreamWriterImpl> weak_ptr_factory_; | 77 base::WeakPtrFactory<WebkitFileStreamWriterImpl> weak_ptr_factory_; |
77 | 78 |
78 DISALLOW_COPY_AND_ASSIGN(WebkitFileStreamWriterImpl); | 79 DISALLOW_COPY_AND_ASSIGN(WebkitFileStreamWriterImpl); |
79 }; | 80 }; |
80 | 81 |
81 } // namespace internal | 82 } // namespace internal |
82 } // namespace drive | 83 } // namespace drive |
83 | 84 |
84 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_FILEAPI_WEBKIT_FILE_STREAM_WRITER_IMPL_
H_ | 85 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_FILEAPI_WEBKIT_FILE_STREAM_WRITER_IMPL_
H_ |
OLD | NEW |