Create an initial chrome://supervised-user-internals page
[chromium-blink-merge.git] / ppapi / thunk / ppb_output_protection_private_thunk.cc
blob8b5ab5bdd9b0ef9d07afed3317037f2fc045bce5
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_output_protection_private.idl modified Fri Nov 1 16:12:12
6 // 2013.
8 #include "ppapi/c/pp_completion_callback.h"
9 #include "ppapi/c/pp_errors.h"
10 #include "ppapi/c/private/ppb_output_protection_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_output_protection_api.h"
16 namespace ppapi {
17 namespace thunk {
19 namespace {
21 PP_Resource Create(PP_Instance instance) {
22 VLOG(4) << "PPB_OutputProtection_Private::Create()";
23 EnterResourceCreation enter(instance);
24 if (enter.failed())
25 return 0;
26 return enter.functions()->CreateOutputProtectionPrivate(instance);
29 PP_Bool IsOutputProtection(PP_Resource resource) {
30 VLOG(4) << "PPB_OutputProtection_Private::IsOutputProtection()";
31 EnterResource<PPB_OutputProtection_API> enter(resource, false);
32 return PP_FromBool(enter.succeeded());
35 int32_t QueryStatus(PP_Resource resource,
36 uint32_t* link_mask,
37 uint32_t* protection_mask,
38 struct PP_CompletionCallback callback) {
39 VLOG(4) << "PPB_OutputProtection_Private::QueryStatus()";
40 EnterResource<PPB_OutputProtection_API> enter(resource, callback, true);
41 if (enter.failed())
42 return enter.retval();
43 return enter.SetResult(enter.object()->QueryStatus(link_mask, protection_mask,
44 enter.callback()));
47 int32_t EnableProtection(PP_Resource resource,
48 uint32_t desired_protection_mask,
49 struct PP_CompletionCallback callback) {
50 VLOG(4) << "PPB_OutputProtection_Private::EnableProtection()";
51 EnterResource<PPB_OutputProtection_API> enter(resource, callback, true);
52 if (enter.failed())
53 return enter.retval();
54 return enter.SetResult(enter.object()->EnableProtection(
55 desired_protection_mask, enter.callback()));
58 const PPB_OutputProtection_Private_0_1
59 g_ppb_outputprotection_private_thunk_0_1 = {&Create,
60 &IsOutputProtection,
61 &QueryStatus,
62 &EnableProtection};
64 } // namespace
66 PPAPI_THUNK_EXPORT const PPB_OutputProtection_Private_0_1*
67 GetPPB_OutputProtection_Private_0_1_Thunk() {
68 return &g_ppb_outputprotection_private_thunk_0_1;
71 } // namespace thunk
72 } // namespace ppapi