Create string tightly when retrive string from cbhm callback event
[framework/web/webkit-efl.git] / Source / WebKit2 / UIProcess / API / efl / ewk_navigation_policy_decision.h
1 /*
2  * Copyright (C) 2012 Intel Corporation. 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 APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
14  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
15  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
17  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
19  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
20  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
21  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
22  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
23  * THE POSSIBILITY OF SUCH DAMAGE.
24  */
25
26 /**
27  * @file    ewk_navigation_policy_decision.h
28  * @brief   Describes the Ewk navigation policy decision API.
29  */
30
31 #ifndef ewk_navigation_policy_decision_h
32 #define ewk_navigation_policy_decision_h
33
34 #include "ewk_url_request.h"
35 #include <Eina.h>
36
37 #ifdef __cplusplus
38 extern "C" {
39 #endif
40
41 /** Creates a type name for Ewk_Navigation_Policy_Decision */
42 typedef struct Ewk_Navigation_Policy_Decision Ewk_Navigation_Policy_Decision;
43
44 /// Enum containing navigation types
45 typedef enum  {
46     EWK_NAVIGATION_TYPE_LINK_ACTIVATED,
47     EWK_NAVIGATION_TYPE_FORM_SUBMITTED,
48     EWK_NAVIGATION_TYPE_BACK_FORWARD,
49     EWK_NAVIGATION_TYPE_RELOAD,
50     EWK_NAVIGATION_TYPE_FORM_RESUBMITTED,
51     EWK_NAVIGATION_TYPE_OTHER
52 } Ewk_Navigation_Type;
53
54 /// Enum containing button types
55 typedef enum {
56     EVENT_MOUSE_BUTTON_NONE = -1,
57     EVENT_MOUSE_BUTTON_LEFT = 0,
58     EVENT_MOUSE_BUTTON_MIDDLE = 1,
59     EVENT_MOUSE_BUTTON_RIGHT = 2
60 } Event_Mouse_Button;
61
62 typedef enum {
63     EVENT_MODIFIER_KEY_SHIFT = 1 << 0,
64     EVENT_MODIFIER_KEY_CTRL = 1 << 1,
65     EVENT_MODIFIER_KEY_ALT = 1 << 2,
66     EVENT_MODIFIER_KEY_META = 1 << 3
67 } Event_Modifier_Keys;
68
69 /**
70  * Increases the reference count of the given object.
71  *
72  * @param decision the policy decision object to increase the reference count
73  *
74  * @return a pointer to the object on success, @c NULL otherwise.
75  */
76 EAPI Ewk_Navigation_Policy_Decision *ewk_navigation_policy_decision_ref(Ewk_Navigation_Policy_Decision *decision);
77
78 /**
79  * Decreases the reference count of the given object, possibly freeing it.
80  *
81  * When the reference count reaches 0, the object is freed.
82  *
83  * @param decision the policy decision object to decrease the reference count
84  */
85 EAPI void ewk_navigation_policy_decision_unref(Ewk_Navigation_Policy_Decision *decision);
86
87 /**
88  * Query type for this navigation policy decision.
89  *
90  * @param decision navigation policy decision object to query.
91  *
92  * @return the type of navigation.
93  */
94 EAPI Ewk_Navigation_Type ewk_navigation_policy_navigation_type_get(const Ewk_Navigation_Policy_Decision *decision);
95
96 /**
97  * Query mouse button for this navigation policy decision.
98  *
99  * @param decision navigation policy decision object to query.
100  *
101  * @return the mouse button clicked to trigger the navigation.
102  */
103 EAPI Event_Mouse_Button ewk_navigation_policy_mouse_button_get(const Ewk_Navigation_Policy_Decision *decision);
104
105 /**
106  * Query modifier keys for this navigation policy decision.
107  *
108  * @param decision navigation policy decision object to query.
109  *
110  * @return the modifier keys used when triggering the navigation.
111  */
112 EAPI Event_Modifier_Keys ewk_navigation_policy_modifiers_get(const Ewk_Navigation_Policy_Decision *decision);
113
114 /**
115  * Query frame name for this navigation policy decision.
116  *
117  * The frame name is non-null for new window policy decisions only.
118  *
119  * @param decision navigation policy decision object to query.
120  *
121  * @return the frame name pointer, that may be @c NULL. This pointer is
122  *         guaranteed to be eina_stringshare, so whenever possible
123  *         save yourself some cpu cycles and use
124  *         eina_stringshare_ref() instead of eina_stringshare_add() or
125  *         strdup().
126  */
127 EAPI const char *ewk_navigation_policy_frame_name_get(const Ewk_Navigation_Policy_Decision *decision);
128
129 /**
130  * Query URL request for this navigation policy decision.
131  *
132  * @param decision navigation policy decision object to query.
133  *
134  * @return The URL request pointer or @c NULL in case of error.
135  */
136 EAPI Ewk_Url_Request *ewk_navigation_policy_request_get(const Ewk_Navigation_Policy_Decision *decision);
137
138 /**
139  * Accepts the navigation request.
140  *
141  * The navigation will be accepted by default.
142  *
143  * @param decision navigation policy decision object to query.
144  */
145 EAPI void ewk_navigation_policy_decision_accept(Ewk_Navigation_Policy_Decision *decision);
146
147 /**
148  * Rejects the navigation request.
149  *
150  * @param decision navigation policy decision object to query.
151  */
152 EAPI void ewk_navigation_policy_decision_reject(Ewk_Navigation_Policy_Decision *decision);
153
154 /**
155  * Triggers a download instead of navigating to the url.
156  *
157  * @param decision navigation policy decision object to query.
158  */
159 EAPI void ewk_navigation_policy_decision_download(Ewk_Navigation_Policy_Decision *decision);
160
161 #ifdef __cplusplus
162 }
163 #endif
164
165 #endif // ewk_navigation_policy_decision_h