summaryrefslogtreecommitdiff
path: root/chromium/services/network/throttling/throttling_network_transaction_factory.h
blob: 390698c22a473cb475bc6e6c883de172f6b8b1d3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef SERVICES_NETWORK_THROTTLING_THROTTLING_NETWORK_TRANSACTION_FACTORY_H_
#define SERVICES_NETWORK_THROTTLING_THROTTLING_NETWORK_TRANSACTION_FACTORY_H_

#include <memory>

#include "base/component_export.h"
#include "base/macros.h"
#include "net/base/request_priority.h"
#include "net/http/http_transaction_factory.h"

namespace net {
class HttpCache;
class HttpNetworkSession;
class HttpTransaction;
}  // namespace net

namespace network {

// NetworkTransactionFactory wraps HttpNetworkTransactions.
class COMPONENT_EXPORT(NETWORK_SERVICE) ThrottlingNetworkTransactionFactory
    : public net::HttpTransactionFactory {
 public:
  explicit ThrottlingNetworkTransactionFactory(
      net::HttpNetworkSession* session);

  ThrottlingNetworkTransactionFactory(
      const ThrottlingNetworkTransactionFactory&) = delete;
  ThrottlingNetworkTransactionFactory& operator=(
      const ThrottlingNetworkTransactionFactory&) = delete;

  ~ThrottlingNetworkTransactionFactory() override;

  // net::HttpTransactionFactory methods:
  int CreateTransaction(net::RequestPriority priority,
                        std::unique_ptr<net::HttpTransaction>* trans) override;
  net::HttpCache* GetCache() override;
  net::HttpNetworkSession* GetSession() override;

 private:
  std::unique_ptr<net::HttpTransactionFactory> network_layer_;
};

}  // namespace network

#endif  // SERVICES_NETWORK_THROTTLING_THROTTLING_NETWORK_TRANSACTION_FACTORY_H_