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

Unified Diff: content/child/blink_platform_impl.cc

Issue 430193002: Wire 'blink::Platform::isHostnameReservedIPAddress()' to 'net::IsReservedIPAddress()'. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Comments. Created 6 years, 4 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
« no previous file with comments | « content/child/blink_platform_impl.h ('k') | content/child/blink_platform_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/child/blink_platform_impl.cc
diff --git a/content/child/blink_platform_impl.cc b/content/child/blink_platform_impl.cc
index 648ae99feecc57a91116617720002f691c9125ba..d2b774590f1d6eaf015d3381198f34fbc3c00110 100644
--- a/content/child/blink_platform_impl.cc
+++ b/content/child/blink_platform_impl.cc
@@ -42,10 +42,13 @@
#include "net/base/data_url.h"
#include "net/base/mime_util.h"
#include "net/base/net_errors.h"
+#include "net/base/net_util.h"
#include "third_party/WebKit/public/platform/WebConvertableToTraceFormat.h"
#include "third_party/WebKit/public/platform/WebData.h"
#include "third_party/WebKit/public/platform/WebString.h"
+#include "third_party/WebKit/public/platform/WebURL.h"
#include "third_party/WebKit/public/platform/WebWaitableEvent.h"
+#include "third_party/WebKit/public/web/WebSecurityOrigin.h"
#include "ui/base/layout.h"
#if defined(OS_ANDROID)
@@ -151,6 +154,13 @@ class ConvertableToTraceFormatWrapper
blink::WebConvertableToTraceFormat convertable_;
};
+bool isHostnameReservedIPAddress(const std::string& host) {
+ net::IPAddressNumber address;
+ if (!net::ParseURLHostnameToNumber(host, &address))
+ return false;
+ return net::IsIPAddressReserved(address);
+}
+
} // namespace
static int ToMessageID(WebLocalizedString::Name name) {
@@ -439,6 +449,15 @@ WebURLError BlinkPlatformImpl::cancelledError(
return WebURLLoaderImpl::CreateError(unreachableURL, false, net::ERR_ABORTED);
}
+bool BlinkPlatformImpl::isReservedIPAddress(
+ const blink::WebSecurityOrigin& securityOrigin) const {
+ return isHostnameReservedIPAddress(securityOrigin.host().utf8());
+}
+
+bool BlinkPlatformImpl::isReservedIPAddress(const blink::WebURL& url) const {
+ return isHostnameReservedIPAddress(GURL(url).host());
+}
+
blink::WebThread* BlinkPlatformImpl::createThread(const char* name) {
return new WebThreadImpl(name);
}
« no previous file with comments | « content/child/blink_platform_impl.h ('k') | content/child/blink_platform_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698