2 * Copyright (C) 2012 Intel Corporation. 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 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.
27 * @file ewk_navigation_policy_decision.h
28 * @brief Describes the Ewk navigation policy decision API.
31 #ifndef ewk_navigation_policy_decision_h
32 #define ewk_navigation_policy_decision_h
34 #include "ewk_url_request.h"
41 /** Creates a type name for Ewk_Navigation_Policy_Decision */
42 typedef struct Ewk_Navigation_Policy_Decision Ewk_Navigation_Policy_Decision;
44 /// Enum containing navigation types
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;
54 /// Enum containing button types
56 EVENT_MOUSE_BUTTON_NONE = -1,
57 EVENT_MOUSE_BUTTON_LEFT = 0,
58 EVENT_MOUSE_BUTTON_MIDDLE = 1,
59 EVENT_MOUSE_BUTTON_RIGHT = 2
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;
70 * Increases the reference count of the given object.
72 * @param decision the policy decision object to increase the reference count
74 * @return a pointer to the object on success, @c NULL otherwise.
76 EAPI Ewk_Navigation_Policy_Decision *ewk_navigation_policy_decision_ref(Ewk_Navigation_Policy_Decision *decision);
79 * Decreases the reference count of the given object, possibly freeing it.
81 * When the reference count reaches 0, the object is freed.
83 * @param decision the policy decision object to decrease the reference count
85 EAPI void ewk_navigation_policy_decision_unref(Ewk_Navigation_Policy_Decision *decision);
88 * Query type for this navigation policy decision.
90 * @param decision navigation policy decision object to query.
92 * @return the type of navigation.
94 EAPI Ewk_Navigation_Type ewk_navigation_policy_navigation_type_get(const Ewk_Navigation_Policy_Decision *decision);
97 * Query mouse button for this navigation policy decision.
99 * @param decision navigation policy decision object to query.
101 * @return the mouse button clicked to trigger the navigation.
103 EAPI Event_Mouse_Button ewk_navigation_policy_mouse_button_get(const Ewk_Navigation_Policy_Decision *decision);
106 * Query modifier keys for this navigation policy decision.
108 * @param decision navigation policy decision object to query.
110 * @return the modifier keys used when triggering the navigation.
112 EAPI Event_Modifier_Keys ewk_navigation_policy_modifiers_get(const Ewk_Navigation_Policy_Decision *decision);
115 * Query frame name for this navigation policy decision.
117 * The frame name is non-null for new window policy decisions only.
119 * @param decision navigation policy decision object to query.
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
127 EAPI const char *ewk_navigation_policy_frame_name_get(const Ewk_Navigation_Policy_Decision *decision);
130 * Query URL request for this navigation policy decision.
132 * @param decision navigation policy decision object to query.
134 * @return The URL request pointer or @c NULL in case of error.
136 EAPI Ewk_Url_Request *ewk_navigation_policy_request_get(const Ewk_Navigation_Policy_Decision *decision);
139 * Accepts the navigation request.
141 * The navigation will be accepted by default.
143 * @param decision navigation policy decision object to query.
145 EAPI void ewk_navigation_policy_decision_accept(Ewk_Navigation_Policy_Decision *decision);
148 * Rejects the navigation request.
150 * @param decision navigation policy decision object to query.
152 EAPI void ewk_navigation_policy_decision_reject(Ewk_Navigation_Policy_Decision *decision);
155 * Triggers a download instead of navigating to the url.
157 * @param decision navigation policy decision object to query.
159 EAPI void ewk_navigation_policy_decision_download(Ewk_Navigation_Policy_Decision *decision);
165 #endif // ewk_navigation_policy_decision_h