diff --git a/cef1/libcef/browser_webkit_init.cc b/cef1/libcef/browser_webkit_init.cc index ccfa443ab..a38e2e053 100644 --- a/cef1/libcef/browser_webkit_init.cc +++ b/cef1/libcef/browser_webkit_init.cc @@ -13,6 +13,7 @@ #include "base/path_service.h" #include "base/utf_string_conversions.h" #include "media/base/media.h" +#include "third_party/WebKit/Source/Platform/chromium/public/WebPrerenderingSupport.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebDatabase.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebKit.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebRuntimeFeatures.h" @@ -23,6 +24,18 @@ #include "webkit/plugins/npapi/plugin_list.h" +// Stub implementation of WebKit::WebPrerenderingSupport. +class BrowserPrerenderingSupport : public WebKit::WebPrerenderingSupport { + public: + virtual ~BrowserPrerenderingSupport() {} + + private: + virtual void add(const WebKit::WebPrerender& prerender) OVERRIDE {} + virtual void cancel(const WebKit::WebPrerender& prerender) OVERRIDE {} + virtual void abandon(const WebKit::WebPrerender& prerender) OVERRIDE {} +}; + + BrowserWebKitInit::BrowserWebKitInit() : clipboard_(&clipboard_client_) { v8::V8::SetCounterFunction(base::StatsTable::FindLocation); @@ -44,6 +57,9 @@ BrowserWebKitInit::BrowserWebKitInit() WebKit::WebRuntimeFeatures::enableDeviceMotion(false); WebKit::WebRuntimeFeatures::enableDeviceOrientation(false); + prerendering_support_.reset(new BrowserPrerenderingSupport); + WebKit::WebPrerenderingSupport::initialize(prerendering_support_.get()); + // Load libraries for media and enable the media player. FilePath module_path; WebKit::WebRuntimeFeatures::enableMediaPlayer( diff --git a/cef1/libcef/browser_webkit_init.h b/cef1/libcef/browser_webkit_init.h index 246306e3b..0a5d63d3a 100644 --- a/cef1/libcef/browser_webkit_init.h +++ b/cef1/libcef/browser_webkit_init.h @@ -24,6 +24,8 @@ #include "webkit/glue/webfileutilities_impl.h" #include "webkit/glue/webkitplatformsupport_impl.h" +class BrowserPrerenderingSupport; + class BrowserWebKitInit : public webkit_glue::WebKitPlatformSupportImpl { public: BrowserWebKitInit(); @@ -108,6 +110,7 @@ class BrowserWebKitInit : public webkit_glue::WebKitPlatformSupportImpl { BrowserDomStorageSystem dom_storage_system_; BrowserWebCookieJarImpl cookie_jar_; scoped_refptr blob_registry_; + scoped_ptr prerendering_support_; }; #endif // CEF_LIBCEF_BROWSER_WEBKIT_INIT_H_ diff --git a/cef1/libcef/browser_webview_delegate.cc b/cef1/libcef/browser_webview_delegate.cc index 5ad995e1a..f816e9e6e 100644 --- a/cef1/libcef/browser_webview_delegate.cc +++ b/cef1/libcef/browser_webview_delegate.cc @@ -509,6 +509,11 @@ bool BrowserWebViewDelegate::allowScriptExtension( return allowExtension; } +// WebPrerendererClient ------------------------------------------------------ + +void BrowserWebViewDelegate::willAddPrerender(WebKit::WebPrerender* prerender) { +} + // WebPluginPageDelegate ----------------------------------------------------- WebKit::WebPlugin* BrowserWebViewDelegate::CreatePluginReplacement( diff --git a/cef1/libcef/browser_webview_delegate.h b/cef1/libcef/browser_webview_delegate.h index b198edaea..2893e1618 100644 --- a/cef1/libcef/browser_webview_delegate.h +++ b/cef1/libcef/browser_webview_delegate.h @@ -28,6 +28,7 @@ #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebFileSystem.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrameClient.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebPermissionClient.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebPrerendererClient.h" #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebRect.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebViewClient.h" #include "webkit/glue/webcursor.h" @@ -60,6 +61,7 @@ class FilePath; class BrowserWebViewDelegate : public WebKit::WebViewClient, public WebKit::WebFrameClient, public WebKit::WebPermissionClient, + public WebKit::WebPrerendererClient, public webkit::npapi::WebPluginPageDelegate, public base::SupportsWeakPtr { public: @@ -218,6 +220,9 @@ class BrowserWebViewDelegate : public WebKit::WebViewClient, const WebKit::WebString& extensionName, int extensionGroup) OVERRIDE; + // WebKit::WebPrerendererClient + virtual void willAddPrerender(WebKit::WebPrerender* prerender) OVERRIDE; + // webkit_glue::WebPluginPageDelegate virtual webkit::npapi::WebPluginDelegate* CreatePluginDelegate( const FilePath& file_path, diff --git a/cef1/libcef/webview_host_gtk.cc b/cef1/libcef/webview_host_gtk.cc index 4c78980ee..829619c8b 100644 --- a/cef1/libcef/webview_host_gtk.cc +++ b/cef1/libcef/webview_host_gtk.cc @@ -41,6 +41,7 @@ WebViewHost* WebViewHost::Create(GtkWidget* parent_view, #endif host->webview()->setDevToolsAgentClient(dev_tools_client); host->webview()->setPermissionClient(delegate); + host->webview()->setPrerendererClient(delegate); prefs.Apply(host->webview()); host->webview()->initializeMainFrame(delegate); host->webwidget_->layout(); diff --git a/cef1/libcef/webview_host_mac.mm b/cef1/libcef/webview_host_mac.mm index d22a2108f..cb4e93127 100644 --- a/cef1/libcef/webview_host_mac.mm +++ b/cef1/libcef/webview_host_mac.mm @@ -52,6 +52,7 @@ WebViewHost* WebViewHost::Create(NSView* parent_view, #endif host->webview()->setDevToolsAgentClient(dev_tools_client); host->webview()->setPermissionClient(delegate); + host->webview()->setPrerendererClient(delegate); prefs.Apply(host->webview()); host->webview()->initializeMainFrame(delegate); host->webwidget_->resize(WebSize(content_rect.size.width, diff --git a/cef1/libcef/webview_host_win.cc b/cef1/libcef/webview_host_win.cc index 9b7d22050..a10629cb2 100644 --- a/cef1/libcef/webview_host_win.cc +++ b/cef1/libcef/webview_host_win.cc @@ -61,6 +61,7 @@ WebViewHost* WebViewHost::Create(HWND parent_view, #endif host->webview()->setDevToolsAgentClient(dev_tools_client); host->webview()->setPermissionClient(delegate); + host->webview()->setPrerendererClient(delegate); prefs.Apply(host->webview()); host->webview()->initializeMainFrame(delegate);