Delete unused downloads page asset.
[chromium-blink-merge.git] / ppapi / c / private / ppb_output_protection_private.h
blobd489c009e3db97377090ed5b4ea4c56596b9502f
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 */
6 /* From private/ppb_output_protection_private.idl,
7 * modified Tue Oct 8 13:22:13 2013.
8 */
10 #ifndef PPAPI_C_PRIVATE_PPB_OUTPUT_PROTECTION_PRIVATE_H_
11 #define PPAPI_C_PRIVATE_PPB_OUTPUT_PROTECTION_PRIVATE_H_
13 #include "ppapi/c/pp_bool.h"
14 #include "ppapi/c/pp_completion_callback.h"
15 #include "ppapi/c/pp_instance.h"
16 #include "ppapi/c/pp_macros.h"
17 #include "ppapi/c/pp_resource.h"
18 #include "ppapi/c/pp_stdint.h"
20 #define PPB_OUTPUTPROTECTION_PRIVATE_INTERFACE_0_1 \
21 "PPB_OutputProtection_Private;0.1"
22 #define PPB_OUTPUTPROTECTION_PRIVATE_INTERFACE \
23 PPB_OUTPUTPROTECTION_PRIVATE_INTERFACE_0_1
25 /**
26 * @file
27 * This file defines the API for output protection. Currently, it only supports
28 * Chrome OS.
32 /**
33 * @addtogroup Enums
34 * @{
36 /**
37 * Content protection methods applied on video output link.
39 typedef enum {
40 PP_OUTPUT_PROTECTION_METHOD_PRIVATE_NONE = 0,
41 PP_OUTPUT_PROTECTION_METHOD_PRIVATE_HDCP = 1 << 0
42 } PP_OutputProtectionMethod_Private;
43 PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_OutputProtectionMethod_Private, 4);
45 /**
46 * Video output link types.
48 typedef enum {
49 PP_OUTPUT_PROTECTION_LINK_TYPE_PRIVATE_NONE = 0,
50 PP_OUTPUT_PROTECTION_LINK_TYPE_PRIVATE_UNKNOWN = 1 << 0,
51 PP_OUTPUT_PROTECTION_LINK_TYPE_PRIVATE_INTERNAL = 1 << 1,
52 PP_OUTPUT_PROTECTION_LINK_TYPE_PRIVATE_VGA = 1 << 2,
53 PP_OUTPUT_PROTECTION_LINK_TYPE_PRIVATE_HDMI = 1 << 3,
54 PP_OUTPUT_PROTECTION_LINK_TYPE_PRIVATE_DVI = 1 << 4,
55 PP_OUTPUT_PROTECTION_LINK_TYPE_PRIVATE_DISPLAYPORT = 1 << 5,
56 PP_OUTPUT_PROTECTION_LINK_TYPE_PRIVATE_NETWORK = 1 << 6
57 } PP_OutputProtectionLinkType_Private;
58 PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_OutputProtectionLinkType_Private, 4);
59 /**
60 * @}
63 /**
64 * @addtogroup Interfaces
65 * @{
67 /**
68 * The <code>PPB_OutputProtection_Private</code> interface allows controlling
69 * output protection.
71 * <strong>Example:</strong>
73 * @code
74 * op = output_protection->Create(instance);
75 * output_protection->QueryStatus(op, &link_mask, &protection_mask,
76 * done_callback);
77 * @endcode
79 * In this example, the plugin wants to enforce HDCP for HDMI link.
80 * @code
81 * if (link_mask & PP_OUTPUT_PROTECTION_LINK_TYPE_PRIVATE_HDMI) {
82 * output_protection->EnableProtection(
83 * op, PP_OUTPUT_PROTECTION_METHOD_PRIVATE_HDCP, done_callback);
84 * }
85 * @endcode
87 * After EnableProtection() completes, the plugin has to query protection
88 * status periodically to make sure the protection is enabled and remains
89 * enabled.
91 struct PPB_OutputProtection_Private_0_1 {
92 /**
93 * Create() creates a new <code>PPB_OutputProtection_Private</code> object.
95 * @pram[in] instance A <code>PP_Instance</code> identifying one instance of
96 * a module.
98 * @return A <code>PP_Resource</code> corresponding to a
99 * <code>PPB_OutputProtection_Private</code> if successful, 0 if creation
100 * failed.
102 PP_Resource (*Create)(PP_Instance instance);
104 * IsOutputProtection() determines if the provided resource is a
105 * <code>PPB_OutputProtection_Private</code>.
107 * @param[in] resource A <code>PP_Resource</code> corresponding to a
108 * <code>PPB_OutputProtection_Private</code>.
110 * @return <code>PP_TRUE</code> if the resource is a
111 * <code>PPB_OutputProtection_Private</code>, <code>PP_FALSE</code> if the
112 * resource is invalid or some type other than
113 * <code>PPB_OutputProtection_Private</code>.
115 PP_Bool (*IsOutputProtection)(PP_Resource resource);
117 * Query link status and protection status.
118 * Clients have to query status periodically in order to detect changes.
120 * @param[in] resource A <code>PP_Resource</code> corresponding to a
121 * <code>PPB_OutputProtection_Private</code>.
122 * @param[out] link_mask The type of connected output links, which is a
123 * bit-mask of the <code>PP_OutputProtectionLinkType_Private</code> values.
124 * @param[out] protection_mask Enabled protection methods, which is a
125 * bit-mask of the <code>PP_OutputProtectionMethod_Private</code> values.
126 * @param[in] callback A <code>PP_CompletionCallback</code> to run on
127 * asynchronous completion of QueryStatus(). This callback will only run if
128 * QueryStatus() returns <code>PP_OK_COMPLETIONPENDING</code>.
130 * @return An int32_t containing an error code from <code>pp_errors.h</code>.
132 int32_t (*QueryStatus)(PP_Resource resource,
133 uint32_t* link_mask,
134 uint32_t* protection_mask,
135 struct PP_CompletionCallback callback);
137 * Set desired protection methods.
139 * When the desired protection method(s) have been applied to all applicable
140 * output links, the relevant bit(s) of the protection_mask returned by
141 * QueryStatus() will be set. Otherwise, the relevant bit(s) of
142 * protection_mask will not be set; there is no separate error code or
143 * callback.
145 * Protections will be disabled if no longer desired by all instances.
147 * @param[in] resource A <code>PP_Resource</code> corresponding to a
148 * <code>PPB_OutputProtection_Private</code>.
149 * @param[in] desired_protection_mask The desired protection methods, which
150 * is a bit-mask of the <code>PP_OutputProtectionMethod_Private</code>
151 * values.
152 * @param[in] callback A <code>PP_CompletionCallback</code> to be called with
153 * <code>PP_OK</code> when the protection request has been made. This may be
154 * before the protection have actually been applied. Call QueryStatus to get
155 * protection status. If it failed to make the protection request, the
156 * callback is called with <code>PP_ERROR_FAILED</code> and there is no need
157 * to call QueryStatus().
159 * @return An int32_t containing an error code from <code>pp_errors.h</code>.
161 int32_t (*EnableProtection)(PP_Resource resource,
162 uint32_t desired_protection_mask,
163 struct PP_CompletionCallback callback);
166 typedef struct PPB_OutputProtection_Private_0_1 PPB_OutputProtection_Private;
168 * @}
171 #endif /* PPAPI_C_PRIVATE_PPB_OUTPUT_PROTECTION_PRIVATE_H_ */