[Title] Added APIs for checking whether frame is main frame when policy decision callback is called.
[Issue#] N/A
[Problem] N/A
[Cause] N/A
[Solution] N/A
Change-Id: I90b5cdb182eda4aefff38ce89e2ca7a0097c857c
WKFrameRef wkFrame = static_cast<WKFrameRef>(frame);
WKRetainPtr<WKStringRef> mimeTypeRef(AdoptWK, WKStringCreateWithUTF8CString(mimeType));
return WKFrameCanShowMIMEType(wkFrame, mimeTypeRef.get());
WKFrameRef wkFrame = static_cast<WKFrameRef>(frame);
WKRetainPtr<WKStringRef> mimeTypeRef(AdoptWK, WKStringCreateWithUTF8CString(mimeType));
return WKFrameCanShowMIMEType(wkFrame, mimeTypeRef.get());
-}
\ No newline at end of file
+}
+
+Eina_Bool ewk_frame_is_main_frame(Ewk_Frame_Ref frame)
+{
+ EINA_SAFETY_ON_NULL_RETURN_VAL(frame, false);
+
+ WKFrameRef wkFrame = static_cast<WKFrameRef>(frame);
+ return WKFrameIsMainFrame(wkFrame);
+}
EAPI Eina_Bool ewk_frame_source_get(Ewk_Frame_Ref frame, Ewk_Frame_Source_Get_Callback callback, void* user_data);
/**
EAPI Eina_Bool ewk_frame_source_get(Ewk_Frame_Ref frame, Ewk_Frame_Source_Get_Callback callback, void* user_data);
/**
- * Returns that Whether or not a MIME type can be displayed.
+ * Gets whether a MIME type can be displayed in the frame.
*
* @param frame frame object
* @param mime_type a mime type
*
* @param frame frame object
* @param mime_type a mime type
*/
EAPI Eina_Bool ewk_frame_can_show_mime_type(Ewk_Frame_Ref frame, char* mime_type);
*/
EAPI Eina_Bool ewk_frame_can_show_mime_type(Ewk_Frame_Ref frame, char* mime_type);
+/**
+ * Gets whether the frame is main frame.
+ *
+ * @param frame frame object
+ *
+ * @return @c EINA_TRUE if the frame is main frame or @c EINA_FALSE otherwise
+ */
+EAPI Eina_Bool ewk_frame_is_main_frame(Ewk_Frame_Ref frame);
+
#ifdef __cplusplus
}
#endif
#ifdef __cplusplus
}
#endif
Eina_Hash* responseHeaders;
Ewk_Policy_Decision_Type decisionType;
Ewk_Policy_Navigation_Type navigationType;
Eina_Hash* responseHeaders;
Ewk_Policy_Decision_Type decisionType;
Ewk_Policy_Navigation_Type navigationType;
bool isDecided;
bool isSuspended;
bool isDecided;
bool isSuspended;
policyDecision->decisionType = EWK_POLICY_DECISION_USE;
policyDecision->navigationType = static_cast<Ewk_Policy_Navigation_Type>(navigationType);
policyDecision->decisionType = EWK_POLICY_DECISION_USE;
policyDecision->navigationType = static_cast<Ewk_Policy_Navigation_Type>(navigationType);
+ policyDecision->frame = frame;
+
if (response) {
policyDecision->responseMime = eina_stringshare_add(toImpl(response)->resourceResponse().mimeType().utf8().data());
if (response) {
policyDecision->responseMime = eina_stringshare_add(toImpl(response)->resourceResponse().mimeType().utf8().data());
-Ewk_Policy_Navigation_Type ewk_policy_decision_navigation_type_get(Ewk_Policy_Decision* policy_decision)
+Ewk_Policy_Navigation_Type ewk_policy_decision_navigation_type_get(Ewk_Policy_Decision* policyDecision)
+{
+ EINA_SAFETY_ON_NULL_RETURN_VAL(policyDecision, EWK_POLICY_NAVIGATION_TYPE_OTHER);
+
+ return policyDecision->navigationType;
+}
+
+Ewk_Frame_Ref ewk_policy_decision_frame_get(Ewk_Policy_Decision* policyDecision)
- EINA_SAFETY_ON_NULL_RETURN_VAL(policy_decision, EWK_POLICY_NAVIGATION_TYPE_OTHER);
+ EINA_SAFETY_ON_NULL_RETURN_VAL(policyDecision, 0);
- return policy_decision->navigationType;
+ return static_cast<Ewk_Frame_Ref>(policyDecision->frame);
}
#endif // #if OS(TIZEN)
}
#endif // #if OS(TIZEN)
#ifndef ewk_policy_decision_h
#define ewk_policy_decision_h
#ifndef ewk_policy_decision_h
#define ewk_policy_decision_h
#include <Eina.h>
#ifdef __cplusplus
#include <Eina.h>
#ifdef __cplusplus
*/
EAPI Ewk_Policy_Navigation_Type ewk_policy_decision_navigation_type_get(Ewk_Policy_Decision* policy_decision);
*/
EAPI Ewk_Policy_Navigation_Type ewk_policy_decision_navigation_type_get(Ewk_Policy_Decision* policy_decision);
+/**
+ * Gets the frame reference from Policy Decision object.
+ *
+ * @param policy_decision policy decsision object
+ *
+ * @return frame reference on success, or NULL on failure
+ */
+EAPI Ewk_Frame_Ref ewk_policy_decision_frame_get(Ewk_Policy_Decision* policy_decision);
+
#ifdef __cplusplus
}
#endif
#ifdef __cplusplus
}
#endif
void decidePolicyForNavigationAction(WKPageRef page, WKFrameRef frame, WKFrameNavigationType navigationType, WKEventModifiers modifiers, WKEventMouseButton mouseButton, WKURLRequestRef request, WKFramePolicyListenerRef listener, WKTypeRef userData, const void* clientInfo)
{
Evas_Object* ewkView = static_cast<Evas_Object*>(const_cast<void*>(clientInfo));
void decidePolicyForNavigationAction(WKPageRef page, WKFrameRef frame, WKFrameNavigationType navigationType, WKEventModifiers modifiers, WKEventMouseButton mouseButton, WKURLRequestRef request, WKFramePolicyListenerRef listener, WKTypeRef userData, const void* clientInfo)
{
Evas_Object* ewkView = static_cast<Evas_Object*>(const_cast<void*>(clientInfo));
- Ewk_Policy_Decision* policyDecision = ewkPolicyDecisionCreate(listener, request, 0, 0, navigationType);
+ Ewk_Policy_Decision* policyDecision = ewkPolicyDecisionCreate(listener, request, frame, 0, navigationType);
ewkViewPolicyNavigationDecide(ewkView, policyDecision);
if (!ewkPolicyDecisionDecided(policyDecision) && !ewkPolicyDecisionSuspended(policyDecision))
ewkViewPolicyNavigationDecide(ewkView, policyDecision);
if (!ewkPolicyDecisionDecided(policyDecision) && !ewkPolicyDecisionSuspended(policyDecision))
void decidePolicyForNewWindowAction(WKPageRef page, WKFrameRef frame, WKFrameNavigationType navigationType, WKEventModifiers modifiers, WKEventMouseButton mouseButton, WKURLRequestRef request, WKStringRef frameName, WKFramePolicyListenerRef listener, WKTypeRef userData, const void* clientInfo)
{
Evas_Object* ewkView = static_cast<Evas_Object*>(const_cast<void*>(clientInfo));
void decidePolicyForNewWindowAction(WKPageRef page, WKFrameRef frame, WKFrameNavigationType navigationType, WKEventModifiers modifiers, WKEventMouseButton mouseButton, WKURLRequestRef request, WKStringRef frameName, WKFramePolicyListenerRef listener, WKTypeRef userData, const void* clientInfo)
{
Evas_Object* ewkView = static_cast<Evas_Object*>(const_cast<void*>(clientInfo));
- Ewk_Policy_Decision* policyDecision = ewkPolicyDecisionCreate(listener, request, 0, 0, navigationType);
+ Ewk_Policy_Decision* policyDecision = ewkPolicyDecisionCreate(listener, request, frame, 0, navigationType);
ewkViewPolicyNewWindowDecide(ewkView, policyDecision);
if (!ewkPolicyDecisionDecided(policyDecision) && !ewkPolicyDecisionSuspended(policyDecision))
ewkViewPolicyNewWindowDecide(ewkView, policyDecision);
if (!ewkPolicyDecisionDecided(policyDecision) && !ewkPolicyDecisionSuspended(policyDecision))