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/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
| 12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
| 13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.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/non_thread_safe.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 |
| 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. The HttpTransactionFactory must be destroyed |
| 30 // the HttpNetworkSession. | |
|
pauljensen
2015/09/02 14:32:29
You're missing a word here, perhaps "before".
mmenke
2015/09/02 16:29:34
Done.
| |
| 30 explicit HttpNetworkLayer(HttpNetworkSession* session); | 31 explicit HttpNetworkLayer(HttpNetworkSession* session); |
| 31 ~HttpNetworkLayer() override; | 32 ~HttpNetworkLayer() override; |
| 32 | 33 |
| 33 // Create a transaction factory that instantiate a network layer over an | |
| 34 // existing network session. Network session contains some valuable | |
| 35 // information (e.g. authentication data) that we want to share across | |
| 36 // multiple network layers. This method exposes the implementation details | |
| 37 // of a network layer, use this method with an existing network layer only | |
| 38 // when network session is shared. | |
| 39 static HttpTransactionFactory* CreateFactory(HttpNetworkSession* session); | |
| 40 | |
| 41 // HttpTransactionFactory methods: | 34 // HttpTransactionFactory methods: |
| 42 int CreateTransaction(RequestPriority priority, | 35 int CreateTransaction(RequestPriority priority, |
| 43 scoped_ptr<HttpTransaction>* trans) override; | 36 scoped_ptr<HttpTransaction>* trans) override; |
| 44 HttpCache* GetCache() override; | 37 HttpCache* GetCache() override; |
| 45 HttpNetworkSession* GetSession() override; | 38 HttpNetworkSession* GetSession() override; |
| 46 | 39 |
| 47 // base::PowerObserver methods: | 40 // base::PowerObserver methods: |
| 48 void OnSuspend() override; | 41 void OnSuspend() override; |
| 49 void OnResume() override; | 42 void OnResume() override; |
| 50 | 43 |
| 51 private: | 44 private: |
| 52 const scoped_refptr<HttpNetworkSession> session_; | 45 HttpNetworkSession* session_; |
|
pauljensen
2015/09/02 14:32:29
nit: *->*const
mmenke
2015/09/02 16:29:34
Done.
| |
| 53 bool suspended_; | 46 bool suspended_; |
| 54 | 47 |
| 55 DISALLOW_COPY_AND_ASSIGN(HttpNetworkLayer); | 48 DISALLOW_COPY_AND_ASSIGN(HttpNetworkLayer); |
| 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 |