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 <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 class HttpNetworkSession; | 21 class HttpNetworkSession; |
22 | 22 |
23 class NET_EXPORT HttpNetworkLayer | 23 class NET_EXPORT HttpNetworkLayer |
24 : public HttpTransactionFactory, | 24 : public HttpTransactionFactory, |
25 public base::PowerObserver, | 25 public base::PowerObserver, |
26 NON_EXPORTED_BASE(public base::NonThreadSafe) { | 26 NON_EXPORTED_BASE(public base::NonThreadSafe) { |
27 public: | 27 public: |
28 // Construct a HttpNetworkLayer with an existing HttpNetworkSession which | 28 // Construct a HttpNetworkLayer with an existing HttpNetworkSession which |
29 // contains a valid ProxyService. | 29 // contains a valid ProxyService. |
30 explicit HttpNetworkLayer(HttpNetworkSession* session); | 30 explicit HttpNetworkLayer(HttpNetworkSession* session); |
31 virtual ~HttpNetworkLayer(); | 31 ~HttpNetworkLayer() override; |
32 | 32 |
33 // Create a transaction factory that instantiate a network layer over an | 33 // Create a transaction factory that instantiate a network layer over an |
34 // existing network session. Network session contains some valuable | 34 // existing network session. Network session contains some valuable |
35 // information (e.g. authentication data) that we want to share across | 35 // information (e.g. authentication data) that we want to share across |
36 // multiple network layers. This method exposes the implementation details | 36 // multiple network layers. This method exposes the implementation details |
37 // of a network layer, use this method with an existing network layer only | 37 // of a network layer, use this method with an existing network layer only |
38 // when network session is shared. | 38 // when network session is shared. |
39 static HttpTransactionFactory* CreateFactory(HttpNetworkSession* session); | 39 static HttpTransactionFactory* CreateFactory(HttpNetworkSession* session); |
40 | 40 |
41 // Forces an alternate protocol of SPDY/3 on port 443. | 41 // Forces an alternate protocol of SPDY/3 on port 443. |
42 // TODO(rch): eliminate this method. | 42 // TODO(rch): eliminate this method. |
43 static void ForceAlternateProtocol(); | 43 static void ForceAlternateProtocol(); |
44 | 44 |
45 // HttpTransactionFactory methods: | 45 // HttpTransactionFactory methods: |
46 virtual int CreateTransaction(RequestPriority priority, | 46 int CreateTransaction(RequestPriority priority, |
47 scoped_ptr<HttpTransaction>* trans) override; | 47 scoped_ptr<HttpTransaction>* trans) override; |
48 virtual HttpCache* GetCache() override; | 48 HttpCache* GetCache() override; |
49 virtual HttpNetworkSession* GetSession() override; | 49 HttpNetworkSession* GetSession() override; |
50 | 50 |
51 // base::PowerObserver methods: | 51 // base::PowerObserver methods: |
52 virtual void OnSuspend() override; | 52 void OnSuspend() override; |
53 virtual void OnResume() override; | 53 void OnResume() override; |
54 | 54 |
55 private: | 55 private: |
56 const scoped_refptr<HttpNetworkSession> session_; | 56 const scoped_refptr<HttpNetworkSession> session_; |
57 bool suspended_; | 57 bool suspended_; |
58 | 58 |
59 DISALLOW_COPY_AND_ASSIGN(HttpNetworkLayer); | 59 DISALLOW_COPY_AND_ASSIGN(HttpNetworkLayer); |
60 }; | 60 }; |
61 | 61 |
62 } // namespace net | 62 } // namespace net |
63 | 63 |
64 #endif // NET_HTTP_HTTP_NETWORK_LAYER_H_ | 64 #endif // NET_HTTP_HTTP_NETWORK_LAYER_H_ |
OLD | NEW |