diff options
author | tsepez@chromium.org <tsepez@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-11-18 22:03:51 +0000 |
---|---|---|
committer | tsepez@chromium.org <tsepez@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-11-18 22:03:51 +0000 |
commit | b9829df7070beb8bfbbac366a0f84fb00bb25a92 (patch) | |
tree | 4cc4850a7d01c1354ff9866a7decd0e3b5a1270f /content | |
parent | 2b0dbd272de36d95c7cd0890a5b3f391f7a13970 (diff) | |
download | chromium_src-b9829df7070beb8bfbbac366a0f84fb00bb25a92.zip chromium_src-b9829df7070beb8bfbbac366a0f84fb00bb25a92.tar.gz chromium_src-b9829df7070beb8bfbbac366a0f84fb00bb25a92.tar.bz2 |
The WebPublicSuffixList API allows embedders to tell Blink about what constitutes a top-level domain. It is the source of truth that says that for google.co.uk, co.uk is the top-level domain, and not just .uk. Blink has, until now, been completely ignorant of this complication.
This is the third part of a two-sided patch. The tests will be on the Blink side, landing as the fourth part of the two-sided patch (once this has landed on the chrome side).
BUG=307407
Review URL: https://codereview.chromium.org/60893002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@235828 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content')
-rw-r--r-- | content/content_renderer.gypi | 6 | ||||
-rw-r--r-- | content/renderer/renderer_webkitplatformsupport_impl.cc | 8 | ||||
-rw-r--r-- | content/renderer/renderer_webkitplatformsupport_impl.h | 4 | ||||
-rw-r--r-- | content/renderer/webpublicsuffixlist_impl.cc | 23 | ||||
-rw-r--r-- | content/renderer/webpublicsuffixlist_impl.h | 22 |
5 files changed, 61 insertions, 2 deletions
diff --git a/content/content_renderer.gypi b/content/content_renderer.gypi index 736fc82..f08e2d3 100644 --- a/content/content_renderer.gypi +++ b/content/content_renderer.gypi @@ -492,17 +492,19 @@ 'renderer/text_input_client_observer.h', 'renderer/v8_value_converter_impl.cc', 'renderer/v8_value_converter_impl.h', - 'renderer/webclipboard_impl.cc', - 'renderer/webclipboard_impl.h', 'renderer/web_preferences.cc', 'renderer/web_ui_extension.cc', 'renderer/web_ui_extension.h', 'renderer/web_ui_extension_data.cc', 'renderer/web_ui_extension_data.h', + 'renderer/webclipboard_impl.cc', + 'renderer/webclipboard_impl.h', 'renderer/webcrypto/webcrypto_impl.cc', 'renderer/webcrypto/webcrypto_impl.h', 'renderer/webcrypto/webcrypto_impl_nss.cc', 'renderer/webcrypto/webcrypto_impl_openssl.cc', + 'renderer/webpublicsuffixlist_impl.cc', + 'renderer/webpublicsuffixlist_impl.h', 'renderer/websharedworker_proxy.cc', 'renderer/websharedworker_proxy.h', ], diff --git a/content/renderer/renderer_webkitplatformsupport_impl.cc b/content/renderer/renderer_webkitplatformsupport_impl.cc index 6ccf457..7a3f1b9 100644 --- a/content/renderer/renderer_webkitplatformsupport_impl.cc +++ b/content/renderer/renderer_webkitplatformsupport_impl.cc @@ -48,6 +48,7 @@ #include "content/renderer/renderer_clipboard_client.h" #include "content/renderer/webclipboard_impl.h" #include "content/renderer/webcrypto/webcrypto_impl.h" +#include "content/renderer/webpublicsuffixlist_impl.h" #include "gpu/config/gpu_info.h" #include "ipc/ipc_sync_message_filter.h" #include "media/audio/audio_output_device.h" @@ -806,6 +807,13 @@ void RendererWebKitPlatformSupportImpl::getPluginList( //------------------------------------------------------------------------------ +blink::WebPublicSuffixList* +RendererWebKitPlatformSupportImpl::publicSuffixList() { + return &public_suffix_list_; +} + +//------------------------------------------------------------------------------ + blink::WebString RendererWebKitPlatformSupportImpl::signedPublicKeyAndChallengeString( unsigned key_size_index, diff --git a/content/renderer/renderer_webkitplatformsupport_impl.h b/content/renderer/renderer_webkitplatformsupport_impl.h index 793acb38..a759b19 100644 --- a/content/renderer/renderer_webkitplatformsupport_impl.h +++ b/content/renderer/renderer_webkitplatformsupport_impl.h @@ -10,6 +10,7 @@ #include "base/platform_file.h" #include "content/child/webkitplatformsupport_impl.h" #include "content/common/content_export.h" +#include "content/renderer/webpublicsuffixlist_impl.h" #include "third_party/WebKit/public/platform/WebGraphicsContext3D.h" #include "third_party/WebKit/public/platform/WebIDBFactory.h" #include "webkit/renderer/compositor_bindings/web_compositor_support_impl.h" @@ -88,6 +89,7 @@ class CONTENT_EXPORT RendererWebKitPlatformSupportImpl const blink::WebURL& url); virtual void getPluginList(bool refresh, blink::WebPluginListBuilder* builder); + virtual blink::WebPublicSuffixList* publicSuffixList(); virtual void screenColorProfile(blink::WebVector<char>* to_profile); virtual blink::WebIDBFactory* idbFactory(); virtual blink::WebFileSystem* fileSystem(); @@ -203,6 +205,8 @@ class CONTENT_EXPORT RendererWebKitPlatformSupportImpl scoped_ptr<blink::WebBlobRegistry> blob_registry_; + WebPublicSuffixListImpl public_suffix_list_; + scoped_ptr<DeviceMotionEventPump> device_motion_event_pump_; scoped_ptr<DeviceOrientationEventPump> device_orientation_event_pump_; diff --git a/content/renderer/webpublicsuffixlist_impl.cc b/content/renderer/webpublicsuffixlist_impl.cc new file mode 100644 index 0000000..e1e00c22 --- /dev/null +++ b/content/renderer/webpublicsuffixlist_impl.cc @@ -0,0 +1,23 @@ +// Copyright 2013 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "content/renderer/webpublicsuffixlist_impl.h" + +#include "net/base/registry_controlled_domains/registry_controlled_domain.h" + +namespace content { + +WebPublicSuffixListImpl::~WebPublicSuffixListImpl() { +} + +size_t WebPublicSuffixListImpl::getPublicSuffixLength( + const blink::WebString& host) { + size_t result = net::registry_controlled_domains::GetRegistryLength( + host.utf8(), + net::registry_controlled_domains::INCLUDE_UNKNOWN_REGISTRIES, + net::registry_controlled_domains::INCLUDE_PRIVATE_REGISTRIES); + return result ? result : host.length(); +} + +} // namespace content diff --git a/content/renderer/webpublicsuffixlist_impl.h b/content/renderer/webpublicsuffixlist_impl.h new file mode 100644 index 0000000..65fcc65 --- /dev/null +++ b/content/renderer/webpublicsuffixlist_impl.h @@ -0,0 +1,22 @@ +// Copyright 2013 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CONTENT_RENDERER_WEBPUBLICSUFFIXLIST_IMPL_H_ +#define CONTENT_RENDERER_WEBPUBLICSUFFIXLIST_IMPL_H_ + +#include "base/compiler_specific.h" +#include "third_party/WebKit/public/platform/WebPublicSuffixList.h" + +namespace content { + +class WebPublicSuffixListImpl : public blink::WebPublicSuffixList { + public: + // WebPublicSuffixList methods: + virtual size_t getPublicSuffixLength(const blink::WebString& host); + virtual ~WebPublicSuffixListImpl(); +}; + +} // namespace content + +#endif // CONTENT_RENDERER_WEBPUBLICSUFFIXLIST_IMPL_H_ |