| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 10 #include "base/memory/scoped_callback_factory.h" | 10 #include "base/memory/scoped_callback_factory.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 | 26 |
| 27 class FileWriterDelegate : public net::URLRequest::Delegate { | 27 class FileWriterDelegate : public net::URLRequest::Delegate { |
| 28 public: | 28 public: |
| 29 FileWriterDelegate( | 29 FileWriterDelegate( |
| 30 FileSystemOperation* write_operation, | 30 FileSystemOperation* write_operation, |
| 31 int64 offset, | 31 int64 offset, |
| 32 scoped_refptr<base::MessageLoopProxy> proxy); | 32 scoped_refptr<base::MessageLoopProxy> proxy); |
| 33 virtual ~FileWriterDelegate(); | 33 virtual ~FileWriterDelegate(); |
| 34 | 34 |
| 35 void Start(base::PlatformFile file, | 35 void Start(base::PlatformFile file, |
| 36 int64 file_size, |
| 36 net::URLRequest* request); | 37 net::URLRequest* request); |
| 37 base::PlatformFile file() { | 38 base::PlatformFile file() { |
| 38 return file_; | 39 return file_; |
| 39 } | 40 } |
| 40 | 41 |
| 41 virtual void OnReceivedRedirect( | 42 virtual void OnReceivedRedirect( |
| 42 net::URLRequest* request, const GURL& new_url, bool* defer_redirect); | 43 net::URLRequest* request, const GURL& new_url, bool* defer_redirect); |
| 43 virtual void OnAuthRequired( | 44 virtual void OnAuthRequired( |
| 44 net::URLRequest* request, net::AuthChallengeInfo* auth_info); | 45 net::URLRequest* request, net::AuthChallengeInfo* auth_info); |
| 45 virtual void OnCertificateRequested( | 46 virtual void OnCertificateRequested( |
| 46 net::URLRequest* request, net::SSLCertRequestInfo* cert_request_info); | 47 net::URLRequest* request, net::SSLCertRequestInfo* cert_request_info); |
| 47 virtual void OnSSLCertificateError( | 48 virtual void OnSSLCertificateError( |
| 48 net::URLRequest* request, int cert_error, net::X509Certificate* cert); | 49 net::URLRequest* request, int cert_error, net::X509Certificate* cert); |
| 49 virtual void OnResponseStarted(net::URLRequest* request); | 50 virtual void OnResponseStarted(net::URLRequest* request); |
| 50 virtual void OnReadCompleted(net::URLRequest* request, int bytes_read); | 51 virtual void OnReadCompleted(net::URLRequest* request, int bytes_read); |
| 51 | 52 |
| 52 private: | 53 private: |
| 53 void OnGetFileInfoAndCallStartUpdate( | |
| 54 base::PlatformFileError error, | |
| 55 const base::PlatformFileInfo& file_info); | |
| 56 void Read(); | 54 void Read(); |
| 57 void OnDataReceived(int bytes_read); | 55 void OnDataReceived(int bytes_read); |
| 58 void Write(); | 56 void Write(); |
| 59 void OnDataWritten(int write_response); | 57 void OnDataWritten(int write_response); |
| 60 void OnError(base::PlatformFileError error); | 58 void OnError(base::PlatformFileError error); |
| 61 void OnProgress(int bytes_read, bool done); | 59 void OnProgress(int bytes_read, bool done); |
| 62 | 60 |
| 63 FileSystemOperationContext* file_system_operation_context() const; | 61 FileSystemOperationContext* file_system_operation_context() const; |
| 64 FileSystemQuotaUtil* quota_util() const; | 62 FileSystemQuotaUtil* quota_util() const; |
| 65 | 63 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 78 scoped_ptr<net::FileStream> file_stream_; | 76 scoped_ptr<net::FileStream> file_stream_; |
| 79 net::URLRequest* request_; | 77 net::URLRequest* request_; |
| 80 net::CompletionCallbackImpl<FileWriterDelegate> io_callback_; | 78 net::CompletionCallbackImpl<FileWriterDelegate> io_callback_; |
| 81 ScopedRunnableMethodFactory<FileWriterDelegate> method_factory_; | 79 ScopedRunnableMethodFactory<FileWriterDelegate> method_factory_; |
| 82 base::ScopedCallbackFactory<FileWriterDelegate> callback_factory_; | 80 base::ScopedCallbackFactory<FileWriterDelegate> callback_factory_; |
| 83 }; | 81 }; |
| 84 | 82 |
| 85 } // namespace fileapi | 83 } // namespace fileapi |
| 86 | 84 |
| 87 #endif // WEBKIT_FILEAPI_FILE_WRITER_DELEGATE_H_ | 85 #endif // WEBKIT_FILEAPI_FILE_WRITER_DELEGATE_H_ |
| OLD | NEW |