[email protected] | 5a07c19 | 2012-07-30 20:18:22 | [diff] [blame] | 1 | // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
license.bot | bf09a50 | 2008-08-24 00:55:55 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
3 | // found in the LICENSE file. | ||||
initial.commit | 586acc5fe | 2008-07-26 22:42:52 | [diff] [blame] | 4 | |
5 | #ifndef NET_HTTP_HTTP_NETWORK_LAYER_H_ | ||||
6 | #define NET_HTTP_HTTP_NETWORK_LAYER_H_ | ||||
7 | |||||
danakj | 1fd259a0 | 2016-04-16 03:17:09 | [diff] [blame] | 8 | #include <memory> |
[email protected] | 650e2cae | 2009-10-21 23:52:07 | [diff] [blame] | 9 | #include <string> |
10 | |||||
[email protected] | 0c55b328 | 2013-11-27 04:18:11 | [diff] [blame] | 11 | #include "base/compiler_specific.h" |
Avi Drissman | 13fc893 | 2015-12-20 04:40:46 | [diff] [blame] | 12 | #include "base/macros.h" |
[email protected] | 3b63f8f4 | 2011-03-28 01:54:15 | [diff] [blame] | 13 | #include "base/memory/ref_counted.h" |
[email protected] | 6c5905b7 | 2013-04-03 19:06:51 | [diff] [blame] | 14 | #include "base/power_monitor/power_observer.h" |
gab | 47aa7da | 2017-06-02 16:09:43 | [diff] [blame] | 15 | #include "base/threading/thread_checker.h" |
[email protected] | 172da1b | 2011-08-12 15:52:26 | [diff] [blame] | 16 | #include "net/base/net_export.h" |
initial.commit | 586acc5fe | 2008-07-26 22:42:52 | [diff] [blame] | 17 | #include "net/http/http_transaction_factory.h" |
18 | |||||
19 | namespace net { | ||||
20 | |||||
21 | class HttpNetworkSession; | ||||
initial.commit | 586acc5fe | 2008-07-26 22:42:52 | [diff] [blame] | 22 | |
gab | 47aa7da | 2017-06-02 16:09:43 | [diff] [blame] | 23 | class NET_EXPORT HttpNetworkLayer : public HttpTransactionFactory, |
24 | public base::PowerObserver { | ||||
initial.commit | 586acc5fe | 2008-07-26 22:42:52 | [diff] [blame] | 25 | public: |
[email protected] | 822581d | 2010-12-16 17:27:15 | [diff] [blame] | 26 | // Construct a HttpNetworkLayer with an existing HttpNetworkSession which |
Nicolas Arciniega | 8ec5bfa | 2020-03-20 05:07:26 | [diff] [blame] | 27 | // contains a valid ProxyResolutionService. The HttpNetworkLayer must be |
28 | // destroyed before |session|. | ||||
[email protected] | e7f2964 | 2009-03-02 22:53:18 | [diff] [blame] | 29 | explicit HttpNetworkLayer(HttpNetworkSession* session); |
dcheng | b03027d | 2014-10-21 12:00:20 | [diff] [blame] | 30 | ~HttpNetworkLayer() override; |
[email protected] | d100e44f | 2011-01-26 22:47:11 | [diff] [blame] | 31 | |
[email protected] | d100e44f | 2011-01-26 22:47:11 | [diff] [blame] | 32 | // HttpTransactionFactory methods: |
dcheng | b03027d | 2014-10-21 12:00:20 | [diff] [blame] | 33 | int CreateTransaction(RequestPriority priority, |
danakj | 1fd259a0 | 2016-04-16 03:17:09 | [diff] [blame] | 34 | std::unique_ptr<HttpTransaction>* trans) override; |
dcheng | b03027d | 2014-10-21 12:00:20 | [diff] [blame] | 35 | HttpCache* GetCache() override; |
36 | HttpNetworkSession* GetSession() override; | ||||
[email protected] | 8523ba5 | 2011-05-22 19:00:58 | [diff] [blame] | 37 | |
[email protected] | 6c5905b7 | 2013-04-03 19:06:51 | [diff] [blame] | 38 | // base::PowerObserver methods: |
dcheng | b03027d | 2014-10-21 12:00:20 | [diff] [blame] | 39 | void OnSuspend() override; |
40 | void OnResume() override; | ||||
[email protected] | d100e44f | 2011-01-26 22:47:11 | [diff] [blame] | 41 | |
initial.commit | 586acc5fe | 2008-07-26 22:42:52 | [diff] [blame] | 42 | private: |
mmenke | e65e7af | 2015-10-13 17:16:42 | [diff] [blame] | 43 | HttpNetworkSession* const session_; |
initial.commit | 586acc5fe | 2008-07-26 22:42:52 | [diff] [blame] | 44 | bool suspended_; |
[email protected] | 0c55b328 | 2013-11-27 04:18:11 | [diff] [blame] | 45 | |
gab | 47aa7da | 2017-06-02 16:09:43 | [diff] [blame] | 46 | THREAD_CHECKER(thread_checker_); |
47 | |||||
[email protected] | 0c55b328 | 2013-11-27 04:18:11 | [diff] [blame] | 48 | DISALLOW_COPY_AND_ASSIGN(HttpNetworkLayer); |
initial.commit | 586acc5fe | 2008-07-26 22:42:52 | [diff] [blame] | 49 | }; |
50 | |||||
51 | } // namespace net | ||||
52 | |||||
53 | #endif // NET_HTTP_HTTP_NETWORK_LAYER_H_ |