Updating trunk VERSION from 2139.0 to 2140.0
[chromium-blink-merge.git] / android_webview / browser / net / aw_url_request_job_factory.h
blobb4745bd09df1749fe2e50bfeb4cc07db4dd2b9ab
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.
5 #ifndef ANDROID_WEBVIEW_BROWSER_NET_AW_URL_REQUEST_JOB_FACTORY_H_
6 #define ANDROID_WEBVIEW_BROWSER_NET_AW_URL_REQUEST_JOB_FACTORY_H_
8 #include "base/memory/scoped_ptr.h"
9 #include "net/url_request/url_request_job_factory.h"
11 namespace net {
12 class URLRequestJobFactoryImpl;
13 } // namespace net
15 namespace android_webview {
17 // android_webview uses a custom URLRequestJobFactoryImpl to support
18 // navigation interception and URLRequestJob interception for navigations to
19 // url with unsupported schemes.
20 // This is achieved by returning a URLRequestErrorJob for schemes that would
21 // otherwise be unhandled, which gives the embedder an opportunity to intercept
22 // the request.
23 class AwURLRequestJobFactory : public net::URLRequestJobFactory {
24 public:
25 AwURLRequestJobFactory();
26 virtual ~AwURLRequestJobFactory();
28 bool SetProtocolHandler(const std::string& scheme,
29 ProtocolHandler* protocol_handler);
31 // net::URLRequestJobFactory implementation.
32 virtual net::URLRequestJob* MaybeCreateJobWithProtocolHandler(
33 const std::string& scheme,
34 net::URLRequest* request,
35 net::NetworkDelegate* network_delegate) const OVERRIDE;
36 virtual bool IsHandledProtocol(const std::string& scheme) const OVERRIDE;
37 virtual bool IsHandledURL(const GURL& url) const OVERRIDE;
38 virtual bool IsSafeRedirectTarget(const GURL& location) const OVERRIDE;
40 private:
41 // By default calls are forwarded to this factory, to avoid having to
42 // subclass an existing implementation class.
43 scoped_ptr<net::URLRequestJobFactoryImpl> next_factory_;
45 DISALLOW_COPY_AND_ASSIGN(AwURLRequestJobFactory);
48 } // namespace android_webview
50 #endif // ANDROID_WEBVIEW_BROWSER_NET_AW_URL_REQUEST_JOB_FACTORY_H_