2 * Copyright (C) 2013-2016 Samsung Electronics. All rights reserved.
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
13 * THIS SOFTWARE IS PROVIDED BY SAMSUNG ELECTRONICS. AND ITS CONTRIBUTORS
14 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
15 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SAMSUNG ELECTRONICS. OR ITS
17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
20 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
21 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
22 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
23 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 #ifndef ewk_user_media_internal_h
27 #define ewk_user_media_internal_h
31 #include "ewk_security_origin_internal.h"
37 typedef struct _Ewk_User_Media_Permission_Request Ewk_User_Media_Permission_Request;
38 typedef struct _Ewk_User_Media_Permission_Query Ewk_User_Media_Permission_Query;
41 * enum _Ewk_User_Media_Device_Type
42 * @brief Contains device type option for media permission request
45 enum _Ewk_User_Media_Device_Type {
46 EWK_USER_MEDIA_DEVICE_TYPE_NONE = 0,
47 EWK_USER_MEDIA_DEVICE_TYPE_MICROPHONE = 1, /* MicroPhone type */
48 EWK_USER_MEDIA_DEVICE_TYPE_CAMERA = 2, /* Camera type */
49 EWK_USER_MEDIA_DEVICE_TYPE_MICROPHONE_AND_CAMERA = 3 /* Both MicroPhone and Camera. */
53 * @brief The enum type that creates a type name for _Ewk_User_Media_Device_Type.
55 typedef enum _Ewk_User_Media_Device_Type Ewk_User_Media_Device_Type;
58 * struct _Ewk_User_Media_State_Info
59 * @brief Get user media device usability status.
62 struct _Ewk_User_Media_State_Info {
63 Ewk_User_Media_Device_Type device_type;
64 uint32_t previous_state;
65 uint32_t current_state;
67 typedef struct _Ewk_User_Media_State_Info Ewk_User_Media_State_Info;
70 * Requests for getting origin of local media permission request.
72 * @param request Ewk_User_Media_Permission_Request object to get origin for
73 * userMedia permission request
75 * @return security origin of userMedia permission request
77 EXPORT_API const Ewk_Security_Origin* ewk_user_media_permission_request_origin_get(const Ewk_User_Media_Permission_Request* request);
80 * Sets the permission to access local media
82 * @param request Ewk_View_User_Media_Permission_Request object for userMedia
84 * @param allowed decided permission value from user
86 EXPORT_API void ewk_user_media_permission_request_set(Ewk_User_Media_Permission_Request* request, Eina_Bool allowed);
89 * Suspend the operation for user media permission
91 * @param request user media permission request object
93 * @return @c EINA_TRUE on success or @c EINA_FALSE on failure
95 EXPORT_API Eina_Bool ewk_user_media_permission_request_suspend(Ewk_User_Media_Permission_Request* request);
98 * Reply the result about user media permission.
100 * @param request Ewk_User_Media_Permission_Request object to get
101 * the information about user media permission request
102 * @param allow result about user media permission
104 EXPORT_API void ewk_user_media_permission_reply(Ewk_User_Media_Permission_Request* request, Eina_Bool allow);
107 * Requests for getting message of local media permission request.
109 * @param request Ewk_User_Media_Permission_Request object to get message for
110 * userMedia permission request
112 * @return message of userMedia permission request
114 EXPORT_API const char* ewk_user_media_permission_request_message_get(const Ewk_User_Media_Permission_Request* request);
117 * Get the type of device type for media permission request message.
119 * @param request Ewk_User_Media_Permission_Request object to get message for
120 * userMedia permission request
122 * @return The type of device type, MicroPhone, Camera, or both of them.
124 EXPORT_API Ewk_User_Media_Device_Type ewk_user_media_permission_request_device_type_get(const Ewk_User_Media_Permission_Request* request);
127 * Requests for getting origin of local media permission query.
129 * @param request Ewk_User_Media_Permission_Query object to get origin for
130 * userMedia permission query
132 * @return security origin of userMedia permission query
134 EXPORT_API const Ewk_Security_Origin*
135 ewk_user_media_permission_query_origin_get(
136 const Ewk_User_Media_Permission_Query* request);
139 * Get the type of device type for media permission query message.
141 * @param request Ewk_User_Media_Permission_Request object to get message for
142 * userMedia permission query
144 * @return The type of device type, MicroPhone or Camera.
146 EXPORT_API Ewk_User_Media_Device_Type
147 ewk_user_media_permission_query_device_type_get(
148 const Ewk_User_Media_Permission_Query* request);
153 #endif // ewk_user_media_internal_h