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 #include "ppapi/cpp/private/output_protection_private.h"
8 #include "ppapi/c/pp_errors.h"
9 #include "ppapi/c/private/ppb_output_protection_private.h"
10 #include "ppapi/cpp/instance.h"
11 #include "ppapi/cpp/instance_handle.h"
12 #include "ppapi/cpp/module_impl.h"
18 template <> const char* interface_name
<PPB_OutputProtection_Private_0_1
>() {
19 return PPB_OUTPUTPROTECTION_PRIVATE_INTERFACE_0_1
;
24 OutputProtection_Private::OutputProtection_Private(
25 const InstanceHandle
& instance
) {
26 if (has_interface
<PPB_OutputProtection_Private_0_1
>()) {
27 PassRefFromConstructor(
28 get_interface
<PPB_OutputProtection_Private_0_1
>()->Create(
29 instance
.pp_instance()));
33 OutputProtection_Private::~OutputProtection_Private() {
36 int32_t OutputProtection_Private::QueryStatus(
38 uint32_t* protection_mask
,
39 const CompletionCallback
& callback
) {
40 if (has_interface
<PPB_OutputProtection_Private_0_1
>()) {
41 return get_interface
<PPB_OutputProtection_Private_0_1
>()->QueryStatus(
42 pp_resource(), link_mask
, protection_mask
,
43 callback
.pp_completion_callback());
45 return callback
.MayForce(PP_ERROR_NOINTERFACE
);
48 int32_t OutputProtection_Private::EnableProtection(
49 uint32_t desired_method_mask
,
50 const CompletionCallback
& callback
) {
51 if (has_interface
<PPB_OutputProtection_Private_0_1
>()) {
52 return get_interface
<PPB_OutputProtection_Private_0_1
>()->EnableProtection(
53 pp_resource(), desired_method_mask
,
54 callback
.pp_completion_callback());
56 return callback
.MayForce(PP_ERROR_NOINTERFACE
);