diff options
author | raymes@chromium.org <raymes@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-04-04 17:15:48 +0000 |
---|---|---|
committer | raymes@chromium.org <raymes@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-04-04 17:15:48 +0000 |
commit | de289526526174fcea503e55153e21411a944fee (patch) | |
tree | 2c3dc5498cf014c19877ef663fe3b9dd10a8426b /webkit | |
parent | eb63d674308842a51494c543565389dd08059c45 (diff) | |
download | chromium_src-de289526526174fcea503e55153e21411a944fee.zip chromium_src-de289526526174fcea503e55153e21411a944fee.tar.gz chromium_src-de289526526174fcea503e55153e21411a944fee.tar.bz2 |
Add the PPAPI X509 Certificate interface and implementation.
Adds the interface for accessing X509 certificate fields. Note that the interface uses a GetField(field) method for accessing various fields of the certificate and all resuls are returned as pp::Var. This greatly simplifies the implementation of the interface and process of adding/changing fields so it is probably better (at least in the short term for flash).
BUG=114626
TEST=out/Debug/ui_tests --gtest_filter=*PPAPITest.*X509Certificate*
NOTRY=true
Review URL: http://codereview.chromium.org/9693024
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@130654 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r-- | webkit/glue/webkit_glue.gypi | 2 | ||||
-rw-r--r-- | webkit/plugins/ppapi/mock_plugin_delegate.cc | 6 | ||||
-rw-r--r-- | webkit/plugins/ppapi/mock_plugin_delegate.h | 5 | ||||
-rw-r--r-- | webkit/plugins/ppapi/plugin_delegate.h | 6 | ||||
-rw-r--r-- | webkit/plugins/ppapi/plugin_module.cc | 1 | ||||
-rw-r--r-- | webkit/plugins/ppapi/ppb_x509_certificate_private_impl.cc | 39 | ||||
-rw-r--r-- | webkit/plugins/ppapi/ppb_x509_certificate_private_impl.h | 37 | ||||
-rw-r--r-- | webkit/plugins/ppapi/resource_creation_impl.cc | 6 | ||||
-rw-r--r-- | webkit/plugins/ppapi/resource_creation_impl.h | 2 |
9 files changed, 104 insertions, 0 deletions
diff --git a/webkit/glue/webkit_glue.gypi b/webkit/glue/webkit_glue.gypi index 8bebf2a..785c4fa 100644 --- a/webkit/glue/webkit_glue.gypi +++ b/webkit/glue/webkit_glue.gypi @@ -331,6 +331,8 @@ '../plugins/ppapi/ppb_websocket_impl.h', '../plugins/ppapi/ppb_widget_impl.cc', '../plugins/ppapi/ppb_widget_impl.h', + '../plugins/ppapi/ppb_x509_certificate_private_impl.cc', + '../plugins/ppapi/ppb_x509_certificate_private_impl.h', '../plugins/ppapi/quota_file_io.cc', '../plugins/ppapi/quota_file_io.h', '../plugins/ppapi/resource_creation_impl.cc', diff --git a/webkit/plugins/ppapi/mock_plugin_delegate.cc b/webkit/plugins/ppapi/mock_plugin_delegate.cc index ab55d97..78e3fc9 100644 --- a/webkit/plugins/ppapi/mock_plugin_delegate.cc +++ b/webkit/plugins/ppapi/mock_plugin_delegate.cc @@ -328,6 +328,12 @@ void MockPluginDelegate::RemoveNetworkListObserver( webkit_glue::NetworkListObserver* observer) { } +bool MockPluginDelegate::X509CertificateParseDER( + const std::vector<char>& der, + ::ppapi::PPB_X509Certificate_Fields* fields) { + return false; +} + int32_t MockPluginDelegate::ShowContextMenu( PluginInstance* instance, webkit::ppapi::PPB_Flash_Menu_Impl* menu, diff --git a/webkit/plugins/ppapi/mock_plugin_delegate.h b/webkit/plugins/ppapi/mock_plugin_delegate.h index d20b05e..c506837 100644 --- a/webkit/plugins/ppapi/mock_plugin_delegate.h +++ b/webkit/plugins/ppapi/mock_plugin_delegate.h @@ -8,6 +8,7 @@ #include "webkit/plugins/ppapi/plugin_delegate.h" struct PP_NetAddress_Private; +namespace ppapi { class PPB_X509Certificate_Fields; } namespace webkit_glue { class ClipboardClient; } namespace webkit { @@ -149,6 +150,10 @@ class MockPluginDelegate : public PluginDelegate { webkit_glue::NetworkListObserver* observer) OVERRIDE; virtual void RemoveNetworkListObserver( webkit_glue::NetworkListObserver* observer) OVERRIDE; + virtual bool X509CertificateParseDER( + const std::vector<char>& der, + ::ppapi::PPB_X509Certificate_Fields* fields); + virtual int32_t ShowContextMenu( PluginInstance* instance, webkit::ppapi::PPB_Flash_Menu_Impl* menu, diff --git a/webkit/plugins/ppapi/plugin_delegate.h b/webkit/plugins/ppapi/plugin_delegate.h index 1003a6fb..d5c1557 100644 --- a/webkit/plugins/ppapi/plugin_delegate.h +++ b/webkit/plugins/ppapi/plugin_delegate.h @@ -56,6 +56,7 @@ class CommandBuffer; namespace ppapi { class PPB_HostResolver_Shared; +class PPB_X509Certificate_Fields; struct DeviceRefData; struct HostPortPair; struct Preferences; @@ -513,6 +514,11 @@ class PluginDelegate { virtual void RemoveNetworkListObserver( webkit_glue::NetworkListObserver* observer) = 0; + // For PPB_X509Certificate_Private. + virtual bool X509CertificateParseDER( + const std::vector<char>& der, + ::ppapi::PPB_X509Certificate_Fields* fields) = 0; + // Show the given context menu at the given position (in the plugin's // coordinates). virtual int32_t ShowContextMenu( diff --git a/webkit/plugins/ppapi/plugin_module.cc b/webkit/plugins/ppapi/plugin_module.cc index 0d640b1..bc9dcaf 100644 --- a/webkit/plugins/ppapi/plugin_module.cc +++ b/webkit/plugins/ppapi/plugin_module.cc @@ -83,6 +83,7 @@ #include "ppapi/c/private/ppb_tcp_socket_private.h" #include "ppapi/c/private/ppb_udp_socket_private.h" #include "ppapi/c/private/ppb_uma_private.h" +#include "ppapi/c/private/ppb_x509_certificate_private.h" #include "ppapi/c/trusted/ppb_audio_input_trusted_dev.h" #include "ppapi/c/trusted/ppb_audio_trusted.h" #include "ppapi/c/trusted/ppb_broker_trusted.h" diff --git a/webkit/plugins/ppapi/ppb_x509_certificate_private_impl.cc b/webkit/plugins/ppapi/ppb_x509_certificate_private_impl.cc new file mode 100644 index 0000000..ee08d84 --- /dev/null +++ b/webkit/plugins/ppapi/ppb_x509_certificate_private_impl.cc @@ -0,0 +1,39 @@ +// Copyright (c) 2012 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 "webkit/plugins/ppapi/ppb_x509_certificate_private_impl.h" + +#include "webkit/plugins/ppapi/plugin_delegate.h" +#include "webkit/plugins/ppapi/ppapi_plugin_instance.h" +#include "webkit/plugins/ppapi/resource_helper.h" + +namespace webkit { +namespace ppapi { + +PPB_X509Certificate_Private_Impl::PPB_X509Certificate_Private_Impl( + PP_Instance instance) : + PPB_X509Certificate_Private_Shared(::ppapi::OBJECT_IS_IMPL, instance) { +} + +// static +PP_Resource PPB_X509Certificate_Private_Impl::CreateResource( + PP_Instance instance) { + return (new PPB_X509Certificate_Private_Impl(instance))->GetReference(); +} + +bool PPB_X509Certificate_Private_Impl::ParseDER( + const std::vector<char>& der, + ::ppapi::PPB_X509Certificate_Fields* result) { + PluginDelegate* plugin_delegate = ResourceHelper::GetPluginDelegate(this); + if (!plugin_delegate) + return false; + + return plugin_delegate->X509CertificateParseDER(der, result); +} + +PPB_X509Certificate_Private_Impl::~PPB_X509Certificate_Private_Impl() { +} + +} // namespace ppapi +} // namespace webkit diff --git a/webkit/plugins/ppapi/ppb_x509_certificate_private_impl.h b/webkit/plugins/ppapi/ppb_x509_certificate_private_impl.h new file mode 100644 index 0000000..0c5949c --- /dev/null +++ b/webkit/plugins/ppapi/ppb_x509_certificate_private_impl.h @@ -0,0 +1,37 @@ +// Copyright (c) 2012 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 WEBKIT_PLUGINS_PPAPI_PPB_X509_CERTIFICATE_PRIVATE_IMPL_H_ +#define WEBKIT_PLUGINS_PPAPI_PPB_X509_CERTIFICATE_PRIVATE_IMPL_H_ + +#include "base/basictypes.h" +#include "base/compiler_specific.h" +#include "ppapi/shared_impl/private/ppb_x509_certificate_private_shared.h" +#include "ppapi/shared_impl/resource.h" + +namespace ppapi { +class PPB_X509Certificate_Fields; +} + +namespace webkit { +namespace ppapi { + +class PPB_X509Certificate_Private_Impl : + public ::ppapi::PPB_X509Certificate_Private_Shared { + public: + PPB_X509Certificate_Private_Impl(PP_Instance instance); + static PP_Resource CreateResource(PP_Instance instance); + virtual bool ParseDER(const std::vector<char>& der, + ::ppapi::PPB_X509Certificate_Fields* result) OVERRIDE; + + private: + virtual ~PPB_X509Certificate_Private_Impl(); + + DISALLOW_COPY_AND_ASSIGN(PPB_X509Certificate_Private_Impl); +}; + +} // namespace ppapi +} // namespace webkit + +#endif // WEBKIT_PLUGINS_PPAPI_PPB_X509_CERTIFICATE_PRIVATE_IMPL_H_ diff --git a/webkit/plugins/ppapi/resource_creation_impl.cc b/webkit/plugins/ppapi/resource_creation_impl.cc index d701b9d..d946d9f 100644 --- a/webkit/plugins/ppapi/resource_creation_impl.cc +++ b/webkit/plugins/ppapi/resource_creation_impl.cc @@ -38,6 +38,7 @@ #include "webkit/plugins/ppapi/ppb_video_decoder_impl.h" #include "webkit/plugins/ppapi/ppb_video_layer_impl.h" #include "webkit/plugins/ppapi/ppb_websocket_impl.h" +#include "webkit/plugins/ppapi/ppb_x509_certificate_private_impl.h" #include "webkit/plugins/ppapi/resource_helper.h" using ppapi::InputEventData; @@ -346,5 +347,10 @@ PP_Resource ResourceCreationImpl::CreateWheelInputEvent( instance, data))->GetReference(); } +PP_Resource ResourceCreationImpl::CreateX509CertificatePrivate( + PP_Instance instance) { + return PPB_X509Certificate_Private_Impl::CreateResource(instance); +} + } // namespace ppapi } // namespace webkit diff --git a/webkit/plugins/ppapi/resource_creation_impl.h b/webkit/plugins/ppapi/resource_creation_impl.h index 439bd5c..10b562a 100644 --- a/webkit/plugins/ppapi/resource_creation_impl.h +++ b/webkit/plugins/ppapi/resource_creation_impl.h @@ -125,6 +125,8 @@ class ResourceCreationImpl : public ::ppapi::FunctionGroupBase, const PP_FloatPoint* wheel_delta, const PP_FloatPoint* wheel_ticks, PP_Bool scroll_by_page) OVERRIDE; + virtual PP_Resource CreateX509CertificatePrivate( + PP_Instance instance) OVERRIDE; private: DISALLOW_COPY_AND_ASSIGN(ResourceCreationImpl); |