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

Side by Side Diff: net/url_request/url_request_ftp_job.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 "net/url_request/url_request_ftp_job.h" 5 #include "net/url_request/url_request_ftp_job.h"
6 6
7 #include "base/compiler_specific.h" 7 #include "base/compiler_specific.h"
8 #include "base/message_loop.h" 8 #include "base/message_loop.h"
9 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
10 #include "net/base/auth.h" 10 #include "net/base/auth.h"
11 #include "net/base/net_errors.h" 11 #include "net/base/net_errors.h"
12 #include "net/base/net_util.h" 12 #include "net/base/net_util.h"
13 #include "net/ftp/ftp_response_info.h" 13 #include "net/ftp/ftp_response_info.h"
14 #include "net/ftp/ftp_transaction_factory.h" 14 #include "net/ftp/ftp_transaction_factory.h"
15 #include "net/url_request/url_request.h" 15 #include "net/url_request/url_request.h"
16 #include "net/url_request/url_request_context.h" 16 #include "net/url_request/url_request_context.h"
17 #include "net/url_request/url_request_error_job.h" 17 #include "net/url_request/url_request_error_job.h"
18 18
19 URLRequestFtpJob::URLRequestFtpJob(URLRequest* request) 19 URLRequestFtpJob::URLRequestFtpJob(net::URLRequest* request)
20 : URLRequestJob(request), 20 : URLRequestJob(request),
21 ALLOW_THIS_IN_INITIALIZER_LIST( 21 ALLOW_THIS_IN_INITIALIZER_LIST(
22 start_callback_(this, &URLRequestFtpJob::OnStartCompleted)), 22 start_callback_(this, &URLRequestFtpJob::OnStartCompleted)),
23 ALLOW_THIS_IN_INITIALIZER_LIST( 23 ALLOW_THIS_IN_INITIALIZER_LIST(
24 read_callback_(this, &URLRequestFtpJob::OnReadCompleted)), 24 read_callback_(this, &URLRequestFtpJob::OnReadCompleted)),
25 read_in_progress_(false), 25 read_in_progress_(false),
26 context_(request->context()) { 26 context_(request->context()) {
27 } 27 }
28 28
29 URLRequestFtpJob::~URLRequestFtpJob() { 29 URLRequestFtpJob::~URLRequestFtpJob() {
30 } 30 }
31 31
32 // static 32 // static
33 URLRequestJob* URLRequestFtpJob::Factory(URLRequest* request, 33 URLRequestJob* URLRequestFtpJob::Factory(net::URLRequest* request,
34 const std::string& scheme) { 34 const std::string& scheme) {
35 DCHECK_EQ(scheme, "ftp"); 35 DCHECK_EQ(scheme, "ftp");
36 36
37 int port = request->url().IntPort(); 37 int port = request->url().IntPort();
38 if (request->url().has_port() && 38 if (request->url().has_port() &&
39 !net::IsPortAllowedByFtp(port) && !net::IsPortAllowedByOverride(port)) 39 !net::IsPortAllowedByFtp(port) && !net::IsPortAllowedByOverride(port))
40 return new URLRequestErrorJob(request, net::ERR_UNSAFE_PORT); 40 return new URLRequestErrorJob(request, net::ERR_UNSAFE_PORT);
41 41
42 DCHECK(request->context()); 42 DCHECK(request->context());
43 DCHECK(request->context()->ftp_transaction_factory()); 43 DCHECK(request->context()->ftp_transaction_factory());
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 int rv; 226 int rv;
227 if (transaction_.get()) { 227 if (transaction_.get()) {
228 rv = transaction_->Start( 228 rv = transaction_->Start(
229 &request_info_, &start_callback_, request_->net_log()); 229 &request_info_, &start_callback_, request_->net_log());
230 if (rv == net::ERR_IO_PENDING) 230 if (rv == net::ERR_IO_PENDING)
231 return; 231 return;
232 } else { 232 } else {
233 rv = net::ERR_FAILED; 233 rv = net::ERR_FAILED;
234 } 234 }
235 // The transaction started synchronously, but we need to notify the 235 // The transaction started synchronously, but we need to notify the
236 // URLRequest delegate via the message loop. 236 // net::URLRequest delegate via the message loop.
237 MessageLoop::current()->PostTask(FROM_HERE, NewRunnableMethod( 237 MessageLoop::current()->PostTask(FROM_HERE, NewRunnableMethod(
238 this, &URLRequestFtpJob::OnStartCompleted, rv)); 238 this, &URLRequestFtpJob::OnStartCompleted, rv));
239 } 239 }
240 240
241 void URLRequestFtpJob::DestroyTransaction() { 241 void URLRequestFtpJob::DestroyTransaction() {
242 DCHECK(transaction_.get()); 242 DCHECK(transaction_.get());
243 243
244 transaction_.reset(); 244 transaction_.reset();
245 } 245 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698