Пример #1
0
bool PageClientImpl::decidePolicyForInstallMissingMediaPluginsPermissionRequest(InstallMissingMediaPluginsPermissionRequest& request)
{
    if (!WEBKIT_IS_WEB_VIEW(m_viewWidget))
        return false;

    webkitWebViewRequestInstallMissingMediaPlugins(WEBKIT_WEB_VIEW(m_viewWidget), request);
    return true;
}
Пример #2
0
EEditorSelection *
e_editor_selection_new (WebKitWebView *parent_view)
{
	g_return_val_if_fail (WEBKIT_IS_WEB_VIEW (parent_view), NULL);

	return g_object_new (
			E_TYPE_EDITOR_SELECTION,
			"webview", parent_view, NULL);
}
Пример #3
0
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;
}
Пример #4
0
/* Edit->Copy */
void
action_copy(GtkAction *action, I7Document *document)
{
	GtkWidget *widget = gtk_window_get_focus(GTK_WINDOW(document));

	/* What actually happens depends on the type of widget that is focused */
	if(WEBKIT_IS_WEB_VIEW(widget))
		webkit_web_view_copy_clipboard(WEBKIT_WEB_VIEW(widget));
	else if((GTK_IS_LABEL(widget) && gtk_label_get_selectable(GTK_LABEL(widget)))
		|| GTK_IS_ENTRY(widget) || GTK_IS_TEXT_VIEW(widget))
		g_signal_emit_by_name(widget, "copy-clipboard", NULL);
	else /* If we don't know how to copy from it, just copy from the source */
		g_signal_emit_by_name(i7_document_get_default_view(document), "copy-clipboard", NULL);
}
Пример #5
0
// Public API.
GtkWidget *browser_window_new(WebKitWebView *view, GtkWindow *parent)
{
    g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(view), 0);

    BrowserWindow *window = BROWSER_WINDOW(g_object_new(BROWSER_TYPE_WINDOW,
        "type", GTK_WINDOW_TOPLEVEL, "view", view, NULL));

    if (parent) {
        window->parentWindow = parent;
        g_object_add_weak_pointer(G_OBJECT(parent), (gpointer *)&window->parentWindow);
    }

    return GTK_WIDGET(window);
}
Пример #6
0
gchar *document_webkit_get_title(Document_Webkit *doc)
{
  gphpedit_debug (DEBUG_DOCUMENT);
  if (!doc) return NULL;
  Document_WebkitDetails *docdet = DOCUMENT_WEBKIT_GET_PRIVATE(doc);
  GString *title= NULL;
  if( WEBKIT_IS_WEB_VIEW(docdet->help_view)){
      gchar *short_filename;
      g_object_get(doc, "short_filename", &short_filename, NULL);
      title = g_string_new(short_filename);
      g_string_append(title, _(" - gPHPEdit"));
  }
  if (title) return g_string_free(title, FALSE);
  return NULL;
}
Пример #7
0
void
gb_webkit_web_view_apply_settings (WebKitWebView *view)
{
  g_return_if_fail (WEBKIT_IS_WEB_VIEW (view));

  /*
   * TODO: Consider whether HTML5 local storage should be enabled. It could only
   * possibly be useful for complex web sites, but if you're building a web site
   * with Builder then it might be useful to have. But leave disabled until
   * https://bugs.webkit.org/show_bug.cgi?id=143245 has been fixed.
   */
  g_object_set (webkit_web_view_get_settings (view),
                "enable-html5-local-storage", FALSE,
                NULL);
}
Пример #8
0
/* Edit->Select All */
void
action_select_all(GtkAction *action, I7Document *document)
{
	GtkWidget *widget = gtk_window_get_focus(GTK_WINDOW(document));

	/* What actually happens depends on the type of widget that is focused */
	if(WEBKIT_IS_WEB_VIEW(widget))
		webkit_web_view_select_all(WEBKIT_WEB_VIEW(widget));
	else if(GTK_IS_LABEL(widget) && gtk_label_get_selectable(GTK_LABEL(widget)))
		gtk_label_select_region(GTK_LABEL(widget), 0, -1);
	else if(GTK_IS_EDITABLE(widget))
		gtk_editable_select_region(GTK_EDITABLE(widget), 0, -1);
	else if(GTK_IS_TEXT_VIEW(widget))
		g_signal_emit_by_name(widget, "select-all", TRUE, NULL);
	else /* If we don't know how to select it, just select all in the source */
		g_signal_emit_by_name(i7_document_get_default_view(document), "select-all", TRUE, NULL);
}
/* Status of loading a site has changed */
static void _interface_tweaks_on_notify_view_load_status(InterfaceTweaks *self, GParamSpec *inSpec, gpointer inUserData)
{
	g_return_if_fail(IS_INTERFACE_TWEAKS(self));
	g_return_if_fail(WEBKIT_IS_WEB_VIEW(inUserData));

	InterfaceTweaksPrivate	*priv=self->priv;
	WebKitWebView			*webkitView=WEBKIT_WEB_VIEW(inUserData);
	WebKitLoadStatus		status;

	/* Check load status */ 
	status=webkit_web_view_get_load_status(webkitView);

	/* If webview was prepared to start network request */
	if(status==WEBKIT_LOAD_PROVISIONAL)
	{
		/* Show start-request throbber now if set */
		if(priv->showStartRequestThrobber)
		{
			MidoriView		*view;
			KatzeThrobber	*throbber;

			/* Get Midori view and the size for icon in tab */
			view=midori_view_get_for_widget(GTK_WIDGET(webkitView));

			/* Start throbber animation of view */
			throbber=_interface_tweaks_find_view_throbber(view);
			if(throbber) katze_throbber_set_animated(throbber, TRUE);
		}
	}

	/* First data of network response has been sent or first data of
	 * network response has been received
	 */
	if(status==WEBKIT_LOAD_COMMITTED)
	{
		const gchar			*uri;

		/* Get URI for current request */
		uri=webkit_web_view_get_uri(webkitView);

		/* Add URI to completion model */
		_interface_tweaks_add_uri_to_completion_model(self, uri);
	}
}
Пример #10
0
gulong
cog_web_view_connect_web_process_terminated_restart_handler (WebKitWebView *web_view,
                                                             unsigned       max_tries,
                                                             unsigned       try_window_ms)
{
    g_return_val_if_fail (WEBKIT_IS_WEB_VIEW (web_view), 0);
    g_return_val_if_fail (max_tries > 0, 0);

    struct RestartData *restart = g_slice_new0 (struct RestartData);
    restart->max_tries = max_tries;
    restart->try_window_ms = try_window_ms;

    return g_signal_connect_data (web_view,
                                  "web-process-terminated",
                                  G_CALLBACK (on_web_process_terminated_restart),
                                  restart,
                                  free_restart_data,
                                  0);
}
Пример #11
0
static void
hovering_over_link (WebKitWebView *web_view,
                    const gchar   *title,
                    const gchar   *uri,
                    gpointer       user_data)
{
  MarinaWindow *window;
  static guint cid = 0;
  
  g_return_if_fail (WEBKIT_IS_WEB_VIEW (web_view));
  
  window = MARINA_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (web_view)));

  if (!cid)
    cid = gtk_statusbar_get_context_id (GTK_STATUSBAR (window->priv->statusbar), "html-link");
  
  gtk_statusbar_pop (GTK_STATUSBAR (window->priv->statusbar), cid);
  
  if (uri)
    gtk_statusbar_push (GTK_STATUSBAR (window->priv->statusbar), cid, uri);
}
Пример #12
0
/**
 * A link has been clicked
 *
 * When a link has been clicked the link management is dispatched to Liferea
 * core in order to manage the different filetypes, remote URLs.
 */
