d6c0ce619ca452974fef9e52bea9430cc8580670
[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  * Requests for getting origin of local media permission request.
59  *
60  * @param request Ewk_User_Media_Permission_Request object to get origin for
61  *        userMedia permission request
62  *
63  * @return security origin of userMedia permission request
64  */
65 EXPORT_API const Ewk_Security_Origin* ewk_user_media_permission_request_origin_get(const Ewk_User_Media_Permission_Request* request);
66
67 /**
68  * Sets the permission to access local media
69  *
70  * @param request Ewk_View_User_Media_Permission_Request object for userMedia
71  *        permission
72  * @param allowed decided permission value from user
73  */
74 EXPORT_API void ewk_user_media_permission_request_set(Ewk_User_Media_Permission_Request* request, Eina_Bool allowed);
75
76 /**
77  * Suspend the operation for user media permission
78  *
79  * @param request user media permission request object
80  *
81  * @return @c EINA_TRUE on success or @c EINA_FALSE on failure
82  */
83 EXPORT_API Eina_Bool ewk_user_media_permission_request_suspend(Ewk_User_Media_Permission_Request* request);
84
85 /**
86  * Reply the result about user media permission.
87  *
88  * @param request Ewk_User_Media_Permission_Request object to get
89  *        the information about user media permission request
90  * @param allow result about user media permission
91  */
92 EXPORT_API void ewk_user_media_permission_reply(Ewk_User_Media_Permission_Request* request, Eina_Bool allow);
93
94 /**
95  * Requests for getting message of local media permission request.
96  *
97  * @param request Ewk_User_Media_Permission_Request object to get message for
98  *        userMedia permission request
99  *
100  * @return message of userMedia permission request
101  */
102 EXPORT_API const char* ewk_user_media_permission_request_message_get(const Ewk_User_Media_Permission_Request* request);
103
104 /**
105  * Get the type of device type for media permission request message.
106  *
107  * @param request Ewk_User_Media_Permission_Request object to get message for
108  *        userMedia permission request
109  *
110  * @return The type of device type, MicroPhone, Camera, or both of them.
111  */
112 EXPORT_API Ewk_User_Media_Device_Type ewk_user_media_permission_request_device_type_get(const Ewk_User_Media_Permission_Request* request);
113
114 /**
115  * Requests for getting origin of local media permission query.
116  *
117  * @param request Ewk_User_Media_Permission_Query object to get origin for
118  *        userMedia permission query
119  *
120  * @return security origin of userMedia permission query
121  */
122 EXPORT_API const Ewk_Security_Origin*
123 ewk_user_media_permission_query_origin_get(
124     const Ewk_User_Media_Permission_Query* request);
125
126 /**
127  * Get the type of device type for media permission query message.
128  *
129  * @param request Ewk_User_Media_Permission_Request object to get message for
130  *        userMedia permission query
131  *
132  * @return The type of device type, MicroPhone or Camera.
133  */
134 EXPORT_API Ewk_User_Media_Device_Type
135 ewk_user_media_permission_query_device_type_get(
136     const Ewk_User_Media_Permission_Query* request);
137
138 #ifdef __cplusplus
139 }
140 #endif
141 #endif // ewk_user_media_internal_h