Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(409)

Side by Side Diff: webkit/fileapi/file_writer_delegate.cc

Issue 5384002: net: Remove typedef net::URLRequest URLRequest; (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review Created 10 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/message_loop.h" 7 #include "base/message_loop.h"
8 #include "net/base/net_errors.h" 8 #include "net/base/net_errors.h"
9 #include "webkit/fileapi/file_system_operation.h" 9 #include "webkit/fileapi/file_system_operation.h"
10 10
(...skipping 11 matching lines...) Expand all
22 bytes_written_(0), 22 bytes_written_(0),
23 bytes_read_(0), 23 bytes_read_(0),
24 io_buffer_(new net::IOBufferWithSize(kReadBufSize)), 24 io_buffer_(new net::IOBufferWithSize(kReadBufSize)),
25 callback_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)), 25 callback_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)),
26 method_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) { 26 method_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) {
27 } 27 }
28 28
29 FileWriterDelegate::~FileWriterDelegate() { 29 FileWriterDelegate::~FileWriterDelegate() {
30 } 30 }
31 31
32 void FileWriterDelegate::Start(base::PlatformFile file, URLRequest* request) { 32 void FileWriterDelegate::Start(base::PlatformFile file,
33 net::URLRequest* request) {
33 file_ = file; 34 file_ = file;
34 request_ = request; 35 request_ = request;
35 file_stream_.reset( 36 file_stream_.reset(
36 new net::FileStream( 37 new net::FileStream(
37 file, 38 file,
38 base::PLATFORM_FILE_OPEN | base::PLATFORM_FILE_WRITE | 39 base::PLATFORM_FILE_OPEN | base::PLATFORM_FILE_WRITE |
39 base::PLATFORM_FILE_ASYNC)); 40 base::PLATFORM_FILE_ASYNC));
40 request_->Start(); 41 request_->Start();
41 } 42 }
42 43
43 void FileWriterDelegate::OnReceivedRedirect( 44 void FileWriterDelegate::OnReceivedRedirect(
44 URLRequest* request, const GURL& new_url, bool* defer_redirect) { 45 net::URLRequest* request, const GURL& new_url, bool* defer_redirect) {
45 NOTREACHED(); 46 NOTREACHED();
46 OnError(base::PLATFORM_FILE_ERROR_SECURITY); 47 OnError(base::PLATFORM_FILE_ERROR_SECURITY);
47 } 48 }
48 49
49 void FileWriterDelegate::OnAuthRequired( 50 void FileWriterDelegate::OnAuthRequired(
50 URLRequest* request, net::AuthChallengeInfo* auth_info) { 51 net::URLRequest* request, net::AuthChallengeInfo* auth_info) {
51 NOTREACHED(); 52 NOTREACHED();
52 OnError(base::PLATFORM_FILE_ERROR_SECURITY); 53 OnError(base::PLATFORM_FILE_ERROR_SECURITY);
53 } 54 }
54 55
55 void FileWriterDelegate::OnCertificateRequested( 56 void FileWriterDelegate::OnCertificateRequested(
56 URLRequest* request, net::SSLCertRequestInfo* cert_request_info) { 57 net::URLRequest* request, net::SSLCertRequestInfo* cert_request_info) {
57 NOTREACHED(); 58 NOTREACHED();
58 OnError(base::PLATFORM_FILE_ERROR_SECURITY); 59 OnError(base::PLATFORM_FILE_ERROR_SECURITY);
59 } 60 }
60 61
61 void FileWriterDelegate::OnSSLCertificateError( 62 void FileWriterDelegate::OnSSLCertificateError(
62 URLRequest* request, int cert_error, net::X509Certificate* cert) { 63 net::URLRequest* request, int cert_error, net::X509Certificate* cert) {
63 NOTREACHED(); 64 NOTREACHED();
64 OnError(base::PLATFORM_FILE_ERROR_SECURITY); 65 OnError(base::PLATFORM_FILE_ERROR_SECURITY);
65 } 66 }
66 67
67 void FileWriterDelegate::OnResponseStarted(URLRequest* request) { 68 void FileWriterDelegate::OnResponseStarted(net::URLRequest* request) {
68 DCHECK_EQ(request_, request); 69 DCHECK_EQ(request_, request);
69 if (!request->status().is_success()) { 70 if (!request->status().is_success()) {
70 OnError(base::PLATFORM_FILE_ERROR_FAILED); 71 OnError(base::PLATFORM_FILE_ERROR_FAILED);
71 return; 72 return;
72 } 73 }
73 int64 error = file_stream_->Seek(net::FROM_BEGIN, offset_); 74 int64 error = file_stream_->Seek(net::FROM_BEGIN, offset_);
74 if (error != offset_) { 75 if (error != offset_) {
75 OnError(base::PLATFORM_FILE_ERROR_FAILED); 76 OnError(base::PLATFORM_FILE_ERROR_FAILED);
76 return; 77 return;
77 } 78 }
78 Read(); 79 Read();
79 } 80 }
80 81
81 void FileWriterDelegate::OnReadCompleted(URLRequest* request, int bytes_read) { 82 void FileWriterDelegate::OnReadCompleted(net::URLRequest* request,
83 int bytes_read) {
82 DCHECK_EQ(request_, request); 84 DCHECK_EQ(request_, request);
83 if (!request->status().is_success()) { 85 if (!request->status().is_success()) {
84 OnError(base::PLATFORM_FILE_ERROR_FAILED); 86 OnError(base::PLATFORM_FILE_ERROR_FAILED);
85 return; 87 return;
86 } 88 }
87 OnDataReceived(bytes_read); 89 OnDataReceived(bytes_read);
88 } 90 }
89 91
90 void FileWriterDelegate::Read() { 92 void FileWriterDelegate::Read() {
91 bytes_written_ = 0; 93 bytes_written_ = 0;
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 bytes_read_backlog_ = 0; 158 bytes_read_backlog_ = 0;
157 file_system_operation_->DidWrite( 159 file_system_operation_->DidWrite(
158 base::PLATFORM_FILE_OK, bytes_read, done); 160 base::PLATFORM_FILE_OK, bytes_read, done);
159 return; 161 return;
160 } 162 }
161 bytes_read_backlog_ += bytes_read; 163 bytes_read_backlog_ += bytes_read;
162 } 164 }
163 165
164 } // namespace fileapi 166 } // namespace fileapi
165 167
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698