diff options
author | erg <erg@chromium.org> | 2015-03-27 14:35:31 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-03-27 21:36:42 +0000 |
commit | 47c7235fbe0a67aac89303ae6b07cb4688c32866 (patch) | |
tree | c245d82be50097c6244f7cecb82617ed13f9d9fd /mojo | |
parent | aa503001455edb26649fc9e85938e9fade5a5a0b (diff) | |
download | chromium_src-47c7235fbe0a67aac89303ae6b07cb4688c32866.zip chromium_src-47c7235fbe0a67aac89303ae6b07cb4688c32866.tar.gz chromium_src-47c7235fbe0a67aac89303ae6b07cb4688c32866.tar.bz2 |
html_viewer: check reserved network addresses.
This just copies the content/ implementation.
BUG=none
Review URL: https://codereview.chromium.org/1040723003
Cr-Commit-Position: refs/heads/master@{#322646}
Diffstat (limited to 'mojo')
-rw-r--r-- | mojo/services/html_viewer/blink_platform_impl.cc | 9 | ||||
-rw-r--r-- | mojo/services/html_viewer/blink_platform_impl.h | 1 |
2 files changed, 10 insertions, 0 deletions
diff --git a/mojo/services/html_viewer/blink_platform_impl.cc b/mojo/services/html_viewer/blink_platform_impl.cc index 048fdfe..5c02395 100644 --- a/mojo/services/html_viewer/blink_platform_impl.cc +++ b/mojo/services/html_viewer/blink_platform_impl.cc @@ -17,6 +17,7 @@ #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/WebWaitableEvent.h" namespace html_viewer { @@ -209,6 +210,14 @@ blink::WebURLError BlinkPlatformImpl::cancelledError(const blink::WebURL& url) return error; } +bool BlinkPlatformImpl::isReservedIPAddress( + const blink::WebString& host) const { + net::IPAddressNumber address; + if (!net::ParseURLHostnameToNumber(host.utf8(), &address)) + return false; + return net::IsIPAddressReserved(address); +} + blink::WebThread* BlinkPlatformImpl::createThread(const char* name) { return new WebThreadImpl(name); } diff --git a/mojo/services/html_viewer/blink_platform_impl.h b/mojo/services/html_viewer/blink_platform_impl.h index 4d4a4e7..7d039892 100644 --- a/mojo/services/html_viewer/blink_platform_impl.h +++ b/mojo/services/html_viewer/blink_platform_impl.h @@ -46,6 +46,7 @@ class BlinkPlatformImpl : public blink::Platform { const blink::WebURL& url, blink::WebString& mime_type, blink::WebString& charset); virtual blink::WebURLError cancelledError(const blink::WebURL& url) const; + virtual bool isReservedIPAddress(const blink::WebString& host) const; virtual blink::WebThread* createThread(const char* name); virtual blink::WebThread* currentThread(); virtual void yieldCurrentThread(); |