1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 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 "base/scoped_ptr.h" 9 10 namespace net { 11 12 class HttpCache; 13 class HttpNetworkSession; 14 class HttpTransaction; 15 16 17 // An interface to a class that can create HttpTransaction objects. 18 class HttpTransactionFactory { 19 public: 20 virtual ~HttpTransactionFactory() {} 21 22 // Creates a HttpTransaction object. On success, saves the new 23 // transaction to |*trans| and returns OK. 24 virtual int CreateTransaction(scoped_ptr<HttpTransaction>* trans) = 0; 25 26 // Returns the associated cache if any (may be NULL). 27 virtual HttpCache* GetCache() = 0; 28 29 // Returns the associated HttpNetworkSession used by new transactions. 30 virtual HttpNetworkSession* GetSession() = 0; 31 32 // Suspends the creation of new transactions. If |suspend| is false, creation 33 // of new transactions is resumed. 34 virtual void Suspend(bool suspend) = 0; 35 }; 36 37 } // namespace net 38 39 #endif // NET_HTTP_HTTP_TRANSACTION_FACTORY_H__ 40