 Chromium Code Reviews
 Chromium Code Reviews Issue 430193002:
  Wire 'blink::Platform::isHostnameReservedIPAddress()' to 'net::IsReservedIPAddress()'.  (Closed) 
  Base URL: svn://svn.chromium.org/chrome/trunk/src
    
  
    Issue 430193002:
  Wire 'blink::Platform::isHostnameReservedIPAddress()' to 'net::IsReservedIPAddress()'.  (Closed) 
  Base URL: svn://svn.chromium.org/chrome/trunk/src| Index: content/child/blink_platform_impl.cc | 
| diff --git a/content/child/blink_platform_impl.cc b/content/child/blink_platform_impl.cc | 
| index d4449ff760e673c8aa137572c437879479f10d48..33fd565034eab754f5ed84ee6c9a4f90f320f9b6 100644 | 
| --- a/content/child/blink_platform_impl.cc | 
| +++ b/content/child/blink_platform_impl.cc | 
| @@ -42,11 +42,15 @@ | 
| #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" | 
| +#include "url/url_canon_ip.h" | 
| 
Ryan Sleevi
2014/08/06 19:42:12
Not needed?
 
Mike West
2014/08/08 08:15:03
Done.
 | 
| #if defined(OS_ANDROID) | 
| #include "content/child/fling_animator_impl_android.h" | 
| @@ -151,6 +155,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 +450,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); | 
| } |