OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #include "ios/web/net/web_http_protocol_handler_delegate.h" | 5 #include "ios/web/net/web_http_protocol_handler_delegate.h" |
6 | 6 |
7 #import <Foundation/Foundation.h> | 7 #import <Foundation/Foundation.h> |
8 | 8 |
9 #import "ios/web/public/url_scheme_util.h" | 9 #import "ios/web/public/url_scheme_util.h" |
10 #include "ios/web/public/web_client.h" | 10 #include "ios/web/public/web_client.h" |
11 #include "net/url_request/url_request_context_getter.h" | 11 #include "net/url_request/url_request_context_getter.h" |
12 #include "url/gurl.h" | 12 #include "url/gurl.h" |
13 | 13 |
| 14 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 15 #error "This file requires ARC support." |
| 16 #endif |
| 17 |
14 namespace { | 18 namespace { |
15 | 19 |
16 bool IsAppSpecificScheme(NSURL* url) { | 20 bool IsAppSpecificScheme(NSURL* url) { |
17 NSString* scheme = [url scheme]; | 21 NSString* scheme = [url scheme]; |
18 if (![scheme length]) | 22 if (![scheme length]) |
19 return false; | 23 return false; |
20 // Use the GURL implementation, but with a scheme-only URL to avoid | 24 // Use the GURL implementation, but with a scheme-only URL to avoid |
21 // unnecessary parsing in GURL construction. | 25 // unnecessary parsing in GURL construction. |
22 GURL gurl([[scheme stringByAppendingString:@":"] UTF8String]); | 26 GURL gurl([[scheme stringByAppendingString:@":"] UTF8String]); |
23 return web::GetWebClient()->IsAppSpecificURL(gurl); | 27 return web::GetWebClient()->IsAppSpecificURL(gurl); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 (IsAppSpecificScheme([request URL]) && | 66 (IsAppSpecificScheme([request URL]) && |
63 IsAppSpecificScheme([request mainDocumentURL])); | 67 IsAppSpecificScheme([request mainDocumentURL])); |
64 } | 68 } |
65 | 69 |
66 net::URLRequestContextGetter* | 70 net::URLRequestContextGetter* |
67 WebHTTPProtocolHandlerDelegate::GetDefaultURLRequestContext() { | 71 WebHTTPProtocolHandlerDelegate::GetDefaultURLRequestContext() { |
68 return default_getter_.get(); | 72 return default_getter_.get(); |
69 } | 73 } |
70 | 74 |
71 } // namespace web | 75 } // namespace web |
OLD | NEW |