예제 #1
0
파일: formhistory.c 프로젝트: sinoory/webv8
static void
formhistory_frame_loaded_cb (WebKitWebView*   web_view,
                             WebKitWebFrame*  web_frame,
                             MidoriExtension* extension)
{
    const gchar* page_uri;
    const gchar* count_request;
    FormHistoryPriv* priv;
    JSContextRef js_context;
    gchar* data;
    gchar* count;

    page_uri = webkit_web_frame_get_uri (web_frame);
    if (!page_uri)
        return;

    count_request = "document.querySelectorAll('input[type=password]').length";
    js_context = webkit_web_frame_get_global_context (web_frame);
    count = sokoke_js_script_eval (js_context, count_request, NULL);
    if (count && count[0] == '0')
    {
        g_free (count);
        return;
    }
    g_free (count);

    priv = g_object_get_data (G_OBJECT (extension), "priv");
    data = formhistory_get_login_data (priv->db, webkit_web_frame_get_uri (web_frame));

    if (!data)
        return;
    formhistory_fill_login_data (js_context, priv, data);
    g_free (data);
}
예제 #2
0
파일: callbacks.c 프로젝트: gnutrino/uzbl
void
load_commit_cb (WebKitWebView* page, WebKitWebFrame* frame, gpointer data) {
    (void) page;
    (void) data;
    g_free (uzbl.state.uri);
    GString* newuri = g_string_new (webkit_web_frame_get_uri (frame));
    uzbl.state.uri = g_string_free (newuri, FALSE);

    send_event(LOAD_COMMIT, webkit_web_frame_get_uri (frame), NULL);
}
예제 #3
0
/* ghtml_get_security */
SurferSecurity ghtml_get_security(GtkWidget * widget)
{
	SurferSecurity security = SS_NONE;
#if WEBKIT_CHECK_VERSION(1, 1, 0)
	GHtml * ghtml;
	WebKitWebFrame * frame;
	char const * location;
	WebKitWebDataSource *source;
	WebKitNetworkRequest *request;
	SoupMessage * message;
#endif

#if WEBKIT_CHECK_VERSION(1, 1, 0)
	ghtml = g_object_get_data(G_OBJECT(widget), "ghtml");
	frame = webkit_web_view_get_main_frame(WEBKIT_WEB_VIEW(ghtml->view));
	if((location = webkit_web_frame_get_uri(frame)) != NULL
			&& strncmp(location, "https://", 8) == 0)
	{
		security = SS_UNTRUSTED;
		source = webkit_web_frame_get_data_source(frame);
		request = webkit_web_data_source_get_request(source);
		message = webkit_network_request_get_message(request);
		if(ghtml->ssl == TRUE && message != NULL
				&& soup_message_get_flags(message)
				& SOUP_MESSAGE_CERTIFICATE_TRUSTED)
			security = SS_TRUSTED;
	}
#endif
	return security;
}
예제 #4
0
파일: callbacks.c 프로젝트: gnutrino/uzbl
void
load_finish_cb (WebKitWebView* page, WebKitWebFrame* frame, gpointer data) {
    (void) page;
    (void) data;

    send_event(LOAD_FINISH, webkit_web_frame_get_uri(frame), NULL);
}
static void load_commit_box(WebKitWebView* page, WebKitWebFrame* frame, gpointer data)
{
 const gchar* uri =webkit_web_frame_get_uri(frame);

 if(uri)
  gtk_entry_set_text(GTK_ENTRY(uri_entry), uri);
}
예제 #6
0
파일: formhistory.c 프로젝트: sinoory/webv8
static void
formhistory_window_object_cleared_cb (WebKitWebView*   web_view,
                                      WebKitWebFrame*  web_frame,
                                      JSContextRef     js_context,
                                      JSObjectRef      js_window,
                                      MidoriExtension* extension)
{
    const gchar* page_uri;
    FormhistoryPasswordEntry* entry;
    GtkWidget* view;

    page_uri = webkit_web_frame_get_uri (web_frame);
    if (!page_uri)
        return;

    if (!midori_uri_is_http (page_uri) && !g_str_has_prefix (page_uri, "file"))
        return;

    formhistory_setup_suggestions (web_view, js_context, extension);

    entry = g_object_get_data (G_OBJECT (web_view), "FormHistoryPasswordEntry");
    if (entry)
    {
        const gchar* message = _("Remember password on this page?");
        view = midori_browser_get_current_tab (midori_app_get_browser (
                                               midori_extension_get_app (extension)));
        midori_view_add_info_bar (MIDORI_VIEW (view), GTK_MESSAGE_QUESTION, message,
                                  G_CALLBACK (formhistory_remember_password_response), entry,
                                  _("Remember"), GTK_RESPONSE_ACCEPT,
                                  _("Not now"), GTK_RESPONSE_IGNORE,
                                  _("Never for this page"), GTK_RESPONSE_CANCEL, NULL);
        g_object_set_data (G_OBJECT (web_view), "FormHistoryPasswordEntry", NULL);
    }
}
예제 #7
0
static WebKitWebView* gtkWebBrowserNewWindow(WebKitWebView  *web_view, WebKitWebFrame *frame, Ihandle *ih)
{
  IFns cb = (IFns)IupGetCallback(ih, "NEWWINDOW_CB");
  if (cb)
    cb(ih, (char*)webkit_web_frame_get_uri(frame));

  return web_view;
}
예제 #8
0
파일: uzbl.c 프로젝트: DuClare/uzbl
static void
load_commit_cb (WebKitWebView* page, WebKitWebFrame* frame, gpointer data) {
    (void) page;
    (void) data;
    free (uzbl.state.uri);
    GString* newuri = g_string_new (webkit_web_frame_get_uri (frame));
    uzbl.state.uri = g_string_free (newuri, FALSE);
}
예제 #9
0
static void notifyLoadStatusCb(WebKitWebView* webView, GParamSpec* pspec, GtkWidget* uriEntry)
{
    if (webkit_web_view_get_load_status(webView) == WEBKIT_LOAD_COMMITTED) {
        WebKitWebFrame *frame = webkit_web_view_get_main_frame(webView);
        const gchar *uri = webkit_web_frame_get_uri(frame);
        if (uri)
            gtk_entry_set_text(GTK_ENTRY(uriEntry), uri);
    }
}
예제 #10
0
JNIEXPORT jintLong JNICALL WebKitGTK_NATIVE(_1webkit_1web_1frame_1get_1uri)
	(JNIEnv *env, jclass that, jintLong arg0)
{
	jintLong rc = 0;
	WebKitGTK_NATIVE_ENTER(env, that, _1webkit_1web_1frame_1get_1uri_FUNC);
	rc = (jintLong)webkit_web_frame_get_uri((WebKitWebFrame *)arg0);
	WebKitGTK_NATIVE_EXIT(env, that, _1webkit_1web_1frame_1get_1uri_FUNC);
	return rc;
}
예제 #11
0
파일: html.c 프로젝트: JackieXie168/chmsee
gchar *
html_get_location(Html *html)
{
        g_return_val_if_fail(IS_HTML (html), NULL);
 		WebKitWebFrame *web_frame;
        web_frame = webkit_web_view_get_main_frame (html->webview);
		gchar *uri = g_strdup(webkit_web_frame_get_uri(web_frame));
		return uri;
}
예제 #12
0
/* ghtml_get_location */
char const * ghtml_get_location(GtkWidget * widget)
{
	GHtml * ghtml;
	WebKitWebFrame * frame;

	ghtml = g_object_get_data(G_OBJECT(widget), "ghtml");
	frame = webkit_web_view_get_main_frame(WEBKIT_WEB_VIEW(ghtml->view));
	return webkit_web_frame_get_uri(frame);
}
예제 #13
0
파일: webview.c 프로젝트: bradparks/luakit
static void
load_finish_cb(WebKitWebView *v, WebKitWebFrame *f, widget_t *w)
{
    update_uri(GTK_WIDGET(v), webkit_web_frame_get_uri(f), w);
    lua_State *L = globalconf.L;
    luaH_object_push(L, w->ref);
    luaH_object_emit_signal(L, -1, "load-finish", 0, 0);
    lua_pop(L, 1);
}
예제 #14
0
파일: html.c 프로젝트: JackieXie168/chmsee
static void 
webkit_web_view_title_changed_cb (WebKitWebView*  web_view,
                                  WebKitWebFrame* web_frame,
                                  const gchar*    title,
                                  Html*     self)
{
	const gchar *uri;
	uri = webkit_web_frame_get_uri(web_frame);
	g_signal_emit(self, signals[TITLE_CHANGED], 0, g_strdup(title));
	html_location_changed(self);
}
예제 #15
0
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);
	}
}
예제 #16
0
static void
load_finished (GtkWidget      *view,
               WebKitWebFrame *frame)
{
  GtkAction *action = gtk_ui_manager_get_action (ui_manager,
                                                 "/ui/help-browser-popup/stop");
  gtk_action_set_sensitive (action, FALSE);

  update_actions ();

  select_index (webkit_web_frame_get_uri (frame));
}
예제 #17
0
int
edit_src_cb(const char *contents, gpointer data)
{
	struct edit_src_cb_args *args;

	args = (struct edit_src_cb_args *)data;

	webkit_web_frame_load_string(args->frame, contents, NULL,
	    webkit_web_data_source_get_encoding(args->data_src),
	    webkit_web_frame_get_uri(args->frame));
	return (0);
}
예제 #18
0
/* on_load_committed */
static void _on_load_committed(WebKitWebView * view, WebKitWebFrame * frame,
		gpointer data)
{
	GHtml * ghtml;
	char const * location;

	ghtml = g_object_get_data(G_OBJECT(data), "ghtml");
	if(frame == webkit_web_view_get_main_frame(view)
			&& (location = webkit_web_frame_get_uri(frame)) != NULL)
		surfer_set_location(ghtml->surfer, location);
	surfer_set_security(ghtml->surfer, ghtml_get_security(ghtml->widget));
}
예제 #19
0
void juniper_events_page_load_started(WebKitWebView * page, WebKitWebFrame * frame, GtkVBox * tab)
{
    GtkEntry * address_bar;
    const gchar * uri;

    address_bar = juniper_tabs_address_bar_for_tab(tab);
    uri = webkit_web_frame_get_uri(frame);

#ifdef DEBUG
    printf("page load started, uri: %s\n", uri);
#endif

    gtk_entry_set_text(address_bar, uri);
    juniper_history_add(uri, juniper_tabs_get_title(tab));
}
예제 #20
0
/* ghtml_get_favicon */
GdkPixbuf * ghtml_get_favicon(GtkWidget * widget)
{
	GHtml * ghtml;
	WebKitWebFrame * frame;

	ghtml = g_object_get_data(G_OBJECT(widget), "ghtml");
#if WEBKIT_CHECK_VERSION(1, 8, 0)
	if((frame = webkit_web_view_get_main_frame(
					WEBKIT_WEB_VIEW(ghtml->view))) != NULL
			&& webkit_web_frame_get_uri(frame) != NULL)
		return webkit_web_view_try_get_favicon_pixbuf(
				WEBKIT_WEB_VIEW(ghtml->view), 16, 16);
#else
	/* FIXME implement */
#endif
	return NULL;
}
예제 #21
0
void TestRunner::queueLoad(JSStringRef url, JSStringRef target)
{
    GUniquePtr<gchar> relativeURL(JSStringCopyUTF8CString(url));
    SoupURI* baseURI = soup_uri_new(webkit_web_frame_get_uri(mainFrame));
    SoupURI* absoluteURI = soup_uri_new_with_base(baseURI, relativeURL.get());
    soup_uri_free(baseURI);

    if (!absoluteURI) {
        WorkQueue::shared()->queue(new LoadItem(url, target));
        return;
    }

    CString absoluteURIString = soupURIToStringPreservingPassword(absoluteURI);
    JSRetainPtr<JSStringRef> absoluteURL(Adopt, JSStringCreateWithUTF8CString(absoluteURIString.data()));
    WorkQueue::shared()->queue(new LoadItem(absoluteURL.get(), target));
    soup_uri_free(absoluteURI);
}
예제 #22
0
파일: html.c 프로젝트: JackieXie168/chmsee
static void
webkit_web_view_load_committed_cb (WebKitWebView*  web_view,
                                 WebKitWebFrame* web_frame,
                                 Html*     html)
{
		g_object_freeze_notify (G_OBJECT (html));
		const gchar *uri =  webkit_web_frame_get_uri(web_frame);
		g_return_if_fail (uri != NULL);
        g_signal_emit(html, signals[OPEN_URI], 0, g_strdup(uri));
        if (current_url != NULL) {
                g_free(current_url);
                current_url = NULL;
                g_signal_emit(html, signals[LINK_MESSAGE], 0, "");
        }
		g_object_thaw_notify (G_OBJECT (html));

}
예제 #23
0
void FrameLoaderClient::dispatchDidReceiveIcon()
{
    if (m_loadingErrorPage)
        return;

    const gchar* frameURI = webkit_web_frame_get_uri(m_frame);
    WebKitIconDatabase* database = webkit_get_icon_database();
    g_signal_emit_by_name(database, "icon-loaded", m_frame, frameURI);

    WebKitWebView* webView = getViewFromFrame(m_frame);

    // Avoid reporting favicons for non-main frames.
    if (m_frame != webkit_web_view_get_main_frame(webView))
        return;

    g_object_notify(G_OBJECT(webView), "icon-uri");
    g_signal_emit_by_name(webView, "icon-loaded", webkit_web_view_get_icon_uri(webView));
}
예제 #24
0
static void
copy_location_callback (GtkAction *action,
                        gpointer   data)
{
  WebKitWebFrame *frame;
  const gchar    *uri;

  frame = webkit_web_view_get_main_frame (WEBKIT_WEB_VIEW (view));
  uri = webkit_web_frame_get_uri (frame);

  if (uri)
    {
      GtkClipboard *clipboard;

      clipboard = gtk_clipboard_get_for_display (gtk_widget_get_display (view),
                                                 GDK_SELECTION_CLIPBOARD);
      gtk_clipboard_set_text (clipboard, uri, -1);
    }
}
예제 #25
0
/* ghtml_set_favicon */
static void _ghtml_set_favicon(GtkWidget * widget, char const * icon)
{
	GHtml * ghtml;
	GdkPixbuf * pixbuf = NULL;
# if WEBKIT_CHECK_VERSION(1, 8, 0)
	WebKitWebFrame * frame;
# endif

	ghtml = g_object_get_data(G_OBJECT(widget), "ghtml");
# if WEBKIT_CHECK_VERSION(1, 8, 0)
	if((frame = webkit_web_view_get_main_frame(
					WEBKIT_WEB_VIEW(ghtml->view))) != NULL
			&& webkit_web_frame_get_uri(frame) != NULL)
		pixbuf = webkit_web_view_try_get_favicon_pixbuf(
				WEBKIT_WEB_VIEW(ghtml->view), 16, 16);
# else
	/* FIXME implement */
# endif
	surfer_set_favicon(ghtml->surfer, pixbuf);
}
예제 #26
0
static gboolean webViewWindowStateEvent(GtkWidget *widget, GdkEventWindowState *event, WebKitWebView *webView)
{
    if (event->new_window_state & GDK_WINDOW_STATE_FULLSCREEN) {
        WebKitWebFrame *frame = webkit_web_view_get_main_frame(webView);
        const gchar *uri = webkit_web_frame_get_uri(frame);
        GtkWidget *window = gtk_widget_get_toplevel(GTK_WIDGET(webView));
        if (!gtk_widget_is_toplevel(window) || !GTK_IS_WINDOW(window) || GTK_IS_OFFSCREEN_WINDOW(window))
            window = 0;

        GtkWidget *dialog = gtk_message_dialog_new(window ? GTK_WINDOW(window) : 0,
                                                    GTK_DIALOG_MODAL,
                                                    GTK_MESSAGE_INFO,
                                                    GTK_BUTTONS_CLOSE,
                                                    "%s is now full screen. Press ESC or f to exit.", uri);
        g_signal_connect_swapped(dialog, "response", G_CALLBACK(gtk_widget_destroy), dialog);
        g_timeout_add(1500, (GSourceFunc) webViewFullscreenMessageWindowClose, dialog);
        gtk_dialog_run(GTK_DIALOG(dialog));
    }
    return TRUE;
}
예제 #27
0
void LayoutTestController::queueLoad(JSStringRef url, JSStringRef target)
{
    gchar* relativeURL = JSStringCopyUTF8CString(url);
    SoupURI* baseURI = soup_uri_new(webkit_web_frame_get_uri(mainFrame));

    SoupURI* absoluteURI = soup_uri_new_with_base(baseURI, relativeURL);
    soup_uri_free(baseURI);
    g_free(relativeURL);

    gchar* absoluteCString;
    if (absoluteURI) {
        absoluteCString = soup_uri_to_string(absoluteURI, FALSE);
        soup_uri_free(absoluteURI);
    } else
        absoluteCString = JSStringCopyUTF8CString(url);

    JSRetainPtr<JSStringRef> absoluteURL(Adopt, JSStringCreateWithUTF8CString(absoluteCString));
    g_free(absoluteCString);

    WorkQueue::shared()->queue(new LoadItem(absoluteURL.get(), target));
}
예제 #28
0
static void
load_commit_cb (WebKitWebView  *page,
                WebKitWebFrame *frame,
                gpointer        data)
{
    AuthBrowser *browser = AUTH_BROWSER (data);
    AuthBrowserPrivate *priv = GET_PRIVATE (browser);

    const gchar *uri = webkit_web_frame_get_uri(frame);

    g_print ("%s\n", uri);

    if (!priv->stop_url)
        return;

    if (g_str_has_prefix (uri, priv->stop_url)) {
        webkit_web_view_stop_loading (page);
        auth_browser_hide (browser);
        if (priv->callback)
            priv->callback (priv->data, uri);
    }
}
예제 #29
0
static gboolean webViewEnteringFullScreen(WebKitWebView *webView, GObject *element, GtkWidget* vbox)
{
    WebKitWebFrame *frame = webkit_web_view_get_main_frame(webView);
    const gchar *uri = webkit_web_frame_get_uri(frame);
    GtkWidget *window = gtk_widget_get_toplevel(GTK_WIDGET(webView));
    if (!gtk_widget_is_toplevel(window) || !GTK_IS_WINDOW(window) || GTK_IS_OFFSCREEN_WINDOW(window))
        window = 0;

    GtkWidget *dialog = gtk_message_dialog_new(window ? GTK_WINDOW(window) : 0,
                                               GTK_DIALOG_MODAL,
                                               GTK_MESSAGE_INFO,
                                               GTK_BUTTONS_YES_NO,
                                               "Allow full screen display of %s ?", uri);
    gint result = gtk_dialog_run(GTK_DIALOG(dialog));
    if (result == GTK_RESPONSE_YES) {
        gtk_container_foreach(GTK_CONTAINER(vbox), (GtkCallback) hideWidget, NULL);
        gtk_widget_destroy(GTK_WIDGET(dialog));
        return FALSE;
    }
    gtk_widget_destroy(GTK_WIDGET(dialog));
    return TRUE;
}
예제 #30
0
파일: callbacks.c 프로젝트: phddoom/uzbl
void
load_status_change_cb (WebKitWebView* web_view, GParamSpec param_spec) {
    (void) param_spec;

    WebKitWebFrame  *frame;
    WebKitLoadStatus status = webkit_web_view_get_load_status(web_view);
    switch(status) {
        case WEBKIT_LOAD_PROVISIONAL:
            send_event(LOAD_START,  NULL, TYPE_STR, uzbl.state.uri ? uzbl.state.uri : "", NULL);
            break;
        case WEBKIT_LOAD_COMMITTED:
            frame = webkit_web_view_get_main_frame(web_view);
            send_event(LOAD_COMMIT, NULL, TYPE_STR, webkit_web_frame_get_uri (frame), NULL);
            break;
        case WEBKIT_LOAD_FINISHED:
            send_event(LOAD_FINISH, NULL, TYPE_STR, uzbl.state.uri, NULL);
            break;
        case WEBKIT_LOAD_FIRST_VISUALLY_NON_EMPTY_LAYOUT:
            break; /* we don't do anything with this (yet) */
        case WEBKIT_LOAD_FAILED:
            break; /* load_error_cb will handle this case */
    }
}