Don't show supervised user as "already on this device" while they're being imported.
[chromium-blink-merge.git] / ios / web / url_scheme_util.mm
blob945a09a54f79d92fbddd1f75c110fcba27e8df58
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>
9 #include "url/gurl.h"
11 namespace web {
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];
21   if (![scheme length])
22     return false;
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);
31 }  // namespace web