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
3 // found in the LICENSE file.
5 #import "ios/web/public/url_scheme_util.h"
7 #import <Foundation/Foundation.h>
13 bool UrlHasWebScheme(const GURL& url) {
14 return url.SchemeIs(url::kHttpScheme) ||
15 url.SchemeIs(url::kHttpsScheme) ||
16 url.SchemeIs(url::kDataScheme);
19 bool UrlHasWebScheme(NSURL* url) {
20 NSString* scheme = [url scheme];
24 // Use the GURL implementation, but with a scheme-only URL to avoid
25 // unnecessary parsing in GURL construction.
26 NSString* schemeURLString = [scheme stringByAppendingString:@":"];
27 GURL gurl([schemeURLString UTF8String]);
28 return UrlHasWebScheme(gurl);