OLD | NEW |
(Empty) | |
| 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. |
| 4 |
| 5 #ifndef IOS_NET_CRN_HTTP_PROTOCOL_HANDLER_H_ |
| 6 #define IOS_NET_CRN_HTTP_PROTOCOL_HANDLER_H_ |
| 7 |
| 8 #import <Foundation/Foundation.h> |
| 9 |
| 10 namespace net { |
| 11 class URLRequestContextGetter; |
| 12 |
| 13 class HTTPProtocolHandlerDelegate { |
| 14 public: |
| 15 // Sets the global instance of the HTTPProtocolHandlerDelegate. |
| 16 static void SetInstance(HTTPProtocolHandlerDelegate* delegate); |
| 17 |
| 18 virtual ~HTTPProtocolHandlerDelegate() {} |
| 19 |
| 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; |
| 23 |
| 24 // If IsRequestSupported returns true, |request| will be processed, otherwise |
| 25 // a NSURLErrorUnsupportedURL error is generated. |
| 26 virtual bool IsRequestSupported(NSURLRequest* request) = 0; |
| 27 |
| 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; |
| 32 }; |
| 33 |
| 34 } // namespace net |
| 35 |
| 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 |
| 42 |
| 43 #endif // IOS_NET_CRN_HTTP_PROTOCOL_HANDLER_H_ |
OLD | NEW |