- add sources.
[platform/framework/web/crosswalk.git] / src / ppapi / api / private / ppb_output_protection_private.idl
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
6 /**
7  * This file defines the API for output protection. Currently, it only supports
8  * Chrome OS.
9  */
10
11 [generate_thunk]
12
13 label Chrome {
14   M31 = 0.1
15 };
16
17 /**
18  * Content protection methods applied on video output link.
19  */
20 [assert_size(4)] enum PP_OutputProtectionMethod_Private {
21   PP_OUTPUT_PROTECTION_METHOD_PRIVATE_NONE = 0,
22   PP_OUTPUT_PROTECTION_METHOD_PRIVATE_HDCP = 1 << 0
23 };
24
25 /**
26  * Video output link types.
27  */
28 [assert_size(4)] enum PP_OutputProtectionLinkType_Private {
29   PP_OUTPUT_PROTECTION_LINK_TYPE_PRIVATE_NONE = 0,
30   PP_OUTPUT_PROTECTION_LINK_TYPE_PRIVATE_UNKNOWN = 1 << 0,
31   PP_OUTPUT_PROTECTION_LINK_TYPE_PRIVATE_INTERNAL = 1 << 1,
32   PP_OUTPUT_PROTECTION_LINK_TYPE_PRIVATE_VGA = 1 << 2,
33   PP_OUTPUT_PROTECTION_LINK_TYPE_PRIVATE_HDMI = 1 << 3,
34   PP_OUTPUT_PROTECTION_LINK_TYPE_PRIVATE_DVI = 1 << 4,
35   PP_OUTPUT_PROTECTION_LINK_TYPE_PRIVATE_DISPLAYPORT = 1 << 5,
36   PP_OUTPUT_PROTECTION_LINK_TYPE_PRIVATE_NETWORK = 1 << 6
37 };
38
39 /**
40  * The <code>PPB_OutputProtection_Private</code> interface allows controlling
41  * output protection.
42  *
43  * <strong>Example:</strong>
44  *
45  * @code
46  * op = output_protection->Create(instance);
47  * output_protection->QueryStatus(op, &link_mask, &protection_mask,
48  *                                done_callback);
49  * @endcode
50  *
51  * In this example, the plugin wants to enforce HDCP for HDMI link.
52  * @code
53  * if (link_mask & PP_OUTPUT_PROTECTION_LINK_TYPE_PRIVATE_HDMI) {
54  *   output_protection->EnableProtection(
55  *       op, PP_OUTPUT_PROTECTION_METHOD_PRIVATE_HDCP, done_callback);
56  * }
57  * @endcode
58  *
59  * After EnableProtection() completes, the plugin has to query protection
60  * status periodically to make sure the protection is enabled and remains
61  * enabled.
62  */
63 interface PPB_OutputProtection_Private {
64   /**
65    * Create() creates a new <code>PPB_OutputProtection_Private</code> object.
66    *
67    * @pram[in] instance A <code>PP_Instance</code> identifying one instance of
68    * a module.
69    *
70    * @return A <code>PP_Resource</code> corresponding to a
71    * <code>PPB_OutputProtection_Private</code> if successful, 0 if creation
72    * failed.
73    */
74   PP_Resource Create([in] PP_Instance instance);
75
76   /**
77    * IsOutputProtection() determines if the provided resource is a
78    * <code>PPB_OutputProtection_Private</code>.
79    *
80    * @param[in] resource A <code>PP_Resource</code> corresponding to a
81    * <code>PPB_OutputProtection_Private</code>.
82    *
83    * @return <code>PP_TRUE</code> if the resource is a
84    * <code>PPB_OutputProtection_Private</code>, <code>PP_FALSE</code> if the
85    * resource is invalid or some type other than
86    * <code>PPB_OutputProtection_Private</code>.
87    */
88   PP_Bool IsOutputProtection([in] PP_Resource resource);
89
90   /**
91    * Query link status and protection status.
92    * Clients have to query status periodically in order to detect changes.
93    *
94    * @param[in] resource A <code>PP_Resource</code> corresponding to a
95    * <code>PPB_OutputProtection_Private</code>.
96    * @param[out] link_mask The type of connected output links, which is a
97    * bit-mask of the <code>PP_OutputProtectionLinkType_Private</code> values.
98    * @param[out] protection_mask Enabled protection methods, which is a
99    * bit-mask of the <code>PP_OutputProtectionMethod_Private</code> values.
100    * @param[in] callback A <code>PP_CompletionCallback</code> to run on
101    * asynchronous completion of QueryStatus(). This callback will only run if
102    * QueryStatus() returns <code>PP_OK_COMPLETIONPENDING</code>.
103    *
104    * @return An int32_t containing an error code from <code>pp_errors.h</code>.
105    */
106   int32_t QueryStatus(
107       [in] PP_Resource resource,
108       [out] uint32_t link_mask,
109       [out] uint32_t protection_mask,
110       [in] PP_CompletionCallback callback);
111
112   /**
113    * Set desired protection methods.
114    *
115    * When the desired protection method(s) have been applied to all applicable
116    * output links, the relevant bit(s) of the protection_mask returned by
117    * QueryStatus() will be set. Otherwise, the relevant bit(s) of
118    * protection_mask will not be set; there is no separate error code or
119    * callback.
120    *
121    * Protections will be disabled if no longer desired by all instances.
122    *
123    * @param[in] resource A <code>PP_Resource</code> corresponding to a
124    * <code>PPB_OutputProtection_Private</code>.
125    * @param[in] desired_protection_mask The desired protection methods, which
126    * is a bit-mask of the <code>PP_OutputProtectionMethod_Private</code>
127    * values.
128    * @param[in] callback A <code>PP_CompletionCallback</code> to be called with
129    * <code>PP_OK</code> when the protection request has been made. This may be
130    * before the protection have actually been applied. Call QueryStatus to get
131    * protection status. If it failed to make the protection request, the
132    * callback is called with <code>PP_ERROR_FAILED</code> and there is no need
133    * to call QueryStatus().
134    *
135    * @return An int32_t containing an error code from <code>pp_errors.h</code>.
136    */
137   int32_t EnableProtection(
138       [in] PP_Resource resource,
139       [in] uint32_t desired_protection_mask,
140       [in] PP_CompletionCallback callback);
141 };