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

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: Added test Created 5 years, 9 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.
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.
41 CronetDataReductionProxy(
42 const std::string& key,
43 const std::string& options,
44 scoped_refptr<base::SingleThreadTaskRunner> task_runner,
45 net::NetLog* net_log);
46
47 ~CronetDataReductionProxy();
48
49 // Constructs a network delegate suitable for adding Data Reduction Proxy
50 // request headers.
51 scoped_ptr<net::NetworkDelegate> CreateNetworkDelegate(
52 scoped_ptr<net::NetworkDelegate> wrapped_network_delegate);
53
54 // Constructs a URLRequestInterceptor suitable for carrying out the Data
55 // Reduction Proxy's bypass protocol.
56 scoped_ptr<net::URLRequestInterceptor> CreateInterceptor();
57
58 // Constructs a bridge between the Settings and IOData objects, sets up a
59 // context for secure proxy check requests, and enables the proxy, if
60 // |enable| is true.
61 void Init(bool enable, net::URLRequestContext* context);
62
63 private:
64 scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
65 scoped_ptr<PrefService> prefs_;
66 scoped_refptr<net::URLRequestContextGetter> url_request_context_getter_;
67 scoped_ptr<data_reduction_proxy::DataReductionProxySettings> settings_;
68 scoped_ptr<data_reduction_proxy::DataReductionProxyIOData> io_data_;
69
70 DISALLOW_COPY_AND_ASSIGN(CronetDataReductionProxy);
71 };
72
73 } // namespace cronet
74
75 #endif // COMPONENTS_CRONET_ANDROID_CRONET_DATA_REDUCTION_PROXY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698