- switch (webkit_navigation_action_get_navigation_type(a)) {
- case WEBKIT_NAVIGATION_TYPE_OTHER: /* fallthrough */
- /*
- * popup windows of type “other” are almost always triggered
- * by user gesture, so inverse the logic here
- */
-/* instead of this, compare destination uri to mouse-over uri for validating window */
- if (webkit_navigation_action_is_user_gesture(a)) {
- return NULL;
- break;
- }
- case WEBKIT_NAVIGATION_TYPE_LINK_CLICKED: /* fallthrough */
- case WEBKIT_NAVIGATION_TYPE_FORM_SUBMITTED: /* fallthrough */
- case WEBKIT_NAVIGATION_TYPE_BACK_FORWARD: /* fallthrough */
- case WEBKIT_NAVIGATION_TYPE_RELOAD: /* fallthrough */
- case WEBKIT_NAVIGATION_TYPE_FORM_RESUBMITTED:
- n = newclient(c);
- break;
- default:
- return NULL;
- break;
- }
-
- return GTK_WIDGET(n->view);
-}
-
-gboolean
-decidepolicy(WebKitWebView *v, WebKitPolicyDecision *d,
- WebKitPolicyDecisionType dt, Client *c)
-{
- switch (dt) {
- case WEBKIT_POLICY_DECISION_TYPE_NAVIGATION_ACTION:
- decidenavigation(d, c);
- break;
- case WEBKIT_POLICY_DECISION_TYPE_NEW_WINDOW_ACTION:
- decidenewwindow(d, c);
- break;
- case WEBKIT_POLICY_DECISION_TYPE_RESPONSE:
- decideresource(d, c);
- break;
- default:
- webkit_policy_decision_ignore(d);
- break;
- }
- return TRUE;
-}
-
-void
-decidenavigation(WebKitPolicyDecision *d, Client *c)
-{
- WebKitNavigationAction *a;
-
- a = webkit_navigation_policy_decision_get_navigation_action(
- WEBKIT_NAVIGATION_POLICY_DECISION(d));
-
- switch (webkit_navigation_action_get_navigation_type(a)) {
- case WEBKIT_NAVIGATION_TYPE_LINK_CLICKED: /* fallthrough */
- case WEBKIT_NAVIGATION_TYPE_FORM_SUBMITTED: /* fallthrough */
- case WEBKIT_NAVIGATION_TYPE_BACK_FORWARD: /* fallthrough */
- case WEBKIT_NAVIGATION_TYPE_RELOAD: /* fallthrough */
- case WEBKIT_NAVIGATION_TYPE_FORM_RESUBMITTED:
- case WEBKIT_NAVIGATION_TYPE_OTHER: /* fallthrough */
- default:
- /* Do not navigate to links with a "_blank" target (popup) */
- if (webkit_navigation_policy_decision_get_frame_name(
- WEBKIT_NAVIGATION_POLICY_DECISION(d))) {
- webkit_policy_decision_ignore(d);
- } else {
- /* Filter out navigation to different domain ? */
- /* get action→urirequest, copy and load in new window+view
- * on Ctrl+Click ? */
- webkit_policy_decision_use(d);
- }
- break;
- }
-}
-
-void
-decidenewwindow(WebKitPolicyDecision *d, Client *c)
-{
- WebKitNavigationAction *a;
- Arg arg;
-
- a = webkit_navigation_policy_decision_get_navigation_action(
- WEBKIT_NAVIGATION_POLICY_DECISION(d));
-
- switch (webkit_navigation_action_get_navigation_type(a)) {
- case WEBKIT_NAVIGATION_TYPE_LINK_CLICKED: /* fallthrough */
- case WEBKIT_NAVIGATION_TYPE_FORM_SUBMITTED: /* fallthrough */
- case WEBKIT_NAVIGATION_TYPE_BACK_FORWARD: /* fallthrough */
- case WEBKIT_NAVIGATION_TYPE_RELOAD: /* fallthrough */
- case WEBKIT_NAVIGATION_TYPE_FORM_RESUBMITTED:
- /* Filter domains here */
-/* If the value of “mouse-button” is not 0, then the navigation was triggered by a mouse event.
- * test for link clicked but no button ? */
- arg.v = webkit_uri_request_get_uri(
- webkit_navigation_action_get_request(a));
- newwindow(c, &arg, 0);
- break;
- case WEBKIT_NAVIGATION_TYPE_OTHER: /* fallthrough */
- default:
- break;
- }
-
- webkit_policy_decision_ignore(d);
-}
-
-void
-decideresource(WebKitPolicyDecision *d, Client *c)