void request_starting_cb(WebKitWebView *web_view, WebKitWebFrame *frame, WebKitWebResource *resource, WebKitNetworkRequest *request, WebKitNetworkResponse *response, gpointer user_data) { (void) web_view; (void) frame; (void) resource; (void) response; (void) user_data; const gchar* uri = webkit_network_request_get_uri (request); if (uzbl.state.verbose) printf("Request starting -> %s\n", uri); send_event (REQUEST_STARTING, NULL, TYPE_STR, webkit_network_request_get_uri(request), NULL); if (uzbl.behave.request_handler) { GString *result = g_string_new (""); GArray *a = g_array_new (TRUE, FALSE, sizeof(gchar*)); const CommandInfo *c = parse_command_parts(uzbl.behave.request_handler, a); if(c) { g_array_append_val(a, uri); run_parsed_command(c, a, result); } g_array_free(a, TRUE); if(result->len > 0) { char *p = strchr(result->str, '\n' ); if ( p != NULL ) *p = '\0'; webkit_network_request_set_uri(request, result->str); } g_string_free(result, TRUE); } }
gboolean new_window_cb (WebKitWebView *web_view, WebKitWebFrame *frame, WebKitNetworkRequest *request, WebKitWebNavigationAction *navigation_action, WebKitWebPolicyDecision *policy_decision, gpointer user_data) { (void) web_view; (void) frame; (void) navigation_action; (void) policy_decision; (void) user_data; if (uzbl.state.verbose) printf ("New window requested -> %s \n", webkit_network_request_get_uri (request)); /* This event function causes troubles with `target="_blank"` anchors. * Either we: * 1. Comment it out and target blank links are ignored. * 2. Uncomment it and two windows are opened when you click on target * blank links. * * This problem is caused by create_web_view_cb also being called whenever * this callback is triggered thus resulting in the doubled events. * * We are leaving this uncommented as we would rather links open twice * than not at all. */ send_event (NEW_WINDOW, NULL, TYPE_STR, webkit_network_request_get_uri (request), NULL); webkit_web_policy_decision_ignore (policy_decision); return TRUE; }
gboolean StatusWidget::navigation_policy_decision_requested_cb(WebKitWebView* web_view, WebKitWebFrame* web_frame, WebKitNetworkRequest* request, WebKitWebNavigationAction* action, WebKitWebPolicyDecision* decision) { g_return_val_if_fail (WEBKIT_IS_WEB_VIEW (web_view), FALSE); std::cout<<webkit_network_request_get_uri(request)<<std::endl; GError *error; error = NULL; gtk_show_uri (gdk_screen_get_default(),webkit_network_request_get_uri(request), gtk_get_current_event_time(), &error); webkit_web_policy_decision_ignore(decision); return TRUE; }
static WebKitNavigationResponse assistant_navigation_requested (WebKitWebView *web_view, WebKitWebFrame *frame, WebKitNetworkRequest *request) { DhAssistantViewPriv *priv; const gchar *uri; priv = GET_PRIVATE (web_view); uri = webkit_network_request_get_uri (request); if (strcmp (uri, "about:blank") == 0) { return WEBKIT_NAVIGATION_RESPONSE_ACCEPT; } else if (! priv->snippet_loaded) { priv->snippet_loaded = TRUE; return WEBKIT_NAVIGATION_RESPONSE_ACCEPT; } else if (g_str_has_prefix (uri, "file://")) { GtkWidget *window; window = dh_base_get_window (priv->base); _dh_window_display_uri (DH_WINDOW (window), uri); } return WEBKIT_NAVIGATION_RESPONSE_IGNORE; }
static gboolean mime_type_decision_cb(WebKitWebView *v, WebKitWebFrame *f, WebKitNetworkRequest *r, gchar *mime, WebKitWebPolicyDecision *pd, widget_t *w) { (void) v; (void) f; lua_State *L = globalconf.L; const gchar *uri = webkit_network_request_get_uri(r); gint ret; luaH_object_push(L, w->ref); lua_pushstring(L, uri); lua_pushstring(L, mime); ret = luaH_object_emit_signal(L, -3, "mime-type-decision", 2, 1); if (ret && !luaH_checkboolean(L, -1)) /* User responded with false, ignore request */ webkit_web_policy_decision_ignore(pd); else if (!webkit_web_view_can_show_mime_type(v, mime)) webkit_web_policy_decision_download(pd); else webkit_web_policy_decision_use(pd); lua_pop(L, ret + 1); return TRUE; }
/** * A new window was requested. This is the case e.g. if the link * has target="_blank". In that case, we don't open the link in a new * tab, but do what the user requested as if it didn't have a target. */ static gboolean liferea_webkit_new_window_requested (WebKitWebView *view, WebKitWebFrame *frame, WebKitNetworkRequest *request, WebKitWebNavigationAction *navigation_action, WebKitWebPolicyDecision *policy_decision) { const gchar *uri = webkit_network_request_get_uri (request); if (webkit_web_navigation_action_get_button (navigation_action) == 2) { /* middle-click, let's open the link in a new tab */ browser_tabs_add_new (uri, uri, FALSE); } else if (liferea_htmlview_handle_URL (g_object_get_data (G_OBJECT (view), "htmlview"), uri)) { /* The link is to be opened externally, let's do nothing here */ } else { /* If the link is not to be opened in a new tab, nor externally, * it was likely a normal click on a target="_blank" link. * Let's open it in the current view to not disturb users */ webkit_web_view_load_uri (view, uri); } /* We handled the request ourselves */ webkit_web_policy_decision_ignore (policy_decision); return TRUE; }
static void on_resource_request_starting (MuMsgBodyView *self, WebKitWebFrame *frame, WebKitWebResource *resource, WebKitNetworkRequest *request, WebKitNetworkResponse *response, gpointer data) { const char* uri; MuMsg *msg; msg = self->_priv->_msg; uri = webkit_network_request_get_uri (request); /* g_warning ("%s: %s", __FUNCTION__, uri); */ if (g_ascii_strncasecmp (uri, "cid:", 4) == 0) { gchar *filepath; filepath = save_file_for_cid (msg, uri); if (filepath) { gchar *fileuri; fileuri = g_strdup_printf ("file://%s", filepath); webkit_network_request_set_uri (request, fileuri); g_free (fileuri); g_free (filepath); } } }
static WebKitNavigationResponse webkit_navigation_requested_cb( WebKitWebView* web_view, WebKitWebFrame* frame, WebKitNetworkRequest* request, gpointer data ) { URLType type; gchar* location = NULL; gchar* label = NULL; GncHtmlWebkit* self = GNC_HTML_WEBKIT(data); const gchar* url = webkit_network_request_get_uri( request ); ENTER( "requesting %s", url ); if ( strcmp( url, BASE_URI_NAME ) == 0 ) { LEAVE("URI is %s", BASE_URI_NAME); return WEBKIT_NAVIGATION_RESPONSE_ACCEPT; } type = gnc_html_parse_url( GNC_HTML(self), url, &location, &label ); if ( strcmp( type, "file" ) == 0 ) { LEAVE("URI type is 'file'"); return WEBKIT_NAVIGATION_RESPONSE_ACCEPT; } gnc_html_show_url( GNC_HTML(self), type, location, label, 0 ); // load_to_stream( self, type, location, label ); g_free( location ); g_free( label ); LEAVE(""); return WEBKIT_NAVIGATION_RESPONSE_IGNORE; }
void FrameLoaderClient::dispatchWillSendRequest(WebCore::DocumentLoader* loader, unsigned long identifier, ResourceRequest& request, const ResourceResponse& redirectResponse) { GOwnPtr<WebKitNetworkResponse> networkResponse(0); // We are adding one more resource to the load, or maybe we are // just redirecting a load. if (redirectResponse.isNull()) static_cast<WebKit::DocumentLoader*>(loader)->increaseLoadCount(identifier); else networkResponse.set(webkit_network_response_new_with_core_response(redirectResponse)); WebKitWebView* webView = getViewFromFrame(m_frame); GOwnPtr<gchar> identifierString(toString(identifier)); WebKitWebResource* webResource = webkit_web_view_get_resource(webView, identifierString.get()); GOwnPtr<WebKitNetworkRequest> networkRequest(webkit_network_request_new_with_core_request(request)); if (!redirectResponse.isNull()) { // This is a redirect, so we need to update the WebResource's knowledge // of the URI. g_free(webResource->priv->uri); webResource->priv->uri = g_strdup(request.url().string().utf8().data()); } g_signal_emit_by_name(webView, "resource-request-starting", m_frame, webResource, networkRequest.get(), networkResponse.get()); // Feed any changes back into the ResourceRequest object. SoupMessage* message = webkit_network_request_get_message(networkRequest.get()); if (!message) { request.setURL(KURL(KURL(), String::fromUTF8(webkit_network_request_get_uri(networkRequest.get())))); return; } request.updateFromSoupMessage(message); }
/* open urls in external window. You don't want to navigate without a back * button nor url bar. * No clean way to handle this, so use global cur_url */ static WebKitNavigationResponse wp_navigation_requested(WebKitWebView *web_view, WebKitWebFrame *frame, WebKitNetworkRequest *request, gpointer user_data) { const gchar *uri; gchar *decoded_uri; GError *error = NULL; GdkScreen *screen; uri = webkit_network_request_get_uri(request); decoded_uri = soup_uri_decode(uri); if (g_str_has_prefix(decoded_uri, current_url)) { g_log(wikipedia_logdomain, G_LOG_LEVEL_DEBUG, "Accepting %s\n", uri); g_free(decoded_uri); return WEBKIT_NAVIGATION_RESPONSE_ACCEPT; } g_free(decoded_uri); g_log(wikipedia_logdomain, G_LOG_LEVEL_DEBUG, "%s != %s\n", uri, current_url); screen = gtk_widget_get_screen(GTK_WIDGET(web_view)); if (!screen) screen = gdk_screen_get_default (); gtk_show_uri(screen, uri, gtk_get_current_event_time(), &error); if (error) { g_log(wikipedia_logdomain, G_LOG_LEVEL_DEBUG, "gtk_show_uri %s\n", error->message); g_error_free(error); } return WEBKIT_NAVIGATION_RESPONSE_IGNORE; }
/* Raises the "navigation-request" signal on a webkit navigation policy * decision request. The default action is to load the requested uri. * * The signal handler is able to: * - return true for the handler execution to stop and the request to continue * - return false for the handler execution to stop and the request to hault * - do nothing and give the navigation decision to the next signal handler * * This signal is also where you would attach custom scheme handlers to take * over the navigation request by launching an external application. */ static gboolean navigation_decision_cb(WebKitWebView *v, WebKitWebFrame *f, WebKitNetworkRequest *r, WebKitWebNavigationAction *a, WebKitWebPolicyDecision *p, widget_t *w) { (void) v; (void) f; (void) a; lua_State *L = globalconf.L; const gchar *uri = webkit_network_request_get_uri(r); gint ret; luaH_object_push(L, w->ref); lua_pushstring(L, uri); ret = luaH_object_emit_signal(L, -2, "navigation-request", 1, 1); if (ret && !luaH_checkboolean(L, -1)) /* User responded with false, do not continue navigation request */ webkit_web_policy_decision_ignore(p); else webkit_web_policy_decision_use(p); lua_pop(L, ret + 1); return TRUE; }
static void wxgtk_webview_webkit_resource_req(WebKitWebView *, WebKitWebFrame *, WebKitWebResource *, WebKitNetworkRequest *request, WebKitNetworkResponse *, wxWebViewWebKit *webKitCtrl) { wxString uri = webkit_network_request_get_uri(request); wxSharedPtr<wxWebViewHandler> handler; wxVector<wxSharedPtr<wxWebViewHandler> > handlers = webKitCtrl->GetHandlers(); //We are not vetoed so see if we match one of the additional handlers #if defined(__INTEL_COMPILER) && 1 /* VDM auto patch */ # pragma ivdep # pragma swp # pragma unroll # pragma prefetch # if 0 # pragma simd noassert # endif #endif /* VDM auto patch */ for(wxVector<wxSharedPtr<wxWebViewHandler> >::iterator it = handlers.begin(); it != handlers.end(); ++it) { if(uri.substr(0, (*it)->GetName().length()) == (*it)->GetName()) { handler = (*it); } } //If we found a handler we can then use it to load the file directly //ourselves if(handler) { //If it is requsting the page itself then return as we have already //loaded it from the archive if(webKitCtrl->m_vfsurl == uri) return; wxFSFile* file = handler->GetFile(uri); if(file) { //We load the data into a data url to save it being written out again size_t size = file->GetStream()->GetLength(); char *buffer = new char[size]; file->GetStream()->Read(buffer, size); wxString data = wxBase64Encode(buffer, size); delete[] buffer; wxString mime = file->GetMimeType(); wxString path = "data:" + mime + ";base64," + data; //Then we can redirect the call webkit_network_request_set_uri(request, path.utf8_str()); } } }
JNIEXPORT jintLong JNICALL WebKitGTK_NATIVE(_1webkit_1network_1request_1get_1uri) (JNIEnv *env, jclass that, jintLong arg0) { jintLong rc = 0; WebKitGTK_NATIVE_ENTER(env, that, _1webkit_1network_1request_1get_1uri_FUNC); rc = (jintLong)webkit_network_request_get_uri((WebKitNetworkRequest *)arg0); WebKitGTK_NATIVE_EXIT(env, that, _1webkit_1network_1request_1get_1uri_FUNC); return rc; }
WebCore::ResourceRequest core(WebKitNetworkRequest* request) { SoupMessage* soupMessage = webkit_network_request_get_message(request); if (soupMessage) return WebCore::ResourceRequest(soupMessage); WebCore::KURL url = WebCore::KURL(WebCore::KURL(), String::fromUTF8(webkit_network_request_get_uri(request))); return WebCore::ResourceRequest(url); }
void request_starting_cb(WebKitWebView *web_view, WebKitWebFrame *frame, WebKitWebResource *resource, WebKitNetworkRequest *request, WebKitNetworkResponse *response, gpointer user_data) { (void) web_view; (void) frame; (void) resource; (void) response; (void) user_data; send_event (REQUEST_STARTING, NULL, TYPE_STR, webkit_network_request_get_uri(request), NULL); }
static VALUE WebNetworkRequest_uri(VALUE self) { VALUE __p_retval = Qnil; WebKitNetworkRequest *_self = ((WebKitNetworkRequest*)RVAL2GOBJ(self)); #line 198 "/home/geoff/Projects/gtk-webkit-ruby/ext/webkit/webkit.cr" do { __p_retval = rb_str_new2(webkit_network_request_get_uri(_self)); goto out; } while(0); out: return __p_retval; }
gboolean decidewindow(WebKitWebView *view, WebKitWebFrame *f, WebKitNetworkRequest *r, WebKitWebNavigationAction *n, WebKitWebPolicyDecision *p, Client *c) { Arg arg; if(webkit_web_navigation_action_get_reason(n) == WEBKIT_WEB_NAVIGATION_REASON_LINK_CLICKED) { webkit_web_policy_decision_ignore(p); arg.v = (void *)webkit_network_request_get_uri(r); newwindow(NULL, &arg); return TRUE; } return FALSE; }
void resource_request_starting__(WebKitWebView*page,WebKitWebFrame*frame,WebKitWebResource*resource,WebKitNetworkRequest*request,WebKitNetworkResponse*response,gpointer user_data){ const gchar* uri = webkit_network_request_get_uri(request); const char* ret=names_[page]->suidao__(resource_request_starting_,uri); //g_str_has_suffix(uri, ".png") if(ret[0]=='x'){ if(!ret[1]) webkit_network_request_set_uri (request, webkit_web_frame_get_uri (frame)); else if(ret[1]=='-') webkit_network_request_set_uri (request, ret+2); } }
gboolean contents_click_handler( WebKitWebView *web_view, WebKitWebFrame *frame, WebKitNetworkRequest *request, WebKitWebNavigationAction *navigation_action, WebKitWebPolicyDecision *policy_decision, gpointer data) { webkit_web_view_load_uri(WEBKIT_WEB_VIEW(data), webkit_network_request_get_uri(request)); return TRUE; }
static WebKitNavigationResponse ygtk_webkit_navigation_requested_cb ( WebKitWebView *view, WebKitWebFrame *frame, WebKitNetworkRequest *request, LinkClickedCb callback) { const gchar *uri = webkit_network_request_get_uri (request); // look for set_text to see why we need to cut the uri in some cases // (hint: not an uri) if (!strncmp (uri, "label:/", sizeof ("label:/")-1)) uri = uri + sizeof ("label:/")-1; gpointer data = g_object_get_data (G_OBJECT (view), "pointer"); (*callback) (GTK_WIDGET (view), uri, data); return WEBKIT_NAVIGATION_RESPONSE_IGNORE; }
static gboolean new_window_cb (WebKitWebView *web_view, WebKitWebFrame *frame, WebKitNetworkRequest *request, WebKitWebNavigationAction *navigation_action, WebKitWebPolicyDecision *policy_decision, gpointer user_data) { (void) web_view; (void) frame; (void) navigation_action; (void) policy_decision; (void) user_data; const gchar* uri = webkit_network_request_get_uri (request); printf("New window requested -> %s \n", uri); new_window_load_uri(uri); return (FALSE); }
gboolean new_window_cb (WebKitWebView *web_view, WebKitWebFrame *frame, WebKitNetworkRequest *request, WebKitWebNavigationAction *navigation_action, WebKitWebPolicyDecision *policy_decision, gpointer user_data) { (void) web_view; (void) frame; (void) navigation_action; (void) policy_decision; (void) user_data; const gchar* uri = webkit_network_request_get_uri (request); if (uzbl.state.verbose) printf("New window requested -> %s \n", uri); webkit_web_policy_decision_use(policy_decision); send_event(NEW_WINDOW, uri, NULL); return TRUE; }
WebKitNavigationResponse navigation_requested__(WebKitWebView *page, WebKitWebFrame *frame, WebKitNetworkRequest *request){ const gchar* uri = webkit_network_request_get_uri(request); //gchar *uri = g_uri_unescape_string (webkit_network_request_get_uri (request), NULL); if(uri){ const Glib::ustring& zs=s1_[zhscript_]; Glib::ustring uri1=uri; size_t i1=uri1.find(zs); if(i1!=string::npos){ names_[page]->suidao__(zhscript_,uri+i1+zs.size()); return WEBKIT_NAVIGATION_RESPONSE_IGNORE; } } //g_free (uri); return WEBKIT_NAVIGATION_RESPONSE_ACCEPT; }
static void webkit_network_request_get_property(GObject* object, guint propertyID, GValue* value, GParamSpec* pspec) { WebKitNetworkRequest* request = WEBKIT_NETWORK_REQUEST(object); switch(propertyID) { case PROP_URI: g_value_set_string(value, webkit_network_request_get_uri(request)); break; case PROP_MESSAGE: g_value_set_object(value, webkit_network_request_get_message(request)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID(object, propertyID, pspec); } }
redirect_cb(WebKitWebView* web_view, WebKitPolicyDecision* decision, WebKitPolicyDecisionType type, gpointer udata) #endif { GtTwitchLoginDlg* self = GT_TWITCH_LOGIN_DLG(udata); GtTwitchLoginDlgPrivate* priv = gt_twitch_login_dlg_get_instance_private(self); GMatchInfo* match_info = NULL; const gchar* uri = NULL; #ifdef USE_DEPRECATED_WEBKIT uri = webkit_network_request_get_uri(request); #else if (type == WEBKIT_POLICY_DECISION_TYPE_NAVIGATION_ACTION) { WebKitNavigationAction* action = webkit_navigation_policy_decision_get_navigation_action( WEBKIT_NAVIGATION_POLICY_DECISION(decision)); WebKitURIRequest* request = webkit_navigation_action_get_request(action); uri = webkit_uri_request_get_uri(request); } #endif if (uri == NULL || strlen(uri) == 0) return FALSE; MESSAGE("Redirect uri is '%s'", uri); g_regex_match(priv->token_redirect_regex, uri, 0, &match_info); if (g_match_info_matches(match_info)) { g_autofree gchar* token = g_match_info_fetch(match_info, 1); MESSAGEF("Successfully got OAuth token '%s'", token); gt_twitch_fetch_oauth_info_async(main_app->twitch, token, fetch_oauth_info_cb, priv->cancel, self); } else if (g_str_has_prefix(uri, "http://localhost/?error=access_denied")) WARNING("Error logging in or login cancelled"); g_match_info_unref(match_info); return FALSE; }
static gboolean on_navigation_policy_decision_requested (MuMsgBodyView *self, WebKitWebFrame *frame, WebKitNetworkRequest *request, WebKitWebNavigationAction *nav_action, WebKitWebPolicyDecision *policy_decision, gpointer data) { const char* uri; WebKitWebNavigationReason reason; uri = webkit_network_request_get_uri (request); reason = webkit_web_navigation_action_get_reason (nav_action); /* if it wasn't a user click, don't the navigation */ if (reason != WEBKIT_WEB_NAVIGATION_REASON_LINK_CLICKED) { webkit_web_policy_decision_ignore (policy_decision); return TRUE; } /* we handle links clicked ourselves, no need for navigation */ webkit_web_policy_decision_ignore (policy_decision); /* if there are 'cmd:<action>" links in the body text of * mu-internal messages (ie., notification from mu, not real * e-mail messages), we emit the 'action requested' * signal. this allows e.g triggering a database refresh from * a <a href="cmd:refresh">Refresh</a> link */ if (g_ascii_strncasecmp (uri, "cmd:", 4) == 0) { if (self->_priv->_view_mode == VIEW_MODE_NOTE) { g_signal_emit (G_OBJECT(self), signals[ACTION_REQUESTED], 0, uri + 4); } return TRUE; } /* don't try to play files on our local file system, this is not something * external content should do.*/ if (!mu_util_is_local_file(uri)) mu_util_play (uri, FALSE, TRUE); return TRUE; }
gboolean navigation_decision_cb (WebKitWebView *web_view, WebKitWebFrame *frame, WebKitNetworkRequest *request, WebKitWebNavigationAction *navigation_action, WebKitWebPolicyDecision *policy_decision, gpointer user_data) { (void) web_view; (void) frame; (void) navigation_action; (void) user_data; const gchar* uri = webkit_network_request_get_uri (request); gboolean decision_made = FALSE; if (uzbl.state.verbose) printf("Navigation requested -> %s\n", uri); if (uzbl.behave.scheme_handler) { GString *result = g_string_new (""); GArray *a = g_array_new (TRUE, FALSE, sizeof(gchar*)); const CommandInfo *c = parse_command_parts(uzbl.behave.scheme_handler, a); if(c) { g_array_append_val(a, uri); run_parsed_command(c, a, result); } g_array_free(a, TRUE); if(result->len > 0) { char *p = strchr(result->str, '\n' ); if ( p != NULL ) *p = '\0'; if (!strcmp(result->str, "USED")) { webkit_web_policy_decision_ignore(policy_decision); decision_made = TRUE; } } g_string_free(result, TRUE); } if (!decision_made) webkit_web_policy_decision_use(policy_decision); return TRUE; }
static void on_resource_request_starting (WebKitWebView *self, WebKitWebFrame *frame, WebKitWebResource *resource, WebKitNetworkRequest *request, WebKitNetworkResponse *response, MuMsg *msg) { const char* uri; uri = webkit_network_request_get_uri (request); if (g_ascii_strncasecmp (uri, "cid:", 4) == 0) { gchar *filepath; filepath = save_file_for_cid (msg, uri); if (filepath) { gchar *fileuri; fileuri = g_strdup_printf ("file://%s", filepath); webkit_network_request_set_uri (request, fileuri); g_free (fileuri); g_free (filepath); } } }
static int gtkWebBrowserNavigate(WebKitWebView *web_view, WebKitWebFrame *frame, WebKitNetworkRequest *request, WebKitWebNavigationAction *navigation_action, WebKitWebPolicyDecision *policy_decision, Ihandle *ih) { /* char *strReason = iupStrGetMemory(50); WebKitWebNavigationReason reason = webkit_web_navigation_action_get_reason(navigation_action); switch(reason) { case WEBKIT_WEB_NAVIGATION_REASON_LINK_CLICKED: sprintf(strReason, "%s", "LINK_CLICKED"); break; case WEBKIT_WEB_NAVIGATION_REASON_FORM_SUBMITTED: sprintf(strReason, "%s", "FORM_SUBMITTED"); break; case WEBKIT_WEB_NAVIGATION_REASON_BACK_FORWARD: sprintf(strReason, "%s", "BACK_FORWARD"); break; case WEBKIT_WEB_NAVIGATION_REASON_RELOAD: sprintf(strReason, "%s", "RELOAD"); break; case WEBKIT_WEB_NAVIGATION_REASON_FORM_RESUBMITTED: sprintf(strReason, "%s", "FORM_RESUBMITTED"); break; case WEBKIT_WEB_NAVIGATION_REASON_OTHER: sprintf(strReason, "%s", "OTHER"); break; } */ IFns cb = (IFns)IupGetCallback(ih, "NAVIGATE_CB"); if (cb) { if (cb(ih, (char*)webkit_network_request_get_uri(request)) == IUP_IGNORE) return FALSE; } return FALSE; }
void WindowCheckKeyterms::navigation_policy_decision_requested (WebKitNetworkRequest *request, WebKitWebNavigationAction *navigation_action, WebKitWebPolicyDecision *policy_decision) // Callback for clicking a link. { // Store scrolling position for the now active url. GtkAdjustment * adjustment = gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW (scrolledwindow_terms)); scrolling_position[active_url] = gtk_adjustment_get_value (adjustment); // Get the reason for this navigation policy request. WebKitWebNavigationReason reason = webkit_web_navigation_action_get_reason (navigation_action); // If a new page if loaded, allow the navigation, and exit. if (reason == WEBKIT_WEB_NAVIGATION_REASON_OTHER) { webkit_web_policy_decision_use (policy_decision); return; } // Don't follow pseudo-links clicked on this page. webkit_web_policy_decision_ignore (policy_decision); // Load new page depending on the pseudo-link clicked. html_link_clicked (webkit_network_request_get_uri (request)); }