[BackgroundSyncManager] Rename BackgroundSyncRegistration.name to tag
[chromium-blink-merge.git] / ios / net / crn_http_protocol_handler.h
blob42470904104c51cf2572b1e2c9154ee233645213
1 // Copyright 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 IOS_NET_CRN_HTTP_PROTOCOL_HANDLER_H_
6 #define IOS_NET_CRN_HTTP_PROTOCOL_HANDLER_H_
8 #import <Foundation/Foundation.h>
10 namespace net {
11 class URLRequestContextGetter;
13 class HTTPProtocolHandlerDelegate {
14 public:
15 // Sets the global instance of the HTTPProtocolHandlerDelegate.
16 static void SetInstance(HTTPProtocolHandlerDelegate* delegate);
18 virtual ~HTTPProtocolHandlerDelegate() {}
20 // Returns true if CRNHTTPProtocolHandler should handle the request.
21 // Returns false if the request should be passed down the NSURLProtocol chain.
22 virtual bool CanHandleRequest(NSURLRequest* request) = 0;
24 // If IsRequestSupported returns true, |request| will be processed, otherwise
25 // a NSURLErrorUnsupportedURL error is generated.
26 virtual bool IsRequestSupported(NSURLRequest* request) = 0;
28 // Returns the request context used for requests that are not associated with
29 // a RequestTracker. This includes in particular the requests that are not
30 // aware of the network stack. Must not return null.
31 virtual URLRequestContextGetter* GetDefaultURLRequestContext() = 0;
34 } // namespace net
36 // Custom NSURLProtocol handling HTTP and HTTPS requests.
37 // The HttpProtocolHandler is registered as a NSURLProtocol in the iOS system.
38 // This protocol is called for each NSURLRequest. This allows handling the
39 // requests issued by UIWebView using our own network stack.
40 @interface CRNHTTPProtocolHandler : NSURLProtocol
41 @end
43 #endif // IOS_NET_CRN_HTTP_PROTOCOL_HANDLER_H_