15821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Copyright (c) 2012 The Chromium Authors. All rights reserved.
25821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be
35821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// found in the LICENSE file.
45821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
55d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#ifndef NET_HTTP_HTTP_TRANSACTION_FACTORY_H_
65d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#define NET_HTTP_HTTP_TRANSACTION_FACTORY_H_
75821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
85821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "base/memory/scoped_ptr.h"
95821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "net/base/net_export.h"
102a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#include "net/base/request_priority.h"
115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
125821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)namespace net {
135821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
145821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class HttpCache;
155821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class HttpNetworkSession;
165821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class HttpTransaction;
175821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
185821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// An interface to a class that can create HttpTransaction objects.
195821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class NET_EXPORT HttpTransactionFactory {
205821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) public:
215821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual ~HttpTransactionFactory() {}
225821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
235821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Creates a HttpTransaction object. On success, saves the new
245821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // transaction to |*trans| and returns OK.
252a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  virtual int CreateTransaction(RequestPriority priority,
265d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)                                scoped_ptr<HttpTransaction>* trans) = 0;
275821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
285821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Returns the associated cache if any (may be NULL).
295821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual HttpCache* GetCache() = 0;
305821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
315821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Returns the associated HttpNetworkSession used by new transactions.
325821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual HttpNetworkSession* GetSession() = 0;
335821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)};
345821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
355821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)}  // namespace net
365821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
375d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#endif  // NET_HTTP_HTTP_TRANSACTION_FACTORY_H_
38