OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 ANDROID_WEBVIEW_BROWSER_NET_AW_URL_REQUEST_JOB_FACTORY_H_ | 5 #ifndef ANDROID_WEBVIEW_BROWSER_NET_AW_URL_REQUEST_JOB_FACTORY_H_ |
6 #define ANDROID_WEBVIEW_BROWSER_NET_AW_URL_REQUEST_JOB_FACTORY_H_ | 6 #define ANDROID_WEBVIEW_BROWSER_NET_AW_URL_REQUEST_JOB_FACTORY_H_ |
7 | 7 |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "net/url_request/url_request_job_factory.h" | 9 #include "net/url_request/url_request_job_factory.h" |
10 | 10 |
11 namespace net { | |
12 class URLRequestJobFactoryImpl; | |
13 } // namespace net | |
14 | |
11 namespace android_webview { | 15 namespace android_webview { |
12 | 16 |
13 // android_webview uses a custom URLRequestJobFactoryImpl to support | 17 // android_webview uses a custom URLRequestJobFactoryImpl to support |
14 // navigation interception and URLRequestJob interception for navigations to | 18 // navigation interception and URLRequestJob interception for navigations to |
15 // url with unsupported schemes. | 19 // url with unsupported schemes. |
16 // This is achieved by returning a URLRequestErrorJob for schemes that would | 20 // This is achieved by returning a URLRequestErrorJob for schemes that would |
17 // otherwise be unhandled, which gives the embedder an opportunity to intercept | 21 // otherwise be unhandled, which gives the embedder an opportunity to intercept |
18 // the request. | 22 // the request. |
19 class AwURLRequestJobFactory : public net::URLRequestJobFactory { | 23 class AwURLRequestJobFactory : public net::URLRequestJobFactory { |
20 public: | 24 public: |
21 AwURLRequestJobFactory(); | 25 AwURLRequestJobFactory(); |
22 virtual ~AwURLRequestJobFactory(); | 26 virtual ~AwURLRequestJobFactory(); |
23 | 27 |
24 virtual bool SetProtocolHandler(const std::string& scheme, | 28 bool SetProtocolHandler(const std::string& scheme, |
25 ProtocolHandler* protocol_handler) OVERRIDE; | 29 ProtocolHandler* protocol_handler); |
26 virtual void AddInterceptor(Interceptor* interceptor) OVERRIDE; | 30 |
27 virtual net::URLRequestJob* MaybeCreateJobWithInterceptor( | 31 // net::URLRequestJobFactory implementation |
mmenke
2013/02/11 17:19:32
nit: These typically end in a colon or period.
| |
28 net::URLRequest* request, | |
29 net::NetworkDelegate* network_delegate) const OVERRIDE; | |
30 virtual net::URLRequestJob* MaybeCreateJobWithProtocolHandler( | 32 virtual net::URLRequestJob* MaybeCreateJobWithProtocolHandler( |
31 const std::string& scheme, | 33 const std::string& scheme, |
32 net::URLRequest* request, | 34 net::URLRequest* request, |
33 net::NetworkDelegate* network_delegate) const OVERRIDE; | 35 net::NetworkDelegate* network_delegate) const OVERRIDE; |
34 virtual net::URLRequestJob* MaybeInterceptRedirect( | |
35 const GURL& location, | |
36 net::URLRequest* request, | |
37 net::NetworkDelegate* network_delegate) const OVERRIDE; | |
38 virtual net::URLRequestJob* MaybeInterceptResponse( | |
39 net::URLRequest* request, | |
40 net::NetworkDelegate* network_delegate) const OVERRIDE; | |
41 virtual bool IsHandledProtocol(const std::string& scheme) const OVERRIDE; | 36 virtual bool IsHandledProtocol(const std::string& scheme) const OVERRIDE; |
42 virtual bool IsHandledURL(const GURL& url) const OVERRIDE; | 37 virtual bool IsHandledURL(const GURL& url) const OVERRIDE; |
43 | 38 |
44 private: | 39 private: |
45 // By default calls are forwarded to this factory, to avoid having to | 40 // By default calls are forwarded to this factory, to avoid having to |
46 // subclass an existing implementation class. | 41 // subclass an existing implementation class. |
47 scoped_ptr<URLRequestJobFactory> next_factory_; | 42 scoped_ptr<net::URLRequestJobFactoryImpl> next_factory_; |
48 | 43 |
49 DISALLOW_COPY_AND_ASSIGN(AwURLRequestJobFactory); | 44 DISALLOW_COPY_AND_ASSIGN(AwURLRequestJobFactory); |
50 }; | 45 }; |
51 | 46 |
52 } // namespace android_webview | 47 } // namespace android_webview |
53 | 48 |
54 #endif // ANDROID_WEBVIEW_BROWSER_NET_AW_URL_REQUEST_JOB_FACTORY_H_ | 49 #endif // ANDROID_WEBVIEW_BROWSER_NET_AW_URL_REQUEST_JOB_FACTORY_H_ |
OLD | NEW |