Chromium Code Reviews| Index: components/cronet/android/cronet_data_reduction_proxy.h |
| diff --git a/components/cronet/android/cronet_data_reduction_proxy.h b/components/cronet/android/cronet_data_reduction_proxy.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..247fd5eb9ef44d8fb691bf75088b86bc94b616c9 |
| --- /dev/null |
| +++ b/components/cronet/android/cronet_data_reduction_proxy.h |
| @@ -0,0 +1,75 @@ |
| +// Copyright 2015 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef COMPONENTS_CRONET_ANDROID_CRONET_DATA_REDUCTION_PROXY_H_ |
| +#define COMPONENTS_CRONET_ANDROID_CRONET_DATA_REDUCTION_PROXY_H_ |
| + |
| +#include <string> |
| + |
| +#include "base/basictypes.h" |
| +#include "base/memory/ref_counted.h" |
| +#include "base/memory/scoped_ptr.h" |
| + |
| +class PrefService; |
| + |
| +namespace base { |
| +class SingleThreadTaskRunner; |
| +} |
| + |
| +namespace data_reduction_proxy { |
| +class DataReductionProxyIOData; |
| +class DataReductionProxySettings; |
| +} |
| + |
| +namespace net { |
| +class NetLog; |
| +class NetworkDelegate; |
| +class URLRequestContext; |
| +class URLRequestContextGetter; |
| +class URLRequestInterceptor; |
| +} |
| + |
| +namespace cronet { |
| + |
| +// Wrapper and configurator of Data Reduction Proxy objects for cronet. |
|
mmenke
2015/03/13 18:16:47
nit: Cronet
bengr
2015/03/19 01:03:51
Done.
|
| +class CronetDataReductionProxy { |
|
mmenke
2015/03/13 18:16:47
Do we need the proxy delegate?
bengr
2015/03/19 01:03:51
No. That was used only for DRP CONNECT support. Th
|
| + public: |
| + // Construct Data Reduction Proxy Settings and IOData objects and set |
| + // the authentication key. |
| + CronetDataReductionProxy( |
| + const std::string& key, |
| + scoped_refptr<base::SingleThreadTaskRunner> task_runner, |
|
mmenke
2015/03/13 18:16:47
Should make it clear what the requirements for the
bengr
2015/03/19 01:03:50
Done.
|
| + net::NetLog* net_log); |
| + |
| + virtual ~CronetDataReductionProxy(); |
|
mmenke
2015/03/13 18:16:47
Virtual not needed.
bengr
2015/03/19 01:03:51
Done.
|
| + |
| + // Constructs a network delegate suitable for adding Data Reduction Proxy |
| + // request headers. |
| + net::NetworkDelegate* CreateNetworkDelegate( |
|
mmenke
2015/03/13 18:16:47
Should return a scoped_ptr<NetworkDelegate>
bengr
2015/03/19 01:03:51
Done.
|
| + scoped_ptr<net::NetworkDelegate> wrapped_network_delegate); |
| + |
| + // Constructs a URLRequestInterceptor suitable for carrying out the Data |
| + // Reduction Proxy's bypass protocol. |
| + scoped_ptr<net::URLRequestInterceptor> CreateInterceptor(); |
| + |
| + // Constructs a bridge between the Settings and IOData objects, sets up a |
| + // context for secure proxy check requests, and enables the proxy, if |
| + // |enable| is true. |
| + void Init(bool enable, net::URLRequestContext* context); |
| + |
| + private: |
| + static scoped_ptr<PrefService> CreatePrefService(); |
|
mmenke
2015/03/13 18:16:47
This isn't needed in the header - can just be in a
bengr
2015/03/19 01:03:51
Done.
|
| + |
| + scoped_refptr<base::SingleThreadTaskRunner> task_runner_; |
| + scoped_ptr<PrefService> prefs_; |
| + scoped_refptr<net::URLRequestContextGetter> url_request_context_getter_; |
|
mmenke
2015/03/13 18:16:47
I don't think we need to hold on to this.
bengr
2015/03/19 01:03:51
Someone does, and currently DRPService takes a raw
mmenke
2015/03/19 02:50:18
That should be fixed. Happy to review a tiny CL t
bengr
2015/03/19 17:56:24
This can't be fixed easily afaik. In profile_impl_
|
| + scoped_ptr<data_reduction_proxy::DataReductionProxySettings> settings_; |
| + scoped_ptr<data_reduction_proxy::DataReductionProxyIOData> io_data_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(CronetDataReductionProxy); |
| +}; |
| + |
| +} // namespace cronet |
| + |
| +#endif // COMPONENTS_CRONET_ANDROID_CRONET_DATA_REDUCTION_PROXY_H_ |