diff options
author | ericu@google.com <ericu@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-07 23:24:38 +0000 |
---|---|---|
committer | ericu@google.com <ericu@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-07 23:24:38 +0000 |
commit | bd1523876a769c375e0a40b8cfe8c999f40e6e99 (patch) | |
tree | 2a2f91b4feee685386936f897f84a41d99d8e721 /webkit/fileapi/file_writer_delegate.h | |
parent | e7dd6d8bb28270d49684714aa03f8162ab558bc6 (diff) | |
download | chromium_src-bd1523876a769c375e0a40b8cfe8c999f40e6e99.zip chromium_src-bd1523876a769c375e0a40b8cfe8c999f40e6e99.tar.gz chromium_src-bd1523876a769c375e0a40b8cfe8c999f40e6e99.tar.bz2 |
Resubmit of http://codereview.chromium.org/3476002/show but without the crashing bug.
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/3618016
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@61879 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/fileapi/file_writer_delegate.h')
-rw-r--r-- | webkit/fileapi/file_writer_delegate.h | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/webkit/fileapi/file_writer_delegate.h b/webkit/fileapi/file_writer_delegate.h new file mode 100644 index 0000000..ed35ce6 --- /dev/null +++ b/webkit/fileapi/file_writer_delegate.h @@ -0,0 +1,71 @@ +// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef WEBKIT_FILEAPI_FILE_WRITER_DELEGATE_H_ +#define WEBKIT_FILEAPI_FILE_WRITER_DELEGATE_H_ + +#include "base/file_path.h" +#include "base/platform_file.h" +#include "base/ref_counted.h" +#include "base/scoped_callback_factory.h" +#include "base/scoped_ptr.h" +#include "base/task.h" +#include "base/time.h" +#include "net/base/file_stream.h" +#include "net/base/io_buffer.h" +#include "net/url_request/url_request.h" + +namespace fileapi { + +class FileSystemOperation; + +class FileWriterDelegate : public URLRequest::Delegate { + public: + FileWriterDelegate( + FileSystemOperation* write_operation, + int64 offset); + virtual ~FileWriterDelegate(); + + void Start(base::PlatformFile file, URLRequest* request); + base::PlatformFile file() { + return file_; + } + + virtual void OnReceivedRedirect( + URLRequest* request, const GURL& new_url, bool* defer_redirect); + virtual void OnAuthRequired( + URLRequest* request, net::AuthChallengeInfo* auth_info); + virtual void OnCertificateRequested( + URLRequest* request, net::SSLCertRequestInfo* cert_request_info); + virtual void OnSSLCertificateError( + URLRequest* request, int cert_error, net::X509Certificate* cert); + virtual void OnResponseStarted(URLRequest* request); + virtual void OnReadCompleted(URLRequest* request, int bytes_read); + + private: + void Read(); + void OnDataReceived(int bytes_read); + void Write(); + void OnDataWritten(int write_response); + void OnError(base::PlatformFileError error); + void OnProgress(int bytes_read, bool done); + + FileSystemOperation* file_system_operation_; + base::PlatformFile file_; + int64 offset_; + base::Time last_progress_event_time_; + int bytes_read_backlog_; + int bytes_written_; + int bytes_read_; + scoped_refptr<net::IOBufferWithSize> io_buffer_; + scoped_ptr<net::FileStream> file_stream_; + URLRequest* request_; + base::ScopedCallbackFactory<FileWriterDelegate> callback_factory_; + ScopedRunnableMethodFactory<FileWriterDelegate> method_factory_; +}; + +} // namespace fileapi + +#endif // WEBKIT_FILEAPI_FILE_WRITER_DELEGATE_H_ + |