OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef NET_HTTP_HTTP_NETWORK_LAYER_H_ | 5 #ifndef NET_HTTP_HTTP_NETWORK_LAYER_H_ |
6 #define NET_HTTP_HTTP_NETWORK_LAYER_H_ | 6 #define NET_HTTP_HTTP_NETWORK_LAYER_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
12 #include "base/macros.h" | 12 #include "base/macros.h" |
13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
14 #include "base/power_monitor/power_observer.h" | 14 #include "base/power_monitor/power_observer.h" |
15 #include "base/threading/non_thread_safe.h" | 15 #include "base/threading/thread_checker.h" |
16 #include "net/base/net_export.h" | 16 #include "net/base/net_export.h" |
17 #include "net/http/http_transaction_factory.h" | 17 #include "net/http/http_transaction_factory.h" |
18 | 18 |
19 namespace net { | 19 namespace net { |
20 | 20 |
21 class HttpNetworkSession; | 21 class HttpNetworkSession; |
22 | 22 |
23 class NET_EXPORT HttpNetworkLayer | 23 class NET_EXPORT HttpNetworkLayer : public HttpTransactionFactory, |
24 : public HttpTransactionFactory, | 24 public base::PowerObserver { |
25 public base::PowerObserver, | |
26 NON_EXPORTED_BASE(public base::NonThreadSafe) { | |
27 public: | 25 public: |
28 // Construct a HttpNetworkLayer with an existing HttpNetworkSession which | 26 // Construct a HttpNetworkLayer with an existing HttpNetworkSession which |
29 // contains a valid ProxyService. The HttpNetworkLayer must be destroyed | 27 // contains a valid ProxyService. The HttpNetworkLayer must be destroyed |
30 // before |session|. | 28 // before |session|. |
31 explicit HttpNetworkLayer(HttpNetworkSession* session); | 29 explicit HttpNetworkLayer(HttpNetworkSession* session); |
32 ~HttpNetworkLayer() override; | 30 ~HttpNetworkLayer() override; |
33 | 31 |
34 // HttpTransactionFactory methods: | 32 // HttpTransactionFactory methods: |
35 int CreateTransaction(RequestPriority priority, | 33 int CreateTransaction(RequestPriority priority, |
36 std::unique_ptr<HttpTransaction>* trans) override; | 34 std::unique_ptr<HttpTransaction>* trans) override; |
37 HttpCache* GetCache() override; | 35 HttpCache* GetCache() override; |
38 HttpNetworkSession* GetSession() override; | 36 HttpNetworkSession* GetSession() override; |
39 | 37 |
40 // base::PowerObserver methods: | 38 // base::PowerObserver methods: |
41 void OnSuspend() override; | 39 void OnSuspend() override; |
42 void OnResume() override; | 40 void OnResume() override; |
43 | 41 |
44 private: | 42 private: |
45 HttpNetworkSession* const session_; | 43 HttpNetworkSession* const session_; |
46 bool suspended_; | 44 bool suspended_; |
47 | 45 |
| 46 THREAD_CHECKER(thread_checker_); |
| 47 |
48 DISALLOW_COPY_AND_ASSIGN(HttpNetworkLayer); | 48 DISALLOW_COPY_AND_ASSIGN(HttpNetworkLayer); |
49 }; | 49 }; |
50 | 50 |
51 } // namespace net | 51 } // namespace net |
52 | 52 |
53 #endif // NET_HTTP_HTTP_NETWORK_LAYER_H_ | 53 #endif // NET_HTTP_HTTP_NETWORK_LAYER_H_ |
OLD | NEW |