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/net/url_scheme_util.h"
7 #import <Foundation/Foundation.h>
9 #include "base/logging.h"
10 #include "base/strings/sys_string_conversions.h"
15 bool UrlSchemeIs(NSURL* url, NSString* scheme) {
16 DCHECK([scheme isEqualToString:[scheme lowercaseString]]);
17 NSString* url_scheme = [url scheme];
18 return (url_scheme != nil) &&
19 [url_scheme caseInsensitiveCompare:scheme] == NSOrderedSame;
22 bool UrlHasDataScheme(NSURL* url) {
23 return UrlSchemeIs(url, base::SysUTF8ToNSString(url::kDataScheme));