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

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

Issue 2428143002: Clean up FtpTransactionFacory ownership. (Closed)
Patch Set: --typos Created 4 years, 2 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
« no previous file with comments | « net/ftp/ftp_network_layer.cc ('k') | net/url_request/ftp_protocol_handler.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #ifndef NET_URL_REQUEST_FTP_PROTOCOL_HANDLER_H_ 5 #ifndef NET_URL_REQUEST_FTP_PROTOCOL_HANDLER_H_
6 #define NET_URL_REQUEST_FTP_PROTOCOL_HANDLER_H_ 6 #define NET_URL_REQUEST_FTP_PROTOCOL_HANDLER_H_
7 7
8 #include <memory> 8 #include <memory>
9 9
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "net/base/net_export.h" 12 #include "net/base/net_export.h"
13 #include "net/url_request/url_request_job_factory.h" 13 #include "net/url_request/url_request_job_factory.h"
14 14
15 namespace net { 15 namespace net {
16 16
17 class FtpAuthCache; 17 class FtpAuthCache;
18 class FtpTransactionFactory; 18 class FtpTransactionFactory;
19 class HostResolver;
19 class NetworkDelegate; 20 class NetworkDelegate;
20 class URLRequestJob; 21 class URLRequestJob;
21 22
22 // Implements a ProtocolHandler for FTP. 23 // Implements a ProtocolHandler for FTP.
23 class NET_EXPORT FtpProtocolHandler : 24 class NET_EXPORT FtpProtocolHandler :
24 public URLRequestJobFactory::ProtocolHandler { 25 public URLRequestJobFactory::ProtocolHandler {
25 public: 26 public:
26 explicit FtpProtocolHandler(FtpTransactionFactory* ftp_transaction_factory);
27 ~FtpProtocolHandler() override; 27 ~FtpProtocolHandler() override;
28
29 // Creates an FtpProtocolHandler using an FtpTransactionFactoryImpl and the
30 // specified HostResolver.
31 static std::unique_ptr<FtpProtocolHandler> Create(
32 HostResolver* host_resolver);
33
34 // Creates an FtpProtocolHandler using the specified FtpTransactionFactory, to
35 // allow a mock to be used for testing.
36 static std::unique_ptr<FtpProtocolHandler> CreateForTesting(
37 std::unique_ptr<FtpTransactionFactory> ftp_transaction_factory);
38
28 URLRequestJob* MaybeCreateJob( 39 URLRequestJob* MaybeCreateJob(
29 URLRequest* request, 40 URLRequest* request,
30 NetworkDelegate* network_delegate) const override; 41 NetworkDelegate* network_delegate) const override;
31 42
32 private: 43 private:
33 friend class FtpTestURLRequestContext; 44 friend class FtpTestURLRequestContext;
34 45
35 FtpTransactionFactory* ftp_transaction_factory_; 46 explicit FtpProtocolHandler(
47 std::unique_ptr<FtpTransactionFactory> ftp_transaction_factory);
48
49 std::unique_ptr<FtpTransactionFactory> ftp_transaction_factory_;
36 std::unique_ptr<FtpAuthCache> ftp_auth_cache_; 50 std::unique_ptr<FtpAuthCache> ftp_auth_cache_;
37 51
38 DISALLOW_COPY_AND_ASSIGN(FtpProtocolHandler); 52 DISALLOW_COPY_AND_ASSIGN(FtpProtocolHandler);
39 }; 53 };
40 54
41 } // namespace net 55 } // namespace net
42 56
43 #endif // NET_URL_REQUEST_FTP_PROTOCOL_HANDLER_H_ 57 #endif // NET_URL_REQUEST_FTP_PROTOCOL_HANDLER_H_
OLDNEW
« no previous file with comments | « net/ftp/ftp_network_layer.cc ('k') | net/url_request/ftp_protocol_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698