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

Side by Side Diff: third_party/WebKit/Source/platform/network/NetworkUtils.cpp

Issue 2151473002: Small improvements to MixedContentChecker. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added a TODO to SecurityOrigin::isLocalhost Created 4 years, 5 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 #include "platform/network/NetworkUtils.h" 5 #include "platform/network/NetworkUtils.h"
6 6
7 #include "net/base/ip_address.h" 7 #include "net/base/ip_address.h"
8 #include "net/base/url_util.h"
8 #include "wtf/text/StringUTF8Adaptor.h" 9 #include "wtf/text/StringUTF8Adaptor.h"
9 #include "wtf/text/WTFString.h" 10 #include "wtf/text/WTFString.h"
10 11
11 namespace blink { 12 namespace blink {
12 13
13 namespace NetworkUtils { 14 namespace NetworkUtils {
14 15
15 bool isReservedIPAddress(const String& host) 16 bool isReservedIPAddress(const String& host)
16 { 17 {
17 net::IPAddress address; 18 net::IPAddress address;
18 StringUTF8Adaptor utf8(host); 19 StringUTF8Adaptor utf8(host);
19 if (!net::ParseURLHostnameToAddress(utf8.asStringPiece(), &address)) 20 if (!net::ParseURLHostnameToAddress(utf8.asStringPiece(), &address))
20 return false; 21 return false;
21 return address.IsReserved(); 22 return address.IsReserved();
22 } 23 }
23 24
25 bool isLocalHostname(const String& host, bool* isLocal6)
26 {
27 StringUTF8Adaptor utf8(host);
28 return net::IsLocalHostname(utf8.asStringPiece(), isLocal6);
29 }
30
24 } // NetworkUtils 31 } // NetworkUtils
25 32
26 } // namespace blink 33 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698