http_transaction_factory.h revision 2a99a7e74a7f215066514fe81d2bfa6639d9eddd
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#include "net/base/request_priority.h"
11
12namespace net {
13
14class HttpCache;
15class HttpNetworkSession;
16class HttpTransaction;
17class HttpTransactionDelegate;
18
19// An interface to a class that can create HttpTransaction objects.
20class NET_EXPORT HttpTransactionFactory {
21 public:
22  virtual ~HttpTransactionFactory() {}
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                                scoped_ptr<HttpTransaction>* trans,
28                                HttpTransactionDelegate* delegate) = 0;
29
30  // Returns the associated cache if any (may be NULL).
31  virtual HttpCache* GetCache() = 0;
32
33  // Returns the associated HttpNetworkSession used by new transactions.
34  virtual HttpNetworkSession* GetSession() = 0;
35};
36
37}  // namespace net
38
39#endif  // NET_HTTP_HTTP_TRANSACTION_FACTORY_H__
40