Allow script to request durable storage permission (chrome side)
[chromium-blink-merge.git] / ppapi / thunk / ppb_platform_verification_private_thunk.cc
blob817df16f7b1722aec3e26afc191131c145104a90
1 // Copyright 2013 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 // From private/ppb_platform_verification_private.idl modified Fri Nov 1
6 // 16:12:12 2013.
8 #include "ppapi/c/pp_completion_callback.h"
9 #include "ppapi/c/pp_errors.h"
10 #include "ppapi/c/private/ppb_platform_verification_private.h"
11 #include "ppapi/shared_impl/tracked_callback.h"
12 #include "ppapi/thunk/enter.h"
13 #include "ppapi/thunk/ppapi_thunk_export.h"
14 #include "ppapi/thunk/ppb_platform_verification_api.h"
16 namespace ppapi {
17 namespace thunk {
19 namespace {
21 PP_Resource Create(PP_Instance instance) {
22 VLOG(4) << "PPB_PlatformVerification_Private::Create()";
23 EnterResourceCreation enter(instance);
24 if (enter.failed())
25 return 0;
26 return enter.functions()->CreatePlatformVerificationPrivate(instance);
29 PP_Bool IsPlatformVerification(PP_Resource resource) {
30 VLOG(4) << "PPB_PlatformVerification_Private::IsPlatformVerification()";
31 EnterResource<PPB_PlatformVerification_API> enter(resource, false);
32 return PP_FromBool(enter.succeeded());
35 int32_t ChallengePlatform(PP_Resource instance,
36 struct PP_Var service_id,
37 struct PP_Var challenge,
38 struct PP_Var* signed_data,
39 struct PP_Var* signed_data_signature,
40 struct PP_Var* platform_key_certificate,
41 struct PP_CompletionCallback callback) {
42 VLOG(4) << "PPB_PlatformVerification_Private::ChallengePlatform()";
43 EnterResource<PPB_PlatformVerification_API> enter(instance, callback, true);
44 if (enter.failed())
45 return enter.retval();
46 return enter.SetResult(enter.object()->ChallengePlatform(
47 service_id, challenge, signed_data, signed_data_signature,
48 platform_key_certificate, enter.callback()));
51 const PPB_PlatformVerification_Private_0_2
52 g_ppb_platformverification_private_thunk_0_2 = {&Create,
53 &IsPlatformVerification,
54 &ChallengePlatform};
56 } // namespace
58 PPAPI_THUNK_EXPORT const PPB_PlatformVerification_Private_0_2*
59 GetPPB_PlatformVerification_Private_0_2_Thunk() {
60 return &g_ppb_platformverification_private_thunk_0_2;
63 } // namespace thunk
64 } // namespace ppapi