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. 4 5 #include "ppapi/cpp/private/output_protection_private.h" 6 7 #include <stdio.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" 13 14 namespace pp { 15 16 namespace { 17 18 template <> const char* interface_name<PPB_OutputProtection_Private_0_1>() { 19 return PPB_OUTPUTPROTECTION_PRIVATE_INTERFACE_0_1; 20 } 21 22 } // namespace 23 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())); 30 } 31 } 32 33 OutputProtection_Private::~OutputProtection_Private() { 34 } 35 36 int32_t OutputProtection_Private::QueryStatus( 37 uint32_t* link_mask, 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()); 44 } 45 return callback.MayForce(PP_ERROR_NOINTERFACE); 46 } 47 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()); 55 } 56 return callback.MayForce(PP_ERROR_NOINTERFACE); 57 } 58 59 } // namespace pp 60