OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 COMPONENTS_DATA_REDUCTION_PROXY_CORE_BROWSER_DATA_REDUCTION_PROXY_INTERC
EPTOR_H_ | 5 #ifndef COMPONENTS_DATA_REDUCTION_PROXY_CORE_BROWSER_DATA_REDUCTION_PROXY_INTERC
EPTOR_H_ |
6 #define COMPONENTS_DATA_REDUCTION_PROXY_CORE_BROWSER_DATA_REDUCTION_PROXY_INTERC
EPTOR_H_ | 6 #define COMPONENTS_DATA_REDUCTION_PROXY_CORE_BROWSER_DATA_REDUCTION_PROXY_INTERC
EPTOR_H_ |
7 | 7 |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "net/url_request/url_request_interceptor.h" | 9 #include "net/url_request/url_request_interceptor.h" |
10 | 10 |
11 namespace data_reduction_proxy { | 11 namespace data_reduction_proxy { |
12 class DataReductionProxyBypassProtocol; | 12 class DataReductionProxyBypassProtocol; |
13 class DataReductionProxyConfig; | 13 class DataReductionProxyConfig; |
14 class DataReductionProxyEventStore; | 14 class DataReductionProxyEventStore; |
15 class DataReductionProxyUsageStats; | 15 class DataReductionProxyBypassStats; |
16 | 16 |
17 // Used to intercept responses that contain explicit and implicit signals | 17 // Used to intercept responses that contain explicit and implicit signals |
18 // to bypass the Data Reduction Proxy. If the proxy should be bypassed, | 18 // to bypass the Data Reduction Proxy. If the proxy should be bypassed, |
19 // the interceptor returns a new URLRequestHTTPJob that fetches the resource | 19 // the interceptor returns a new URLRequestHTTPJob that fetches the resource |
20 // without use of the proxy. | 20 // without use of the proxy. |
21 class DataReductionProxyInterceptor : public net::URLRequestInterceptor { | 21 class DataReductionProxyInterceptor : public net::URLRequestInterceptor { |
22 public: | 22 public: |
23 // Constructs the interceptor. |config|, |stats|, and |event_store| must | 23 // Constructs the interceptor. |config|, |stats|, and |event_store| must |
24 // outlive |this|. |stats| may be NULL. | 24 // outlive |this|. |stats| may be NULL. |
25 DataReductionProxyInterceptor(DataReductionProxyConfig* config, | 25 DataReductionProxyInterceptor(DataReductionProxyConfig* config, |
26 DataReductionProxyUsageStats* stats, | 26 DataReductionProxyBypassStats* stats, |
27 DataReductionProxyEventStore* event_store); | 27 DataReductionProxyEventStore* event_store); |
28 | 28 |
29 // Destroys the interceptor. | 29 // Destroys the interceptor. |
30 ~DataReductionProxyInterceptor() override; | 30 ~DataReductionProxyInterceptor() override; |
31 | 31 |
32 // Overrides from net::URLRequestInterceptor: | 32 // Overrides from net::URLRequestInterceptor: |
33 net::URLRequestJob* MaybeInterceptRequest( | 33 net::URLRequestJob* MaybeInterceptRequest( |
34 net::URLRequest* request, | 34 net::URLRequest* request, |
35 net::NetworkDelegate* network_delegate) const override; | 35 net::NetworkDelegate* network_delegate) const override; |
36 | 36 |
(...skipping 13 matching lines...) Expand all Loading... |
50 | 50 |
51 private: | 51 private: |
52 // Returns a new URLRequestHTTPJob if the response or redirect indicates that | 52 // Returns a new URLRequestHTTPJob if the response or redirect indicates that |
53 // the data reduction proxy should be bypassed according to the rules in | 53 // the data reduction proxy should be bypassed according to the rules in |
54 // |bypass_protocol_|. Returns NULL otherwise. If a job is returned, the | 54 // |bypass_protocol_|. Returns NULL otherwise. If a job is returned, the |
55 // interceptor's URLRequestInterceptingJobFactory will restart the request. | 55 // interceptor's URLRequestInterceptingJobFactory will restart the request. |
56 net::URLRequestJob* MaybeInterceptResponseOrRedirect( | 56 net::URLRequestJob* MaybeInterceptResponseOrRedirect( |
57 net::URLRequest* request, net::NetworkDelegate* network_delegate) const; | 57 net::URLRequest* request, net::NetworkDelegate* network_delegate) const; |
58 | 58 |
59 // Must outlive |this| if non-NULL. | 59 // Must outlive |this| if non-NULL. |
60 DataReductionProxyUsageStats* usage_stats_; | 60 DataReductionProxyBypassStats* bypass_stats_; |
61 | 61 |
62 // Object responsible for identifying cases when a response should cause the | 62 // Object responsible for identifying cases when a response should cause the |
63 // data reduction proxy to be bypassed, and for triggering proxy bypasses in | 63 // data reduction proxy to be bypassed, and for triggering proxy bypasses in |
64 // these cases. | 64 // these cases. |
65 scoped_ptr<DataReductionProxyBypassProtocol> bypass_protocol_; | 65 scoped_ptr<DataReductionProxyBypassProtocol> bypass_protocol_; |
66 | 66 |
67 DISALLOW_COPY_AND_ASSIGN(DataReductionProxyInterceptor); | 67 DISALLOW_COPY_AND_ASSIGN(DataReductionProxyInterceptor); |
68 }; | 68 }; |
69 | 69 |
70 } // namespace data_reduction_proxy | 70 } // namespace data_reduction_proxy |
71 #endif // COMPONENTS_DATA_REDUCTION_PROXY_CORE_BROWSER_DATA_REDUCTION_PROXY_INT
ERCEPTOR_H_ | 71 #endif // COMPONENTS_DATA_REDUCTION_PROXY_CORE_BROWSER_DATA_REDUCTION_PROXY_INT
ERCEPTOR_H_ |
OLD | NEW |