Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(24)

Unified Diff: ios/net/crn_http_protocol_handler.h

Issue 994823004: [iOS] Upstream //ios/net (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ios/net/crn_http_protocol_handler.h
diff --git a/ios/net/crn_http_protocol_handler.h b/ios/net/crn_http_protocol_handler.h
new file mode 100644
index 0000000000000000000000000000000000000000..42470904104c51cf2572b1e2c9154ee233645213
--- /dev/null
+++ b/ios/net/crn_http_protocol_handler.h
@@ -0,0 +1,43 @@
+// Copyright 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef IOS_NET_CRN_HTTP_PROTOCOL_HANDLER_H_
+#define IOS_NET_CRN_HTTP_PROTOCOL_HANDLER_H_
+
+#import <Foundation/Foundation.h>
+
+namespace net {
+class URLRequestContextGetter;
+
+class HTTPProtocolHandlerDelegate {
+ public:
+ // Sets the global instance of the HTTPProtocolHandlerDelegate.
+ static void SetInstance(HTTPProtocolHandlerDelegate* delegate);
+
+ virtual ~HTTPProtocolHandlerDelegate() {}
+
+ // Returns true if CRNHTTPProtocolHandler should handle the request.
+ // Returns false if the request should be passed down the NSURLProtocol chain.
+ virtual bool CanHandleRequest(NSURLRequest* request) = 0;
+
+ // If IsRequestSupported returns true, |request| will be processed, otherwise
+ // a NSURLErrorUnsupportedURL error is generated.
+ virtual bool IsRequestSupported(NSURLRequest* request) = 0;
+
+ // Returns the request context used for requests that are not associated with
+ // a RequestTracker. This includes in particular the requests that are not
+ // aware of the network stack. Must not return null.
+ virtual URLRequestContextGetter* GetDefaultURLRequestContext() = 0;
+};
+
+} // namespace net
+
+// Custom NSURLProtocol handling HTTP and HTTPS requests.
+// The HttpProtocolHandler is registered as a NSURLProtocol in the iOS system.
+// This protocol is called for each NSURLRequest. This allows handling the
+// requests issued by UIWebView using our own network stack.
+@interface CRNHTTPProtocolHandler : NSURLProtocol
+@end
+
+#endif // IOS_NET_CRN_HTTP_PROTOCOL_HANDLER_H_

Powered by Google App Engine
This is Rietveld 408576698