1 /* Copyright 2014 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 /* From private/ppb_display_color_profile_private.idl, 7 * modified Mon Dec 16 20:53:23 2013. 8 */ 9 10 #ifndef PPAPI_C_PRIVATE_PPB_DISPLAY_COLOR_PROFILE_PRIVATE_H_ 11 #define PPAPI_C_PRIVATE_PPB_DISPLAY_COLOR_PROFILE_PRIVATE_H_ 12 13 #include "ppapi/c/pp_array_output.h" 14 #include "ppapi/c/pp_bool.h" 15 #include "ppapi/c/pp_completion_callback.h" 16 #include "ppapi/c/pp_instance.h" 17 #include "ppapi/c/pp_macros.h" 18 #include "ppapi/c/pp_resource.h" 19 #include "ppapi/c/pp_stdint.h" 20 21 #define PPB_DISPLAYCOLORPROFILE_PRIVATE_INTERFACE_0_1 \ 22 "PPB_DisplayColorProfile_Private;0.1" 23 #define PPB_DISPLAYCOLORPROFILE_PRIVATE_INTERFACE \ 24 PPB_DISPLAYCOLORPROFILE_PRIVATE_INTERFACE_0_1 25 26 /** 27 * @file 28 * This file defines the <code>PPB_DisplayColorProfile</code> struct used for 29 * getting the color profile of the display. 30 */ 31 32 33 /** 34 * @addtogroup Interfaces 35 * @{ 36 */ 37 /** 38 * <code>PPB_DisplayColorProfile_Private</code> defines the methods for getting 39 * the display color profile and monitoring its changes. 40 * 41 * <strong>Setup:<strong> 42 * @code 43 * PP_ArrayOutput output = { MyAllocatorFunction, color_profile_data }; 44 * PP_Resource display_cp = display_cp_interface->Create(instance); 45 * display_cp_interface->GetColorProfile(display_cp, 46 * output, 47 * completion_callback); 48 * @endcode 49 */ 50 struct PPB_DisplayColorProfile_Private_0_1 { 51 /** 52 * Create() creates a display color profile resource. 53 * 54 * @param[in] instance The module instance. 55 * @return A <code>PP_Resource</code> containing a display color profile 56 * resource. 57 */ 58 PP_Resource (*Create)(PP_Instance instance); 59 /** 60 * IsDisplayColorProfile() determines if the given resource is a valid 61 * <code>DisplayColorProfile</code> resource. 62 * 63 * @param[in] resource A <code>DisplayColorProfile</code> context resource. 64 * @return Returns: 65 * - <code>PP_TRUE</code> if the given resource is a valid 66 * <code>DisplayColorProfile</code> 67 * - <code>PP_FALSE</code> if it is an invalid resource or is a resource 68 * of another type. 69 */ 70 PP_Bool (*IsDisplayColorProfile)(PP_Resource resource); 71 /** 72 * GetColorProfile() enqueues a request for the current display color profile. 73 * 74 * This method is intended for getting the color profile data of the display 75 * on which the browser window resides. [However currently Chrome only 76 * considers the system's primary display color profile when doing its color 77 * management. For consistency this method will also return the color profile 78 * that Chrome uses for its browser window.] 79 * 80 * @param[in] display_color_profile_res The display color profile resource. 81 * @param[in] color_profile A <code>PP_OutputArray</code> which on success 82 * will receive a byte array containing the ICC color profile data (see 83 * www.color.org for a reference to the ICC color profile specification 84 * and versions). The returned color profile version is the one supported by 85 * the host system. 86 * @param[in] callback The completion callback to be called once the display 87 * color profile data is available. 88 * 89 * @return Returns an error code from <code>pp_errors.h</code>. 90 */ 91 int32_t (*GetColorProfile)(PP_Resource display_color_profile_res, 92 struct PP_ArrayOutput color_profile, 93 struct PP_CompletionCallback callback); 94 /** 95 * RegisterColorProfileChangeCallback() registers a callback to be called next 96 * time the color profile for the browser window in which the plugin resides 97 * changes. In order to get notifications for all color profile changes a call 98 * to RegisterColorProfileChangeCallback() function should be done when the 99 * previous notification was fired. 100 * 101 * There might be 2 scenarios in which the color profile for a window changes: 102 * a) The window is moved from one display to another; 103 * b) The user changes the display color space from the system settings. 104 * 105 * @param[in] display_color_profile_res The display color profile resource. 106 * @param[in] callback The callback to be invoked next time the display 107 * color profile changes. 108 * 109 * @return Returns an error code from <code>pp_errors.h</code>. 110 */ 111 int32_t (*RegisterColorProfileChangeCallback)( 112 PP_Resource display_color_profile_res, 113 struct PP_CompletionCallback callback); 114 }; 115 116 typedef struct PPB_DisplayColorProfile_Private_0_1 117 PPB_DisplayColorProfile_Private; 118 /** 119 * @} 120 */ 121 122 #endif /* PPAPI_C_PRIVATE_PPB_DISPLAY_COLOR_PROFILE_PRIVATE_H_ */ 123 124