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_LOCAL_FILE_WRITER_H_ | 5 #ifndef WEBKIT_FILEAPI_LOCAL_FILE_WRITER_H_ |
6 #define WEBKIT_FILEAPI_LOCAL_FILE_WRITER_H_ | 6 #define WEBKIT_FILEAPI_LOCAL_FILE_WRITER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
12 #include "base/callback.h" | 12 #include "base/callback.h" |
13 #include "base/file_path.h" | 13 #include "base/file_path.h" |
14 #include "base/platform_file.h" | 14 #include "base/platform_file.h" |
15 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
16 #include "base/memory/weak_ptr.h" | 16 #include "base/memory/weak_ptr.h" |
| 17 #include "webkit/fileapi/fileapi_export.h" |
17 #include "webkit/fileapi/file_writer.h" | 18 #include "webkit/fileapi/file_writer.h" |
18 | 19 |
19 namespace net { | 20 namespace net { |
20 class FileStream; | 21 class FileStream; |
21 } | 22 } |
22 | 23 |
23 namespace fileapi { | 24 namespace fileapi { |
24 | 25 |
25 // This class is a thin wrapper around net::FileStream for writing local files. | 26 // This class is a thin wrapper around net::FileStream for writing local files. |
26 class LocalFileWriter : public FileWriter { | 27 class FILEAPI_EXPORT_PRIVATE LocalFileWriter : public FileWriter { |
27 public: | 28 public: |
28 // Create a writer for the existing file in the path |file_path| starting from | 29 // Create a writer for the existing file in the path |file_path| starting from |
29 // |initial_offset|. | 30 // |initial_offset|. |
30 LocalFileWriter(const FilePath& file_path, int64 initial_offset); | 31 LocalFileWriter(const FilePath& file_path, int64 initial_offset); |
31 virtual ~LocalFileWriter(); | 32 virtual ~LocalFileWriter(); |
32 | 33 |
33 // FileWriter overrides. | 34 // FileWriter overrides. |
34 virtual int Write(net::IOBuffer* buf, int buf_len, | 35 virtual int Write(net::IOBuffer* buf, int buf_len, |
35 const net::CompletionCallback& callback) OVERRIDE; | 36 const net::CompletionCallback& callback) OVERRIDE; |
36 virtual int Cancel(const net::CompletionCallback& callback) OVERRIDE; | 37 virtual int Cancel(const net::CompletionCallback& callback) OVERRIDE; |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 scoped_ptr<net::FileStream> stream_impl_; | 75 scoped_ptr<net::FileStream> stream_impl_; |
75 net::CompletionCallback cancel_callback_; | 76 net::CompletionCallback cancel_callback_; |
76 | 77 |
77 base::WeakPtrFactory<LocalFileWriter> weak_factory_; | 78 base::WeakPtrFactory<LocalFileWriter> weak_factory_; |
78 DISALLOW_COPY_AND_ASSIGN(LocalFileWriter); | 79 DISALLOW_COPY_AND_ASSIGN(LocalFileWriter); |
79 }; | 80 }; |
80 | 81 |
81 } // namespace fileapi | 82 } // namespace fileapi |
82 | 83 |
83 #endif // WEBKIT_FILEAPI_LOCAL_FILE_WRITER_H_ | 84 #endif // WEBKIT_FILEAPI_LOCAL_FILE_WRITER_H_ |
OLD | NEW |