| 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 #include "webkit/fileapi/file_writer_delegate.h" | 5 #include "webkit/fileapi/file_writer_delegate.h" |
| 6 | 6 |
| 7 #include "base/file_util_proxy.h" | 7 #include "base/file_util_proxy.h" |
| 8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
| 9 #include "base/threading/thread_restrictions.h" | 9 #include "base/threading/thread_restrictions.h" |
| 10 #include "net/base/net_errors.h" | 10 #include "net/base/net_errors.h" |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 file_ = file; | 130 file_ = file; |
| 131 request_ = request; | 131 request_ = request; |
| 132 | 132 |
| 133 scoped_refptr<InitializeTask> relay = new InitializeTask( | 133 scoped_refptr<InitializeTask> relay = new InitializeTask( |
| 134 file_, file_system_operation_context(), | 134 file_, file_system_operation_context(), |
| 135 callback_factory_.NewCallback( | 135 callback_factory_.NewCallback( |
| 136 &FileWriterDelegate::OnGetFileInfoAndCallStartUpdate)); | 136 &FileWriterDelegate::OnGetFileInfoAndCallStartUpdate)); |
| 137 relay->Start(proxy_, FROM_HERE); | 137 relay->Start(proxy_, FROM_HERE); |
| 138 } | 138 } |
| 139 | 139 |
| 140 void FileWriterDelegate::OnReceivedRedirect( | 140 void FileWriterDelegate::OnReceivedRedirect(net::URLRequest* request, |
| 141 net::URLRequest* request, const GURL& new_url, bool* defer_redirect) { | 141 const GURL& new_url, |
| 142 bool* defer_redirect) { |
| 142 NOTREACHED(); | 143 NOTREACHED(); |
| 143 OnError(base::PLATFORM_FILE_ERROR_SECURITY); | 144 OnError(base::PLATFORM_FILE_ERROR_SECURITY); |
| 144 } | 145 } |
| 145 | 146 |
| 146 void FileWriterDelegate::OnAuthRequired( | 147 void FileWriterDelegate::OnAuthRequired(net::URLRequest* request, |
| 147 net::URLRequest* request, net::AuthChallengeInfo* auth_info) { | 148 net::AuthChallengeInfo* auth_info) { |
| 148 NOTREACHED(); | 149 NOTREACHED(); |
| 149 OnError(base::PLATFORM_FILE_ERROR_SECURITY); | 150 OnError(base::PLATFORM_FILE_ERROR_SECURITY); |
| 150 } | 151 } |
| 151 | 152 |
| 152 void FileWriterDelegate::OnCertificateRequested( | 153 void FileWriterDelegate::OnCertificateRequested( |
| 153 net::URLRequest* request, net::SSLCertRequestInfo* cert_request_info) { | 154 net::URLRequest* request, |
| 155 net::SSLCertRequestInfo* cert_request_info) { |
| 154 NOTREACHED(); | 156 NOTREACHED(); |
| 155 OnError(base::PLATFORM_FILE_ERROR_SECURITY); | 157 OnError(base::PLATFORM_FILE_ERROR_SECURITY); |
| 156 } | 158 } |
| 157 | 159 |
| 158 void FileWriterDelegate::OnSSLCertificateError( | 160 void FileWriterDelegate::OnSSLCertificateError(net::URLRequest* request, |
| 159 net::URLRequest* request, int cert_error, net::X509Certificate* cert) { | 161 const net::SSLInfo& ssl_info, |
| 162 bool is_hsts_host) { |
| 160 NOTREACHED(); | 163 NOTREACHED(); |
| 161 OnError(base::PLATFORM_FILE_ERROR_SECURITY); | 164 OnError(base::PLATFORM_FILE_ERROR_SECURITY); |
| 162 } | 165 } |
| 163 | 166 |
| 164 void FileWriterDelegate::OnResponseStarted(net::URLRequest* request) { | 167 void FileWriterDelegate::OnResponseStarted(net::URLRequest* request) { |
| 165 DCHECK_EQ(request_, request); | 168 DCHECK_EQ(request_, request); |
| 166 // file_stream_->Seek() blocks the IO thread. | 169 // file_stream_->Seek() blocks the IO thread. |
| 167 // See http://crbug.com/75548. | 170 // See http://crbug.com/75548. |
| 168 base::ThreadRestrictions::ScopedAllowIO allow_io; | 171 base::ThreadRestrictions::ScopedAllowIO allow_io; |
| 169 if (!request->status().is_success()) { | 172 if (!request->status().is_success()) { |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 313 | 316 |
| 314 FileSystemQuotaUtil* FileWriterDelegate::quota_util() const { | 317 FileSystemQuotaUtil* FileWriterDelegate::quota_util() const { |
| 315 DCHECK(file_system_operation_); | 318 DCHECK(file_system_operation_); |
| 316 DCHECK(file_system_operation_->file_system_context()); | 319 DCHECK(file_system_operation_->file_system_context()); |
| 317 DCHECK(file_system_operation_->file_system_operation_context()); | 320 DCHECK(file_system_operation_->file_system_operation_context()); |
| 318 return file_system_operation_->file_system_context()->GetQuotaUtil( | 321 return file_system_operation_->file_system_context()->GetQuotaUtil( |
| 319 file_system_operation_context()->src_type()); | 322 file_system_operation_context()->src_type()); |
| 320 } | 323 } |
| 321 | 324 |
| 322 } // namespace fileapi | 325 } // namespace fileapi |
| OLD | NEW |