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_FILE_WRITER_DELEGATE_H_ | 5 #ifndef WEBKIT_FILEAPI_FILE_WRITER_DELEGATE_H_ |
6 #define WEBKIT_FILEAPI_FILE_WRITER_DELEGATE_H_ | 6 #define WEBKIT_FILEAPI_FILE_WRITER_DELEGATE_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/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
11 #include "base/message_loop_proxy.h" | |
12 #include "base/platform_file.h" | 11 #include "base/platform_file.h" |
13 #include "base/time.h" | 12 #include "base/time.h" |
14 #include "net/base/file_stream.h" | 13 #include "net/base/file_stream.h" |
15 #include "net/base/io_buffer.h" | 14 #include "net/base/io_buffer.h" |
16 #include "net/url_request/url_request.h" | 15 #include "net/url_request/url_request.h" |
17 #include "webkit/fileapi/file_system_path.h" | 16 #include "webkit/fileapi/file_system_path.h" |
18 | 17 |
19 namespace fileapi { | 18 namespace fileapi { |
20 | 19 |
21 class FileSystemOperation; | 20 class FileSystemOperation; |
22 class FileSystemOperationContext; | 21 class FileSystemOperationContext; |
23 class FileSystemQuotaUtil; | 22 class FileSystemQuotaUtil; |
24 | 23 |
25 class FileWriterDelegate : public net::URLRequest::Delegate { | 24 class FileWriterDelegate : public net::URLRequest::Delegate { |
26 public: | 25 public: |
27 FileWriterDelegate( | 26 FileWriterDelegate( |
28 FileSystemOperation* write_operation, | 27 FileSystemOperation* write_operation, |
29 const FileSystemPath& path, | 28 const FileSystemPath& path, |
30 int64 offset, | 29 int64 offset); |
31 scoped_refptr<base::MessageLoopProxy> proxy); | |
32 virtual ~FileWriterDelegate(); | 30 virtual ~FileWriterDelegate(); |
33 | 31 |
34 void Start(base::PlatformFile file, | 32 void Start(base::PlatformFile file, |
35 net::URLRequest* request); | 33 net::URLRequest* request); |
36 base::PlatformFile file() { | 34 base::PlatformFile file() { |
37 return file_; | 35 return file_; |
38 } | 36 } |
39 | 37 |
40 virtual void OnReceivedRedirect(net::URLRequest* request, | 38 virtual void OnReceivedRedirect(net::URLRequest* request, |
41 const GURL& new_url, | 39 const GURL& new_url, |
(...skipping 22 matching lines...) Expand all Loading... |
64 void OnProgress(int bytes_read, bool done); | 62 void OnProgress(int bytes_read, bool done); |
65 | 63 |
66 FileSystemOperationContext* file_system_operation_context() const; | 64 FileSystemOperationContext* file_system_operation_context() const; |
67 FileSystemQuotaUtil* quota_util() const; | 65 FileSystemQuotaUtil* quota_util() const; |
68 | 66 |
69 FileSystemOperation* file_system_operation_; | 67 FileSystemOperation* file_system_operation_; |
70 base::PlatformFile file_; | 68 base::PlatformFile file_; |
71 FileSystemPath path_; | 69 FileSystemPath path_; |
72 int64 size_; | 70 int64 size_; |
73 int64 offset_; | 71 int64 offset_; |
74 scoped_refptr<base::MessageLoopProxy> proxy_; | |
75 base::Time last_progress_event_time_; | 72 base::Time last_progress_event_time_; |
76 int bytes_written_backlog_; | 73 int bytes_written_backlog_; |
77 int bytes_written_; | 74 int bytes_written_; |
78 int bytes_read_; | 75 int bytes_read_; |
79 int64 total_bytes_written_; | 76 int64 total_bytes_written_; |
80 int64 allowed_bytes_to_write_; | 77 int64 allowed_bytes_to_write_; |
81 scoped_refptr<net::IOBufferWithSize> io_buffer_; | 78 scoped_refptr<net::IOBufferWithSize> io_buffer_; |
82 scoped_refptr<net::DrainableIOBuffer> cursor_; | 79 scoped_refptr<net::DrainableIOBuffer> cursor_; |
83 scoped_ptr<net::FileStream> file_stream_; | 80 scoped_ptr<net::FileStream> file_stream_; |
84 net::URLRequest* request_; | 81 net::URLRequest* request_; |
85 base::WeakPtrFactory<FileWriterDelegate> weak_factory_; | 82 base::WeakPtrFactory<FileWriterDelegate> weak_factory_; |
86 }; | 83 }; |
87 | 84 |
88 } // namespace fileapi | 85 } // namespace fileapi |
89 | 86 |
90 #endif // WEBKIT_FILEAPI_FILE_WRITER_DELEGATE_H_ | 87 #endif // WEBKIT_FILEAPI_FILE_WRITER_DELEGATE_H_ |
OLD | NEW |