http_transaction_factory.h revision 5821806d5e7f356e8fa4b058a389a808ea183019
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
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/memory/scoped_ptr.h"
9#include "net/base/net_export.h"
10
11namespace net {
12
13class HttpCache;
14class HttpNetworkSession;
15class HttpTransaction;
16class HttpTransactionDelegate;
17
18// An interface to a class that can create HttpTransaction objects.
19class NET_EXPORT HttpTransactionFactory {
20 public:
21  virtual ~HttpTransactionFactory() {}
22
23  // Creates a HttpTransaction object. On success, saves the new
24  // transaction to |*trans| and returns OK.
25  virtual int CreateTransaction(scoped_ptr<HttpTransaction>* trans,
26                                HttpTransactionDelegate* delegate) = 0;
27
28  // Returns the associated cache if any (may be NULL).
29  virtual HttpCache* GetCache() = 0;
30
31  // Returns the associated HttpNetworkSession used by new transactions.
32  virtual HttpNetworkSession* GetSession() = 0;
33};
34
35}  // namespace net
36
37#endif  // NET_HTTP_HTTP_TRANSACTION_FACTORY_H__
38