Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(185)

Side by Side Diff: components/cronet/android/cronet_data_reduction_proxy.h

Issue 937513003: Add Data Saver support to Cronet (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed comments Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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.
mmenke 2015/04/24 19:10:28 Think it's worth mentioning that it configures thi
bengr 2015/04/24 21:13:50 Done.
36 class CronetDataReductionProxy {
37 public:
38 // Construct Data Reduction Proxy Settings and IOData objects and set
39 // the authentication key. The task_runner should be suitable for running
40 // tasks on the network thread. The primary proxy, fallback proxy, and secure
41 // proxy check url can override defaults. All or none must be specified.
42 CronetDataReductionProxy(
43 const std::string& key,
44 const std::string& primary_proxy,
45 const std::string& fallback_proxy,
46 const std::string& secure_proxy_check_url,
47 const std::string& user_agent,
48 scoped_refptr<base::SingleThreadTaskRunner> task_runner,
49 net::NetLog* net_log);
50
51 ~CronetDataReductionProxy();
52
53 // Constructs a network delegate suitable for adding Data Reduction Proxy
54 // request headers.
55 scoped_ptr<net::NetworkDelegate> CreateNetworkDelegate(
56 scoped_ptr<net::NetworkDelegate> wrapped_network_delegate);
57
58 // Constructs a URLRequestInterceptor suitable for carrying out the Data
59 // Reduction Proxy's bypass protocol.
60 scoped_ptr<net::URLRequestInterceptor> CreateInterceptor();
61
62 // Constructs a bridge between the Settings and IOData objects, sets up a
63 // context for secure proxy check requests, and enables the proxy, if
64 // |enable| is true.
65 void Init(bool enable, net::URLRequestContext* context);
66
67 private:
68 scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
69 scoped_ptr<PrefService> prefs_;
70 scoped_refptr<net::URLRequestContextGetter> url_request_context_getter_;
71 scoped_ptr<data_reduction_proxy::DataReductionProxySettings> settings_;
72 scoped_ptr<data_reduction_proxy::DataReductionProxyIOData> io_data_;
73
74 DISALLOW_COPY_AND_ASSIGN(CronetDataReductionProxy);
75 };
76
77 } // namespace cronet
78
79 #endif // COMPONENTS_CRONET_ANDROID_CRONET_DATA_REDUCTION_PROXY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698