Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(249)

Unified Diff: ios/net/url_scheme_util.mm

Issue 994823004: [iOS] Upstream //ios/net (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ios/net/url_scheme_util.mm
diff --git a/ios/net/url_scheme_util.mm b/ios/net/url_scheme_util.mm
new file mode 100644
index 0000000000000000000000000000000000000000..ebd77cc2d16c32bc9e08cf3ba3448124d48c731a
--- /dev/null
+++ b/ios/net/url_scheme_util.mm
@@ -0,0 +1,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

Powered by Google App Engine
This is Rietveld 408576698