blob: 1b949badcebf9bbe52a05e1ac579f60ce0d0a5a9 [file] [log] [blame]
[email protected]5a07c192012-07-30 20:18:221// Copyright (c) 2012 The Chromium Authors. All rights reserved.
license.botbf09a502008-08-24 00:55:552// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
initial.commit586acc5fe2008-07-26 22:42:524
5#ifndef NET_HTTP_HTTP_NETWORK_LAYER_H_
6#define NET_HTTP_HTTP_NETWORK_LAYER_H_
7
danakj1fd259a02016-04-16 03:17:098#include <memory>
[email protected]650e2cae2009-10-21 23:52:079#include <string>
10
[email protected]0c55b3282013-11-27 04:18:1111#include "base/compiler_specific.h"
Avi Drissman13fc8932015-12-20 04:40:4612#include "base/macros.h"
[email protected]3b63f8f42011-03-28 01:54:1513#include "base/memory/ref_counted.h"
[email protected]6c5905b72013-04-03 19:06:5114#include "base/power_monitor/power_observer.h"
gab47aa7da2017-06-02 16:09:4315#include "base/threading/thread_checker.h"
[email protected]172da1b2011-08-12 15:52:2616#include "net/base/net_export.h"
initial.commit586acc5fe2008-07-26 22:42:5217#include "net/http/http_transaction_factory.h"
18
19namespace net {
20
21class HttpNetworkSession;
initial.commit586acc5fe2008-07-26 22:42:5222
gab47aa7da2017-06-02 16:09:4323class NET_EXPORT HttpNetworkLayer : public HttpTransactionFactory,
24 public base::PowerObserver {
initial.commit586acc5fe2008-07-26 22:42:5225 public:
[email protected]822581d2010-12-16 17:27:1526 // Construct a HttpNetworkLayer with an existing HttpNetworkSession which
Nicolas Arciniega8ec5bfa2020-03-20 05:07:2627 // contains a valid ProxyResolutionService. The HttpNetworkLayer must be
28 // destroyed before |session|.
[email protected]e7f29642009-03-02 22:53:1829 explicit HttpNetworkLayer(HttpNetworkSession* session);
dchengb03027d2014-10-21 12:00:2030 ~HttpNetworkLayer() override;
[email protected]d100e44f2011-01-26 22:47:1131
[email protected]d100e44f2011-01-26 22:47:1132 // HttpTransactionFactory methods:
dchengb03027d2014-10-21 12:00:2033 int CreateTransaction(RequestPriority priority,
danakj1fd259a02016-04-16 03:17:0934 std::unique_ptr<HttpTransaction>* trans) override;
dchengb03027d2014-10-21 12:00:2035 HttpCache* GetCache() override;
36 HttpNetworkSession* GetSession() override;
[email protected]8523ba52011-05-22 19:00:5837
[email protected]6c5905b72013-04-03 19:06:5138 // base::PowerObserver methods:
dchengb03027d2014-10-21 12:00:2039 void OnSuspend() override;
40 void OnResume() override;
[email protected]d100e44f2011-01-26 22:47:1141
initial.commit586acc5fe2008-07-26 22:42:5242 private:
mmenkee65e7af2015-10-13 17:16:4243 HttpNetworkSession* const session_;
initial.commit586acc5fe2008-07-26 22:42:5244 bool suspended_;
[email protected]0c55b3282013-11-27 04:18:1145
gab47aa7da2017-06-02 16:09:4346 THREAD_CHECKER(thread_checker_);
47
[email protected]0c55b3282013-11-27 04:18:1148 DISALLOW_COPY_AND_ASSIGN(HttpNetworkLayer);
initial.commit586acc5fe2008-07-26 22:42:5249};
50
51} // namespace net
52
53#endif // NET_HTTP_HTTP_NETWORK_LAYER_H_