static gboolean
liferea_webkit_link_clicked (WebKitWebView *view,
			     WebKitWebFrame *frame,
			     WebKitNetworkRequest *request,
			     WebKitWebNavigationAction *navigation_action,
			     WebKitWebPolicyDecision *policy_decision)
{
	const gchar			*uri;
	WebKitWebNavigationReason	reason;
	gboolean			url_handled;

	g_return_val_if_fail (WEBKIT_IS_WEB_VIEW (view), FALSE);
	g_return_val_if_fail (WEBKIT_IS_NETWORK_REQUEST (request), FALSE);

	reason = webkit_web_navigation_action_get_reason (navigation_action);

	/* iframes in items return WEBKIT_WEB_NAVIGATION_REASON_OTHER
	   and shouldn't be handled as clicks                          */
	if (reason != WEBKIT_WEB_NAVIGATION_REASON_LINK_CLICKED)
		return FALSE;

	uri = webkit_network_request_get_uri (request);

	if (webkit_web_navigation_action_get_button (navigation_action) == 2) { /* middle click */
		browser_tabs_add_new (uri, uri, FALSE);
		webkit_web_policy_decision_ignore (policy_decision);
		return TRUE;
	}

	url_handled = liferea_htmlview_handle_URL (g_object_get_data (G_OBJECT (view), "htmlview"), uri);

	if (url_handled)
		webkit_web_policy_decision_ignore (policy_decision);

	return url_handled;
}
Пример #13
0
void PageClientImpl::selectionDidChange()
{
    webkitWebViewBaseUpdateTextInputState(WEBKIT_WEB_VIEW_BASE(m_viewWidget));
    if (WEBKIT_IS_WEB_VIEW(m_viewWidget))
        webkitWebViewSelectionDidChange(WEBKIT_WEB_VIEW(m_viewWidget));
}
Пример #14
0
RefPtr<WebColorPicker> PageClientImpl::createColorPicker(WebPageProxy* page, const WebCore::Color& color, const WebCore::IntRect& rect)
{
    if (WEBKIT_IS_WEB_VIEW(m_viewWidget))
        return WebKitColorChooser::create(*page, color, rect);
    return WebColorPickerGtk::create(*page, color, rect);
}