blob: ebd77cc2d16c32bc9e08cf3ba3448124d48c731a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
// Copyright 2014 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.
#import "ios/net/url_scheme_util.h"
#import <Foundation/Foundation.h>
#include "base/logging.h"
#include "base/strings/sys_string_conversions.h"
#include "url/gurl.h"
namespace net {
bool UrlSchemeIs(NSURL* url, NSString* scheme) {
DCHECK([scheme isEqualToString:[scheme lowercaseString]]);
NSString* url_scheme = [url scheme];
return (url_scheme != nil) &&
[url_scheme caseInsensitiveCompare:scheme] == NSOrderedSame;
}
bool UrlHasDataScheme(NSURL* url) {
return UrlSchemeIs(url, base::SysUTF8ToNSString(url::kDataScheme));
}
} // namespace net
|