Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef COMPONENTS_CRONET_ANDROID_CRONET_DATA_REDUCTION_PROXY_H_ | |
| 6 #define COMPONENTS_CRONET_ANDROID_CRONET_DATA_REDUCTION_PROXY_H_ | |
| 7 | |
| 8 #include <string> | |
| 9 | |
| 10 #include "base/basictypes.h" | |
| 11 #include "base/memory/ref_counted.h" | |
| 12 #include "base/memory/scoped_ptr.h" | |
| 13 | |
| 14 class PrefService; | |
| 15 | |
| 16 namespace base { | |
| 17 class SingleThreadTaskRunner; | |
| 18 } | |
| 19 | |
| 20 namespace data_reduction_proxy { | |
| 21 class DataReductionProxyIOData; | |
| 22 class DataReductionProxySettings; | |
| 23 } | |
| 24 | |
| 25 namespace net { | |
| 26 class NetLog; | |
| 27 class NetworkDelegate; | |
| 28 class URLRequestContext; | |
| 29 class URLRequestContextGetter; | |
| 30 class URLRequestInterceptor; | |
| 31 } | |
| 32 | |
| 33 namespace cronet { | |
| 34 | |
| 35 // Wrapper and configurator of Data Reduction Proxy objects for Cronet. It | |
| 36 // configured the Data Reduction Proxy to run both its UI and IO classes on | |
|
mmenke
2015/05/07 20:22:18
configured -> configures
bengr
2015/05/08 22:41:02
Done.
| |
| 37 // Cronet's network thread. | |
| 38 class CronetDataReductionProxy { | |
| 39 public: | |
| 40 // Construct Data Reduction Proxy Settings and IOData objects and set | |
| 41 // the authentication key. The task_runner should be suitable for running | |
|
mmenke
2015/05/07 20:22:18
nit: |task_runner|
bengr
2015/05/08 22:41:02
Done.
| |
| 42 // tasks on the network thread. The primary proxy, fallback proxy, and secure | |
| 43 // proxy check url can override defaults. All or none must be specified. | |
| 44 CronetDataReductionProxy( | |
| 45 const std::string& key, | |
| 46 const std::string& primary_proxy, | |
| 47 const std::string& fallback_proxy, | |
| 48 const std::string& secure_proxy_check_url, | |
| 49 const std::string& user_agent, | |
| 50 scoped_refptr<base::SingleThreadTaskRunner> task_runner, | |
| 51 net::NetLog* net_log); | |
| 52 | |
| 53 ~CronetDataReductionProxy(); | |
| 54 | |
| 55 // Constructs a network delegate suitable for adding Data Reduction Proxy | |
| 56 // request headers. | |
| 57 scoped_ptr<net::NetworkDelegate> CreateNetworkDelegate( | |
| 58 scoped_ptr<net::NetworkDelegate> wrapped_network_delegate); | |
| 59 | |
| 60 // Constructs a URLRequestInterceptor suitable for carrying out the Data | |
| 61 // Reduction Proxy's bypass protocol. | |
| 62 scoped_ptr<net::URLRequestInterceptor> CreateInterceptor(); | |
| 63 | |
| 64 // Constructs a bridge between the Settings and IOData objects, sets up a | |
| 65 // context for secure proxy check requests, and enables the proxy, if | |
| 66 // |enable| is true. | |
| 67 void Init(bool enable, net::URLRequestContext* context); | |
| 68 | |
| 69 private: | |
| 70 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; | |
| 71 scoped_ptr<PrefService> prefs_; | |
| 72 scoped_refptr<net::URLRequestContextGetter> url_request_context_getter_; | |
| 73 scoped_ptr<data_reduction_proxy::DataReductionProxySettings> settings_; | |
| 74 scoped_ptr<data_reduction_proxy::DataReductionProxyIOData> io_data_; | |
| 75 | |
| 76 DISALLOW_COPY_AND_ASSIGN(CronetDataReductionProxy); | |
| 77 }; | |
| 78 | |
| 79 } // namespace cronet | |
| 80 | |
| 81 #endif // COMPONENTS_CRONET_ANDROID_CRONET_DATA_REDUCTION_PROXY_H_ | |
| OLD | NEW |