[M108 Aura Migration] Add media playback ewk api
[platform/framework/web/chromium-efl.git] / tizen_src / ewk / efl_integration / public / ewk_user_media_internal.h
1 /*
2  * Copyright (C) 2013-2016 Samsung Electronics. All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions
6  * are met:
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.
12  *
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.
24  */
25
26 #ifndef ewk_user_media_internal_h
27 #define ewk_user_media_internal_h
28
29 #include <Eina.h>
30 #include <tizen.h>
31 #include "ewk_security_origin_internal.h"
32
33 #ifdef __cplusplus
34 extern "C" {
35 #endif
36
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;
39
40 /**
41  * enum   _Ewk_User_Media_Device_Type
42  * @brief   Contains device type option for media permission request
43  *
44  */
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. */
50 };
51
52 /**
53  * @brief The enum type that creates a type name for _Ewk_User_Media_Device_Type.
54  */
55 typedef enum _Ewk_User_Media_Device_Type Ewk_User_Media_Device_Type;
56
57 /**
58  * struct   _Ewk_User_Media_State_Info
59  * @brief   Get user media device usability status.
60  *
61  */
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;
66 };
67 typedef struct _Ewk_User_Media_State_Info Ewk_User_Media_State_Info;
68
69 /**
70  * Requests for getting origin of local media permission request.
71  *
72  * @param request Ewk_User_Media_Permission_Request object to get origin for
73  *        userMedia permission request
74  *
75  * @return security origin of userMedia permission request
76  */
77 EXPORT_API const Ewk_Security_Origin* ewk_user_media_permission_request_origin_get(const Ewk_User_Media_Permission_Request* request);
78
79 /**
80  * Sets the permission to access local media
81  *
82  * @param request Ewk_View_User_Media_Permission_Request object for userMedia
83  *        permission
84  * @param allowed decided permission value from user
85  */
86 EXPORT_API void ewk_user_media_permission_request_set(Ewk_User_Media_Permission_Request* request, Eina_Bool allowed);
87
88 /**
89  * Suspend the operation for user media permission
90  *
91  * @param request user media permission request object
92  *
93  * @return @c EINA_TRUE on success or @c EINA_FALSE on failure
94  */
95 EXPORT_API Eina_Bool ewk_user_media_permission_request_suspend(Ewk_User_Media_Permission_Request* request);
96
97 /**
98  * Reply the result about user media permission.
99  *
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
103  */
104 EXPORT_API void ewk_user_media_permission_reply(Ewk_User_Media_Permission_Request* request, Eina_Bool allow);
105
106 /**
107  * Requests for getting message of local media permission request.
108  *
109  * @param request Ewk_User_Media_Permission_Request object to get message for
110  *        userMedia permission request
111  *
112  * @return message of userMedia permission request
113  */
114 EXPORT_API const char* ewk_user_media_permission_request_message_get(const Ewk_User_Media_Permission_Request* request);
115
116 /**
117  * Get the type of device type for media permission request message.
118  *
119  * @param request Ewk_User_Media_Permission_Request object to get message for
120  *        userMedia permission request
121  *
122  * @return The type of device type, MicroPhone, Camera, or both of them.
123  */
124 EXPORT_API Ewk_User_Media_Device_Type ewk_user_media_permission_request_device_type_get(const Ewk_User_Media_Permission_Request* request);
125
126 /**
127  * Requests for getting origin of local media permission query.
128  *
129  * @param request Ewk_User_Media_Permission_Query object to get origin for
130  *        userMedia permission query
131  *
132  * @return security origin of userMedia permission query
133  */
134 EXPORT_API const Ewk_Security_Origin*
135 ewk_user_media_permission_query_origin_get(
136     const Ewk_User_Media_Permission_Query* request);
137
138 /**
139  * Get the type of device type for media permission query message.
140  *
141  * @param request Ewk_User_Media_Permission_Request object to get message for
142  *        userMedia permission query
143  *
144  * @return The type of device type, MicroPhone or Camera.
145  */
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);
149
150 #ifdef __cplusplus
151 }
152 #endif
153 #endif // ewk_user_media_internal_h