Send activityLogPrivate to stable
[chromium-blink-merge.git] / ppapi / c / private / ppb_output_protection_private.h
blobd0438be8f32c3f022371f97bc708496971e12ea1
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 Sat Aug 31 03:18:39 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_OutputProtectionLinkType_Private;
57 PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_OutputProtectionLinkType_Private, 4);
58 /**
59 * @}
62 /**
63 * @addtogroup Interfaces
64 * @{
66 /**
67 * The <code>PPB_OutputProtection_Private</code> interface allows controlling
68 * output protection.
70 * <strong>Example:</strong>
72 * @code
73 * op = output_protection->Create(instance);
74 * output_protection->QueryStatus(op, &link_mask, &protection_mask,
75 * done_callback);
76 * @endcode
78 * In this example, the plugin wants to enforce HDCP for HDMI link.
79 * @code
80 * if (link_mask & PP_OUTPUT_PROTECTION_LINK_TYPE_PRIVATE_HDMI) {
81 * output_protection->EnableProtection(
82 * op, PP_OUTPUT_PROTECTION_METHOD_PRIVATE_HDCP, done_callback);
83 * }
84 * @endcode
86 * After EnableProtection() completes, the plugin has to query protection
87 * status periodically to make sure the protection is enabled and remains
88 * enabled.
90 struct PPB_OutputProtection_Private_0_1 {
91 /**
92 * Create() creates a new <code>PPB_OutputProtection_Private</code> object.
94 * @pram[in] instance A <code>PP_Instance</code> identifying one instance of
95 * a module.
97 * @return A <code>PP_Resource</code> corresponding to a
98 * <code>PPB_OutputProtection_Private</code> if successful, 0 if creation
99 * failed.
101 PP_Resource (*Create)(PP_Instance instance);
103 * IsOutputProtection() determines if the provided resource is a
104 * <code>PPB_OutputProtection_Private</code>.
106 * @param[in] resource A <code>PP_Resource</code> corresponding to a
107 * <code>PPB_OutputProtection_Private</code>.
109 * @return <code>PP_TRUE</code> if the resource is a
110 * <code>PPB_OutputProtection_Private</code>, <code>PP_FALSE</code> if the
111 * resource is invalid or some type other than
112 * <code>PPB_OutputProtection_Private</code>.
114 PP_Bool (*IsOutputProtection)(PP_Resource resource);
116 * Query link status and protection status.
117 * Clients have to query status periodically in order to detect changes.
119 * @param[in] resource A <code>PP_Resource</code> corresponding to a
120 * <code>PPB_OutputProtection_Private</code>.
121 * @param[out] link_mask The type of connected output links, which is a
122 * bit-mask of the <code>PP_OutputProtectionLinkType_Private</code> values.
123 * @param[out] protection_mask Enabled protection methods, which is a
124 * bit-mask of the <code>PP_OutputProtectionMethod_Private</code> values.
125 * @param[in] callback A <code>PP_CompletionCallback</code> to run on
126 * asynchronous completion of QueryStatus(). This callback will only run if
127 * QueryStatus() returns <code>PP_OK_COMPLETIONPENDING</code>.
129 * @return An int32_t containing an error code from <code>pp_errors.h</code>.
131 int32_t (*QueryStatus)(PP_Resource resource,
132 uint32_t* link_mask,
133 uint32_t* protection_mask,
134 struct PP_CompletionCallback callback);
136 * Set desired protection methods.
138 * When the desired protection method(s) have been applied to all applicable
139 * output links, the relevant bit(s) of the protection_mask returned by
140 * QueryStatus() will be set. Otherwise, the relevant bit(s) of
141 * protection_mask will not be set; there is no separate error code or
142 * callback.
144 * Protections will be disabled if no longer desired by all instances.
146 * @param[in] resource A <code>PP_Resource</code> corresponding to a
147 * <code>PPB_OutputProtection_Private</code>.
148 * @param[in] desired_protection_mask The desired protection methods, which
149 * is a bit-mask of the <code>PP_OutputProtectionMethod_Private</code>
150 * values.
151 * @param[in] callback A <code>PP_CompletionCallback</code> to be called when
152 * the protection request has been made. This may be before the protection
153 * have actually been applied. Call QueryStatus to get protection status.
155 * @return An int32_t containing an error code from <code>pp_errors.h</code>.
157 int32_t (*EnableProtection)(PP_Resource resource,
158 uint32_t desired_protection_mask,
159 struct PP_CompletionCallback callback);
162 typedef struct PPB_OutputProtection_Private_0_1 PPB_OutputProtection_Private;
164 * @}
167 #endif /* PPAPI_C_PRIVATE_PPB_OUTPUT_PROTECTION_PRIVATE_H_ */