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

Side by Side Diff: ios/web/public/origin_util.mm

Issue 2382203002: [ARC] Converts part of ios/web/public to ARC. (Closed)
Patch Set: Created 4 years, 2 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 unified diff | Download patch
« no previous file with comments | « ios/web/BUILD.gn ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #import "ios/web/public/origin_util.h" 5 #import "ios/web/public/origin_util.h"
6 6
7 #import <WebKit/WebKit.h> 7 #import <WebKit/WebKit.h>
8 8
9 #include "base/numerics/safe_conversions.h" 9 #include "base/numerics/safe_conversions.h"
10 #include "base/strings/sys_string_conversions.h" 10 #include "base/strings/sys_string_conversions.h"
11 #include "net/base/url_util.h" 11 #include "net/base/url_util.h"
12 #include "url/gurl.h" 12 #include "url/gurl.h"
13 #include "url/scheme_host_port.h" 13 #include "url/scheme_host_port.h"
14 14
15 #if !defined(__has_feature) || !__has_feature(objc_arc)
16 #error "This file requires ARC support."
17 #endif
18
15 namespace web { 19 namespace web {
16 20
17 bool IsOriginSecure(const GURL& url) { 21 bool IsOriginSecure(const GURL& url) {
18 if (url.SchemeIsCryptographic() || url.SchemeIsFile()) 22 if (url.SchemeIsCryptographic() || url.SchemeIsFile())
19 return true; 23 return true;
20 24
21 if (url.SchemeIsFileSystem() && url.inner_url() && 25 if (url.SchemeIsFileSystem() && url.inner_url() &&
22 IsOriginSecure(*url.inner_url())) { 26 IsOriginSecure(*url.inner_url())) {
23 return true; 27 return true;
24 } 28 }
25 29
26 std::string hostname = url.HostNoBrackets(); 30 std::string hostname = url.HostNoBrackets();
27 if (net::IsLocalhost(hostname)) 31 if (net::IsLocalhost(hostname))
28 return true; 32 return true;
29 33
30 return false; 34 return false;
31 } 35 }
32 36
33 GURL GURLOriginWithWKSecurityOrigin(WKSecurityOrigin* origin) { 37 GURL GURLOriginWithWKSecurityOrigin(WKSecurityOrigin* origin) {
34 if (!origin) 38 if (!origin)
35 return GURL(); 39 return GURL();
36 40
37 url::SchemeHostPort origin_tuple(base::SysNSStringToUTF8(origin.protocol), 41 url::SchemeHostPort origin_tuple(base::SysNSStringToUTF8(origin.protocol),
38 base::SysNSStringToUTF8(origin.host), 42 base::SysNSStringToUTF8(origin.host),
39 base::checked_cast<uint16_t>(origin.port)); 43 base::checked_cast<uint16_t>(origin.port));
40 return GURL(origin_tuple.Serialize()); 44 return GURL(origin_tuple.Serialize());
41 } 45 }
42 46
43 } // namespace web 47 } // namespace web
OLDNEW
« no previous file with comments | « ios/web/BUILD.gn ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698