Chromium Code Reviews| 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/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
|
pauljensen
2012/12/14 14:19:31
While you're in this file, you could add:
#include
Philippe
2012/12/14 14:34:22
Sure, done.
| |
| 11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 12 #include "base/system_monitor/system_monitor.h" | |
| 13 #include "base/threading/non_thread_safe.h" | 12 #include "base/threading/non_thread_safe.h" |
| 14 #include "net/base/net_export.h" | 13 #include "net/base/net_export.h" |
| 15 #include "net/http/http_transaction_factory.h" | 14 #include "net/http/http_transaction_factory.h" |
| 16 | 15 |
| 17 namespace net { | 16 namespace net { |
| 18 | 17 |
| 19 class HttpNetworkSession; | 18 class HttpNetworkSession; |
| 20 | 19 |
| 21 class NET_EXPORT HttpNetworkLayer | 20 class NET_EXPORT HttpNetworkLayer |
| 22 : public HttpTransactionFactory, | 21 : public HttpTransactionFactory, |
| 23 public base::SystemMonitor::PowerObserver, | |
| 24 NON_EXPORTED_BASE(public base::NonThreadSafe) { | 22 NON_EXPORTED_BASE(public base::NonThreadSafe) { |
| 25 public: | 23 public: |
| 26 // Construct a HttpNetworkLayer with an existing HttpNetworkSession which | 24 // Construct a HttpNetworkLayer with an existing HttpNetworkSession which |
| 27 // contains a valid ProxyService. | 25 // contains a valid ProxyService. |
| 28 explicit HttpNetworkLayer(HttpNetworkSession* session); | 26 explicit HttpNetworkLayer(HttpNetworkSession* session); |
| 29 virtual ~HttpNetworkLayer(); | 27 virtual ~HttpNetworkLayer(); |
| 30 | 28 |
| 31 // Create a transaction factory that instantiate a network layer over an | 29 // Create a transaction factory that instantiate a network layer over an |
| 32 // existing network session. Network session contains some valuable | 30 // existing network session. Network session contains some valuable |
| 33 // information (e.g. authentication data) that we want to share across | 31 // information (e.g. authentication data) that we want to share across |
| 34 // multiple network layers. This method exposes the implementation details | 32 // multiple network layers. This method exposes the implementation details |
| 35 // of a network layer, use this method with an existing network layer only | 33 // of a network layer, use this method with an existing network layer only |
| 36 // when network session is shared. | 34 // when network session is shared. |
| 37 static HttpTransactionFactory* CreateFactory(HttpNetworkSession* session); | 35 static HttpTransactionFactory* CreateFactory(HttpNetworkSession* session); |
| 38 | 36 |
| 39 // Forces an alternate protocol of SPDY/2 on port 443. | 37 // Forces an alternate protocol of SPDY/2 on port 443. |
| 40 // TODO(rch): eliminate this method. | 38 // TODO(rch): eliminate this method. |
| 41 static void ForceAlternateProtocol(); | 39 static void ForceAlternateProtocol(); |
| 42 | 40 |
| 43 // HttpTransactionFactory methods: | 41 // HttpTransactionFactory methods: |
| 44 virtual int CreateTransaction(scoped_ptr<HttpTransaction>* trans, | 42 virtual int CreateTransaction(scoped_ptr<HttpTransaction>* trans, |
| 45 HttpTransactionDelegate* delegate) OVERRIDE; | 43 HttpTransactionDelegate* delegate) OVERRIDE; |
| 46 virtual HttpCache* GetCache() OVERRIDE; | 44 virtual HttpCache* GetCache() OVERRIDE; |
| 47 virtual HttpNetworkSession* GetSession() OVERRIDE; | 45 virtual HttpNetworkSession* GetSession() OVERRIDE; |
| 48 | 46 |
| 49 // base::SystemMonitor::PowerObserver methods: | |
| 50 virtual void OnSuspend() OVERRIDE; | |
| 51 virtual void OnResume() OVERRIDE; | |
| 52 | |
| 53 private: | 47 private: |
| 54 const scoped_refptr<HttpNetworkSession> session_; | 48 const scoped_refptr<HttpNetworkSession> session_; |
|
pauljensen
2012/12/14 14:19:31
While you're in this file, you could add:
DISALLOW
Philippe
2012/12/14 14:34:22
Done.
| |
| 55 bool suspended_; | |
| 56 }; | 49 }; |
| 57 | 50 |
| 58 } // namespace net | 51 } // namespace net |
| 59 | 52 |
| 60 #endif // NET_HTTP_HTTP_NETWORK_LAYER_H_ | 53 #endif // NET_HTTP_HTTP_NETWORK_LAYER_H_ |
| OLD | NEW |