Pin Chrome's shortcut to the Win10 Start menu on install and OS upgrade.
[chromium-blink-merge.git] / ppapi / shared_impl / ppb_crypto_shared.cc
blobf172ea7d5b5a1a932b5418b7d12bbdfd4da3a122
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "base/rand_util.h"
6 #include "ppapi/c/dev/ppb_crypto_dev.h"
7 #include "ppapi/thunk/thunk.h"
9 // The crypto interface doesn't have a normal C -> C++ thunk since it doesn't
10 // actually have any proxy wrapping or associated objects; it's just a call
11 // into base. So we implement the entire interface here, using the thunk
12 // namespace so it magically gets hooked up in the proper places.
14 namespace ppapi {
16 namespace {
18 void GetRandomBytes(char* buffer, uint32_t num_bytes) {
19 base::RandBytes(buffer, num_bytes);
22 const PPB_Crypto_Dev crypto_interface = {&GetRandomBytes};
24 } // namespace
26 namespace thunk {
28 PPAPI_THUNK_EXPORT const PPB_Crypto_Dev_0_1* GetPPB_Crypto_Dev_0_1_Thunk() {
29 return &crypto_interface;
32 } // namespace thunk
34 } // namespace ppapi