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

Unified Diff: net/url_request/ftp_protocol_handler.h

Issue 2428143002: Clean up FtpTransactionFacory ownership. (Closed)
Patch Set: Response to comments 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 side-by-side diff with in-line comments
Download patch
Index: net/url_request/ftp_protocol_handler.h
diff --git a/net/url_request/ftp_protocol_handler.h b/net/url_request/ftp_protocol_handler.h
index bb7796bb7c6403a391fe41cfcebfd2b4458772ee..e06aa1ad7dc67170041e751671381442f1ac5b87 100644
--- a/net/url_request/ftp_protocol_handler.h
+++ b/net/url_request/ftp_protocol_handler.h
@@ -16,6 +16,7 @@ namespace net {
class FtpAuthCache;
class FtpTransactionFactory;
+class HostResolver;
class NetworkDelegate;
class URLRequestJob;
@@ -23,8 +24,18 @@ class URLRequestJob;
class NET_EXPORT FtpProtocolHandler :
public URLRequestJobFactory::ProtocolHandler {
public:
- explicit FtpProtocolHandler(FtpTransactionFactory* ftp_transaction_factory);
~FtpProtocolHandler() override;
+
+ // Creates an FtpProtocolHandler using an FtpTransactionFactoryImpl and the
+ // specified HostResolver.
+ static std::unique_ptr<FtpProtocolHandler> Create(
+ HostResolver* host_resolver);
+
+ // Creates an FtpProtocolHandler using the specified FtpTransactionFactory, to
+ // allow a mock to be used for testing.
+ static std::unique_ptr<FtpProtocolHandler> CreateForTesting(
+ std::unique_ptr<FtpTransactionFactory> ftp_transaction_factory);
+
URLRequestJob* MaybeCreateJob(
URLRequest* request,
NetworkDelegate* network_delegate) const override;
@@ -32,7 +43,10 @@ class NET_EXPORT FtpProtocolHandler :
private:
friend class FtpTestURLRequestContext;
- FtpTransactionFactory* ftp_transaction_factory_;
+ explicit FtpProtocolHandler(
+ std::unique_ptr<FtpTransactionFactory> ftp_transaction_factory);
+
+ std::unique_ptr<FtpTransactionFactory> ftp_transaction_factory_;
std::unique_ptr<FtpAuthCache> ftp_auth_cache_;
DISALLOW_COPY_AND_ASSIGN(FtpProtocolHandler);

Powered by Google App Engine
This is Rietveld 408576698