From 83c0f7cc5aa3bba61e0b5cdc88635825fdef24c9 Mon Sep 17 00:00:00 2001 From: "brettw@chromium.org" Date: Fri, 22 Apr 2011 15:55:55 +0000 Subject: Merge 82291 - Add an initial crypto interface to fill a given buffer with random data. Thishas the same implementation as the WebKit one on ChromeOS.TEST=noneBUG=noneReview URL: http://codereview.chromium.org/6880053 TBR=brettw@chromium.org BUG=80168 Review URL: http://codereview.chromium.org/6894024 git-svn-id: svn://svn.chromium.org/chrome/branches/742/src@82654 0039d316-1c4b-4281-b951-d872f2087c98 --- webkit/plugins/ppapi/plugin_module.cc | 4 ++++ webkit/plugins/ppapi/ppb_crypto_impl.cc | 28 ++++++++++++++++++++++++++++ webkit/plugins/ppapi/ppb_crypto_impl.h | 21 +++++++++++++++++++++ 3 files changed, 53 insertions(+) create mode 100644 webkit/plugins/ppapi/ppb_crypto_impl.cc create mode 100644 webkit/plugins/ppapi/ppb_crypto_impl.h (limited to 'webkit/plugins') diff --git a/webkit/plugins/ppapi/plugin_module.cc b/webkit/plugins/ppapi/plugin_module.cc index 7fc683e..a7a7dd2 100644 --- a/webkit/plugins/ppapi/plugin_module.cc +++ b/webkit/plugins/ppapi/plugin_module.cc @@ -17,6 +17,7 @@ #include "ppapi/c/dev/ppb_context_3d_dev.h" #include "ppapi/c/dev/ppb_context_3d_trusted_dev.h" #include "ppapi/c/dev/ppb_console_dev.h" +#include "ppapi/c/dev/ppb_crypto_dev.h" #include "ppapi/c/dev/ppb_cursor_control_dev.h" #include "ppapi/c/dev/ppb_directory_reader_dev.h" #include "ppapi/c/dev/ppb_file_io_dev.h" @@ -70,6 +71,7 @@ #include "webkit/plugins/ppapi/ppb_buffer_impl.h" #include "webkit/plugins/ppapi/ppb_char_set_impl.h" #include "webkit/plugins/ppapi/ppb_console_impl.h" +#include "webkit/plugins/ppapi/ppb_crypto_impl.h" #include "webkit/plugins/ppapi/ppb_cursor_control_impl.h" #include "webkit/plugins/ppapi/ppb_directory_reader_impl.h" #include "webkit/plugins/ppapi/ppb_file_chooser_impl.h" @@ -241,6 +243,8 @@ const void* GetInterface(const char* name) { return PPB_Console_Impl::GetInterface(); if (strcmp(name, PPB_CORE_INTERFACE) == 0) return &core_interface; + if (strcmp(name, PPB_CRYPTO_DEV_INTERFACE) == 0) + return PPB_Crypto_Impl::GetInterface(); if (strcmp(name, PPB_CURSOR_CONTROL_DEV_INTERFACE) == 0) return GetCursorControlInterface(); if (strcmp(name, PPB_DIRECTORYREADER_DEV_INTERFACE) == 0) diff --git a/webkit/plugins/ppapi/ppb_crypto_impl.cc b/webkit/plugins/ppapi/ppb_crypto_impl.cc new file mode 100644 index 0000000..8f3a73b --- /dev/null +++ b/webkit/plugins/ppapi/ppb_crypto_impl.cc @@ -0,0 +1,28 @@ +// Copyright (c) 2011 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_crypto_impl.h" + +#include "ppapi/c/dev/ppb_crypto_dev.h" +#include "ppapi/shared_impl/crypto_impl.h" + +namespace webkit { +namespace ppapi { + +namespace { + +const PPB_Crypto_Dev ppb_crypto = { + &pp::shared_impl::CryptoImpl::GetRandomBytes +}; + +} // namespace + +// static +const PPB_Crypto_Dev* PPB_Crypto_Impl::GetInterface() { + return &ppb_crypto; +} + +} // namespace ppapi +} // namespace webkit + diff --git a/webkit/plugins/ppapi/ppb_crypto_impl.h b/webkit/plugins/ppapi/ppb_crypto_impl.h new file mode 100644 index 0000000..3b3bb48 --- /dev/null +++ b/webkit/plugins/ppapi/ppb_crypto_impl.h @@ -0,0 +1,21 @@ +// Copyright (c) 2011 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_CRYPTO_IMPL_H_ +#define WEBKIT_PLUGINS_PPAPI_PPB_CRYPTO_IMPL_H_ + +struct PPB_Crypto_Dev; + +namespace webkit { +namespace ppapi { + +class PPB_Crypto_Impl { + public: + static const PPB_Crypto_Dev* GetInterface(); +}; + +} // namespace ppapi +} // namespace webkit + +#endif // WEBKIT_PLUGINS_PPAPI_PPB_CRYPTO_IMPL_H_ -- cgit v1.1