Avoid crash due to missing prerenderer support (issue #608).

git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@657 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
Marshall Greenblatt 2012-05-30 20:35:41 +00:00
parent 5c2e5eab8d
commit dbe75b1326
7 changed files with 32 additions and 0 deletions

View File

@ -13,6 +13,7 @@
#include "base/path_service.h" #include "base/path_service.h"
#include "base/utf_string_conversions.h" #include "base/utf_string_conversions.h"
#include "media/base/media.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/WebDatabase.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebKit.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebKit.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebRuntimeFeatures.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebRuntimeFeatures.h"
@ -23,6 +24,18 @@
#include "webkit/plugins/npapi/plugin_list.h" #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() BrowserWebKitInit::BrowserWebKitInit()
: clipboard_(&clipboard_client_) { : clipboard_(&clipboard_client_) {
v8::V8::SetCounterFunction(base::StatsTable::FindLocation); v8::V8::SetCounterFunction(base::StatsTable::FindLocation);
@ -44,6 +57,9 @@ BrowserWebKitInit::BrowserWebKitInit()
WebKit::WebRuntimeFeatures::enableDeviceMotion(false); WebKit::WebRuntimeFeatures::enableDeviceMotion(false);
WebKit::WebRuntimeFeatures::enableDeviceOrientation(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. // Load libraries for media and enable the media player.
FilePath module_path; FilePath module_path;
WebKit::WebRuntimeFeatures::enableMediaPlayer( WebKit::WebRuntimeFeatures::enableMediaPlayer(

View File

@ -24,6 +24,8 @@
#include "webkit/glue/webfileutilities_impl.h" #include "webkit/glue/webfileutilities_impl.h"
#include "webkit/glue/webkitplatformsupport_impl.h" #include "webkit/glue/webkitplatformsupport_impl.h"
class BrowserPrerenderingSupport;
class BrowserWebKitInit : public webkit_glue::WebKitPlatformSupportImpl { class BrowserWebKitInit : public webkit_glue::WebKitPlatformSupportImpl {
public: public:
BrowserWebKitInit(); BrowserWebKitInit();
@ -108,6 +110,7 @@ class BrowserWebKitInit : public webkit_glue::WebKitPlatformSupportImpl {
BrowserDomStorageSystem dom_storage_system_; BrowserDomStorageSystem dom_storage_system_;
BrowserWebCookieJarImpl cookie_jar_; BrowserWebCookieJarImpl cookie_jar_;
scoped_refptr<BrowserWebBlobRegistryImpl> blob_registry_; scoped_refptr<BrowserWebBlobRegistryImpl> blob_registry_;
scoped_ptr<BrowserPrerenderingSupport> prerendering_support_;
}; };
#endif // CEF_LIBCEF_BROWSER_WEBKIT_INIT_H_ #endif // CEF_LIBCEF_BROWSER_WEBKIT_INIT_H_

View File

@ -509,6 +509,11 @@ bool BrowserWebViewDelegate::allowScriptExtension(
return allowExtension; return allowExtension;
} }
// WebPrerendererClient ------------------------------------------------------
void BrowserWebViewDelegate::willAddPrerender(WebKit::WebPrerender* prerender) {
}
// WebPluginPageDelegate ----------------------------------------------------- // WebPluginPageDelegate -----------------------------------------------------
WebKit::WebPlugin* BrowserWebViewDelegate::CreatePluginReplacement( WebKit::WebPlugin* BrowserWebViewDelegate::CreatePluginReplacement(

View File

@ -28,6 +28,7 @@
#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebFileSystem.h" #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/WebFrameClient.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebPermissionClient.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/platform/WebRect.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebViewClient.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebViewClient.h"
#include "webkit/glue/webcursor.h" #include "webkit/glue/webcursor.h"
@ -60,6 +61,7 @@ class FilePath;
class BrowserWebViewDelegate : public WebKit::WebViewClient, class BrowserWebViewDelegate : public WebKit::WebViewClient,
public WebKit::WebFrameClient, public WebKit::WebFrameClient,
public WebKit::WebPermissionClient, public WebKit::WebPermissionClient,
public WebKit::WebPrerendererClient,
public webkit::npapi::WebPluginPageDelegate, public webkit::npapi::WebPluginPageDelegate,
public base::SupportsWeakPtr<BrowserWebViewDelegate> { public base::SupportsWeakPtr<BrowserWebViewDelegate> {
public: public:
@ -218,6 +220,9 @@ class BrowserWebViewDelegate : public WebKit::WebViewClient,
const WebKit::WebString& extensionName, const WebKit::WebString& extensionName,
int extensionGroup) OVERRIDE; int extensionGroup) OVERRIDE;
// WebKit::WebPrerendererClient
virtual void willAddPrerender(WebKit::WebPrerender* prerender) OVERRIDE;
// webkit_glue::WebPluginPageDelegate // webkit_glue::WebPluginPageDelegate
virtual webkit::npapi::WebPluginDelegate* CreatePluginDelegate( virtual webkit::npapi::WebPluginDelegate* CreatePluginDelegate(
const FilePath& file_path, const FilePath& file_path,

View File

@ -41,6 +41,7 @@ WebViewHost* WebViewHost::Create(GtkWidget* parent_view,
#endif #endif
host->webview()->setDevToolsAgentClient(dev_tools_client); host->webview()->setDevToolsAgentClient(dev_tools_client);
host->webview()->setPermissionClient(delegate); host->webview()->setPermissionClient(delegate);
host->webview()->setPrerendererClient(delegate);
prefs.Apply(host->webview()); prefs.Apply(host->webview());
host->webview()->initializeMainFrame(delegate); host->webview()->initializeMainFrame(delegate);
host->webwidget_->layout(); host->webwidget_->layout();

View File

@ -52,6 +52,7 @@ WebViewHost* WebViewHost::Create(NSView* parent_view,
#endif #endif
host->webview()->setDevToolsAgentClient(dev_tools_client); host->webview()->setDevToolsAgentClient(dev_tools_client);
host->webview()->setPermissionClient(delegate); host->webview()->setPermissionClient(delegate);
host->webview()->setPrerendererClient(delegate);
prefs.Apply(host->webview()); prefs.Apply(host->webview());
host->webview()->initializeMainFrame(delegate); host->webview()->initializeMainFrame(delegate);
host->webwidget_->resize(WebSize(content_rect.size.width, host->webwidget_->resize(WebSize(content_rect.size.width,

View File

@ -61,6 +61,7 @@ WebViewHost* WebViewHost::Create(HWND parent_view,
#endif #endif
host->webview()->setDevToolsAgentClient(dev_tools_client); host->webview()->setDevToolsAgentClient(dev_tools_client);
host->webview()->setPermissionClient(delegate); host->webview()->setPermissionClient(delegate);
host->webview()->setPrerendererClient(delegate);
prefs.Apply(host->webview()); prefs.Apply(host->webview());
host->webview()->initializeMainFrame(delegate); host->webview()->initializeMainFrame(delegate);