1 // Copyright 2012 The Chromium Authors 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef NET_HTTP_HTTP_TRANSACTION_FACTORY_H_ 6 #define NET_HTTP_HTTP_TRANSACTION_FACTORY_H_ 7 8 #include <memory> 9 10 #include "net/base/net_export.h" 11 #include "net/base/request_priority.h" 12 13 namespace net { 14 15 class HttpCache; 16 class HttpNetworkSession; 17 class HttpTransaction; 18 19 // An interface to a class that can create HttpTransaction objects. 20 class NET_EXPORT HttpTransactionFactory { 21 public: 22 virtual ~HttpTransactionFactory() = default; 23 24 // Creates a HttpTransaction object. On success, saves the new 25 // transaction to |*trans| and returns OK. 26 virtual int CreateTransaction(RequestPriority priority, 27 std::unique_ptr<HttpTransaction>* trans) = 0; 28 29 // Returns the associated cache if any (may be NULL). 30 virtual HttpCache* GetCache() = 0; 31 32 // Returns the associated HttpNetworkSession used by new transactions. 33 virtual HttpNetworkSession* GetSession() = 0; 34 }; 35 36 } // namespace net 37 38 #endif // NET_HTTP_HTTP_TRANSACTION_FACTORY_H_ 39