[email protected] | 5b15e13 | 2012-10-16 16:28:51 | [diff] [blame] | 1 | // Copyright (c) 2012 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 ANDROID_WEBVIEW_BROWSER_AW_REQUEST_INTERCEPTOR_H_ | ||||
6 | #define ANDROID_WEBVIEW_BROWSER_AW_REQUEST_INTERCEPTOR_H_ | ||||
7 | |||||
8 | #include "base/memory/scoped_ptr.h" | ||||
[email protected] | 3b90aab | 2014-05-30 17:56:15 | [diff] [blame] | 9 | #include "net/url_request/url_request_interceptor.h" |
[email protected] | 5b15e13 | 2012-10-16 16:28:51 | [diff] [blame] | 10 | |
11 | class GURL; | ||||
12 | |||||
13 | namespace net { | ||||
14 | class URLRequest; | ||||
15 | class URLRequestContextGetter; | ||||
16 | class URLRequestJob; | ||||
17 | class NetworkDelegate; | ||||
18 | } | ||||
19 | |||||
20 | namespace android_webview { | ||||
21 | |||||
[email protected] | e41d59c | 2014-06-20 19:59:55 | [diff] [blame] | 22 | class AwWebResourceResponse; |
[email protected] | 5b15e13 | 2012-10-16 16:28:51 | [diff] [blame] | 23 | |
24 | // This class allows the Java-side embedder to substitute the default | ||||
25 | // URLRequest of a given request for an alternative job that will read data | ||||
26 | // from a Java stream. | ||||
[email protected] | 3b90aab | 2014-05-30 17:56:15 | [diff] [blame] | 27 | class AwRequestInterceptor : public net::URLRequestInterceptor { |
[email protected] | 5b15e13 | 2012-10-16 16:28:51 | [diff] [blame] | 28 | public: |
29 | AwRequestInterceptor(); | ||||
dcheng | 996c125c | 2015-02-04 02:25:49 | [diff] [blame^] | 30 | ~AwRequestInterceptor() override; |
[email protected] | 5b15e13 | 2012-10-16 16:28:51 | [diff] [blame] | 31 | |
[email protected] | 3b90aab | 2014-05-30 17:56:15 | [diff] [blame] | 32 | // net::URLRequestInterceptor override -------------------------------------- |
dcheng | 996c125c | 2015-02-04 02:25:49 | [diff] [blame^] | 33 | net::URLRequestJob* MaybeInterceptRequest( |
[email protected] | 5b15e13 | 2012-10-16 16:28:51 | [diff] [blame] | 34 | net::URLRequest* request, |
mostynb | d731a491 | 2014-10-07 13:36:11 | [diff] [blame] | 35 | net::NetworkDelegate* network_delegate) const override; |
[email protected] | 5b15e13 | 2012-10-16 16:28:51 | [diff] [blame] | 36 | |
37 | private: | ||||
[email protected] | e41d59c | 2014-06-20 19:59:55 | [diff] [blame] | 38 | scoped_ptr<AwWebResourceResponse> QueryForAwWebResourceResponse( |
[email protected] | 5b15e13 | 2012-10-16 16:28:51 | [diff] [blame] | 39 | const GURL& location, |
40 | net::URLRequest* request) const; | ||||
41 | |||||
42 | DISALLOW_COPY_AND_ASSIGN(AwRequestInterceptor); | ||||
43 | }; | ||||
44 | |||||
45 | } // namespace android_webview | ||||
46 | |||||
47 | #endif // ANDROID_WEBVIEW_BROWSER_AW_REQUEST_INTERCEPTOR_H_ |