aboutsummaryrefslogtreecommitdiffstats
path: root/embed/ephy-web-view.c
diff options
context:
space:
mode:
authorGustavo Noronha Silva <gns@gnome.org>2013-02-10 02:43:02 +0800
committerGustavo Noronha Silva <gns@gnome.org>2013-02-12 23:55:51 +0800
commitce7ab1e34804d9f7529bed13267f4619c37e32d9 (patch)
tree69f2a2e2dbce017980352b1afd57e1b38c8f278b /embed/ephy-web-view.c
parent551eb0cec6469ece8e826411d65bf806ec043142 (diff)
downloadgsoc2013-epiphany-ce7ab1e34804d9f7529bed13267f4619c37e32d9.tar
gsoc2013-epiphany-ce7ab1e34804d9f7529bed13267f4619c37e32d9.tar.gz
gsoc2013-epiphany-ce7ab1e34804d9f7529bed13267f4619c37e32d9.tar.bz2
gsoc2013-epiphany-ce7ab1e34804d9f7529bed13267f4619c37e32d9.tar.lz
gsoc2013-epiphany-ce7ab1e34804d9f7529bed13267f4619c37e32d9.tar.xz
gsoc2013-epiphany-ce7ab1e34804d9f7529bed13267f4619c37e32d9.tar.zst
gsoc2013-epiphany-ce7ab1e34804d9f7529bed13267f4619c37e32d9.zip
Only load pages when their tab is switched to upon session restore
Firefox has led the way implementing this behaviour to improve the experience of restoring a session with lots of tabs. By delaying the loading of pages to when the user shows interest in them, the time it takes for the browser to become usable is diminished, and less pages are loaded in parallel, which improves load time for the first pages the user sees. It also has the advante of displaying less HTTP Basic Auth dialogs, when the user has many tabs pointed to the same server. https://bugzilla.gnome.org/show_bug.cgi?id=675302
Diffstat (limited to 'embed/ephy-web-view.c')
-rw-r--r--embed/ephy-web-view.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/embed/ephy-web-view.c b/embed/ephy-web-view.c
index 84580d056..c3594ee61 100644
--- a/embed/ephy-web-view.c
+++ b/embed/ephy-web-view.c
@@ -2370,6 +2370,44 @@ load_status_cb (WebKitWebView *web_view,
#endif
/**
+ * ephy_web_view_set_placeholder:
+ * @view: an #EphyWebView
+ * @uri: uri that will eventually be loaded
+ * @title: last-known title of the page that will eventually be loaded
+ *
+ * Makes the #EphyWebView pretend a page that will eventually be loaded is
+ * already there.
+ *
+ **/
+void
+ephy_web_view_set_placeholder (EphyWebView *view,
+ const char *uri,
+ const char *title)
+{
+ char *html;
+
+ g_return_if_fail (EPHY_IS_WEB_VIEW (view));
+
+ /* We want only the actual load to be the one recorded in history, but
+ * doing a load here is the simplest way to replace the loading
+ * spinner with the favicon. */
+ ephy_web_view_freeze_history (view);
+
+ html = g_markup_printf_escaped ("<head><title>%s</title></head>", title);
+
+#ifdef HAVE_WEBKIT2
+ webkit_web_view_load_alternate_html (WEBKIT_WEB_VIEW (view), html, uri, NULL);
+#else
+ webkit_web_frame_load_alternate_string (webkit_web_view_get_main_frame (WEBKIT_WEB_VIEW (view)),
+ html, uri, uri);
+#endif
+
+ g_free (html);
+
+ ephy_web_view_set_address (view, uri);
+}
+
+/**
* ephy_web_view_load_error_page:
* @view: an #EphyWebView
* @uri: uri that caused the failure