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

Side by Side Diff: net/url_request/ftp_protocol_handler.cc

Issue 11931024: Removed static factories for data, ftp, file, and about jobs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address phajdan.jr's comments Created 7 years, 7 months 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/ftp_protocol_handler.h" 5 #include "net/url_request/ftp_protocol_handler.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "net/base/net_errors.h" 8 #include "net/base/net_errors.h"
9 #include "net/base/net_util.h" 9 #include "net/base/net_util.h"
10 #include "net/ftp/ftp_auth_cache.h"
10 #include "net/url_request/url_request.h" 11 #include "net/url_request/url_request.h"
11 #include "net/url_request/url_request_error_job.h" 12 #include "net/url_request/url_request_error_job.h"
12 #include "net/url_request/url_request_ftp_job.h" 13 #include "net/url_request/url_request_ftp_job.h"
13 #include "googleurl/src/gurl.h" 14 #include "googleurl/src/gurl.h"
14 15
15 namespace net { 16 namespace net {
16 17
17 FtpProtocolHandler::FtpProtocolHandler( 18 FtpProtocolHandler::FtpProtocolHandler(
18 FtpTransactionFactory* ftp_transaction_factory, 19 FtpTransactionFactory* ftp_transaction_factory)
19 FtpAuthCache* ftp_auth_cache)
20 : ftp_transaction_factory_(ftp_transaction_factory), 20 : ftp_transaction_factory_(ftp_transaction_factory),
21 ftp_auth_cache_(ftp_auth_cache) { 21 ftp_auth_cache_(new FtpAuthCache) {
22 DCHECK(ftp_transaction_factory_); 22 DCHECK(ftp_transaction_factory_);
23 DCHECK(ftp_auth_cache_);
24 } 23 }
25 24
26 URLRequestJob* FtpProtocolHandler::MaybeCreateJob( 25 URLRequestJob* FtpProtocolHandler::MaybeCreateJob(
27 URLRequest* request, NetworkDelegate* network_delegate) const { 26 URLRequest* request, NetworkDelegate* network_delegate) const {
28 int port = request->url().IntPort(); 27 int port = request->url().IntPort();
29 if (request->url().has_port() && 28 if (request->url().has_port() &&
30 !IsPortAllowedByFtp(port) && !IsPortAllowedByOverride(port)) { 29 !IsPortAllowedByFtp(port) && !IsPortAllowedByOverride(port)) {
31 return new URLRequestErrorJob(request, network_delegate, ERR_UNSAFE_PORT); 30 return new URLRequestErrorJob(request, network_delegate, ERR_UNSAFE_PORT);
32 } 31 }
33 32
34 return new URLRequestFtpJob(request, 33 return new URLRequestFtpJob(request,
35 network_delegate, 34 network_delegate,
36 ftp_transaction_factory_, 35 ftp_transaction_factory_,
37 ftp_auth_cache_); 36 ftp_auth_cache_.get());
38 } 37 }
39 38
40 } // namespace net 39 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698