diff options
author | zmo@google.com <zmo@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-04-30 23:24:31 +0000 |
---|---|---|
committer | zmo@google.com <zmo@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-04-30 23:24:31 +0000 |
commit | 4166c61b1b71fdd164bd902994db3c3e15252b38 (patch) | |
tree | c1136efc8b0c04cb82b78dfa54054294448b0547 | |
parent | 4275f7b86f58728b4875f0349f06aabf33dc059e (diff) | |
download | chromium_src-4166c61b1b71fdd164bd902994db3c3e15252b38.zip chromium_src-4166c61b1b71fdd164bd902994db3c3e15252b38.tar.gz chromium_src-4166c61b1b71fdd164bd902994db3c3e15252b38.tar.bz2 |
Revert 134620 - Show a replacement plug-in for loading errors.
Below are a few tests that are crashing (the list is not complete):
compositing/plugins/composited-plugin.html
compositing/plugins/1x1-composited-plugin.html
compositing/plugins/small-to-large-composited-plugin.html
compositing/plugins/large-to-small-composited-plugin.html
This allows us to show a nicer placeholder when loading a plug-in fails then the one coming from WebKit.
BUG=123580
TEST=manual
Review URL: http://codereview.chromium.org/10093011
TBR=bauerb@chromium.org
Review URL: https://chromiumcodereview.appspot.com/10274020
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@134630 0039d316-1c4b-4281-b951-d872f2087c98
23 files changed, 11 insertions, 151 deletions
diff --git a/chrome/renderer/chrome_content_renderer_client.cc b/chrome/renderer/chrome_content_renderer_client.cc index 46473c3..12ae141 100644 --- a/chrome/renderer/chrome_content_renderer_client.cc +++ b/chrome/renderer/chrome_content_renderer_client.cc @@ -295,14 +295,6 @@ bool ChromeContentRendererClient::OverrideCreatePlugin( return true; } -WebPlugin* ChromeContentRendererClient::CreatePluginReplacement( - content::RenderView* render_view, - const FilePath& plugin_path) { - PluginPlaceholder* placeholder = - PluginPlaceholder::CreateErrorPlugin(render_view, plugin_path); - return placeholder->plugin(); -} - webkit_media::WebMediaPlayerImpl* ChromeContentRendererClient::OverrideCreateWebMediaPlayer( content::RenderView* render_view, diff --git a/chrome/renderer/chrome_content_renderer_client.h b/chrome/renderer/chrome_content_renderer_client.h index c587e70..c18d866 100644 --- a/chrome/renderer/chrome_content_renderer_client.h +++ b/chrome/renderer/chrome_content_renderer_client.h @@ -58,9 +58,6 @@ class ChromeContentRendererClient : public content::ContentRendererClient { WebKit::WebFrame* frame, const WebKit::WebPluginParams& params, WebKit::WebPlugin** plugin) OVERRIDE; - virtual WebKit::WebPlugin* CreatePluginReplacement( - content::RenderView* render_view, - const FilePath& plugin_path) OVERRIDE; virtual bool HasErrorPage(int http_status_code, std::string* error_domain) OVERRIDE; virtual void GetNavigationErrorStrings( diff --git a/chrome/renderer/plugins/plugin_placeholder.cc b/chrome/renderer/plugins/plugin_placeholder.cc index 595bb98..c0a09a9 100644 --- a/chrome/renderer/plugins/plugin_placeholder.cc +++ b/chrome/renderer/plugins/plugin_placeholder.cc @@ -21,7 +21,6 @@ #include "content/public/renderer/render_view.h" #include "grit/generated_resources.h" #include "grit/renderer_resources.h" -#include "grit/webkit_strings.h" #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebData.h" #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebPoint.h" #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebVector.h" @@ -40,7 +39,6 @@ #include "ui/base/resource/resource_bundle.h" #include "webkit/glue/webpreferences.h" #include "webkit/plugins/npapi/plugin_group.h" -#include "webkit/plugins/npapi/plugin_list.h" #include "webkit/plugins/webview_plugin.h" using content::RenderThread; @@ -99,28 +97,6 @@ PluginPlaceholder* PluginPlaceholder::CreateMissingPlugin( return missing_plugin; } -PluginPlaceholder* PluginPlaceholder::CreateErrorPlugin( - RenderView* render_view, - const FilePath& file_path) { - DictionaryValue values; - values.SetString("message", - l10n_util::GetStringUTF8(IDS_PLUGIN_INITIALIZATION_ERROR)); - - const base::StringPiece template_html( - ResourceBundle::GetSharedInstance().GetRawDataResource( - IDR_BLOCKED_PLUGIN_HTML)); - std::string html_data = - jstemplate_builder::GetI18nTemplateHtml(template_html, &values); - - WebPluginParams params; - // |missing_plugin| will destroy itself when its WebViewPlugin is going away. - PluginPlaceholder* plugin = new PluginPlaceholder( - render_view, NULL, params, html_data, params.mimeType); - plugin->set_allow_loading(true); - - return plugin; -} - // static PluginPlaceholder* PluginPlaceholder::CreateBlockedPlugin( RenderView* render_view, diff --git a/chrome/renderer/plugins/plugin_placeholder.h b/chrome/renderer/plugins/plugin_placeholder.h index 6275284..eb70d35 100644 --- a/chrome/renderer/plugins/plugin_placeholder.h +++ b/chrome/renderer/plugins/plugin_placeholder.h @@ -16,10 +16,10 @@ struct ChromeViewHostMsg_GetPluginInfo_Status; namespace webkit { +struct WebPluginInfo; namespace npapi { class PluginGroup; } -struct WebPluginInfo; } // Placeholders can be used if a plug-in is missing or not available @@ -35,10 +35,6 @@ class PluginPlaceholder : public content::RenderViewObserver, WebKit::WebFrame* frame, const WebKit::WebPluginParams& params); - static PluginPlaceholder* CreateErrorPlugin( - content::RenderView* render_view, - const FilePath& plugin_path); - static PluginPlaceholder* CreateBlockedPlugin( content::RenderView* render_view, WebKit::WebFrame* frame, diff --git a/content/public/renderer/content_renderer_client.h b/content/public/renderer/content_renderer_client.h index 1f6f108..10b5902 100644 --- a/content/public/renderer/content_renderer_client.h +++ b/content/public/renderer/content_renderer_client.h @@ -14,7 +14,6 @@ #include "content/public/common/content_client.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebPageVisibilityState.h" -class FilePath; class GURL; class SkBitmap; @@ -32,7 +31,6 @@ namespace webkit { namespace ppapi { class PpapiInterfaceFactoryManager; } -struct WebPluginInfo; } namespace media { @@ -85,12 +83,6 @@ class ContentRendererClient { const WebKit::WebPluginParams& params, WebKit::WebPlugin** plugin) = 0; - // Creates a replacement plug-in that is shown when the plug-in at |file_path| - // couldn't be loaded. This allows the embedder to show a custom placeholder. - virtual WebKit::WebPlugin* CreatePluginReplacement( - RenderView* render_view, - const FilePath& plugin_path) = 0; - // Returns true if the embedder has an error page to show for the given http // status code. If so |error_domain| should be set to according to WebURLError // and the embedder's GetNavigationErrorHtml will be called afterwards to get diff --git a/content/renderer/mock_content_renderer_client.cc b/content/renderer/mock_content_renderer_client.cc index 664aff1..c86d0ac 100644 --- a/content/renderer/mock_content_renderer_client.cc +++ b/content/renderer/mock_content_renderer_client.cc @@ -37,12 +37,6 @@ bool MockContentRendererClient::OverrideCreatePlugin( return false; } -WebKit::WebPlugin* MockContentRendererClient::CreatePluginReplacement( - RenderView* render_view, - const FilePath& plugin_path) { - return NULL; -} - bool MockContentRendererClient::HasErrorPage(int http_status_code, std::string* error_domain) { return false; diff --git a/content/renderer/mock_content_renderer_client.h b/content/renderer/mock_content_renderer_client.h index 82fae79..dfde022 100644 --- a/content/renderer/mock_content_renderer_client.h +++ b/content/renderer/mock_content_renderer_client.h @@ -27,9 +27,6 @@ class MockContentRendererClient : public ContentRendererClient { WebKit::WebFrame* frame, const WebKit::WebPluginParams& params, WebKit::WebPlugin** plugin) OVERRIDE; - virtual WebKit::WebPlugin* CreatePluginReplacement( - RenderView* render_view, - const FilePath& plugin_path) OVERRIDE; virtual bool HasErrorPage(int http_status_code, std::string* error_domain) OVERRIDE; virtual void GetNavigationErrorStrings( diff --git a/content/renderer/pepper/pepper_plugin_delegate_impl.cc b/content/renderer/pepper/pepper_plugin_delegate_impl.cc index 569f94c..2f7eb8b 100644 --- a/content/renderer/pepper/pepper_plugin_delegate_impl.cc +++ b/content/renderer/pepper/pepper_plugin_delegate_impl.cc @@ -549,12 +549,6 @@ SkBitmap* PepperPluginDelegateImpl::GetSadPluginBitmap() { return GetContentClient()->renderer()->GetSadPluginBitmap(); } -WebKit::WebPlugin* PepperPluginDelegateImpl::CreatePluginReplacement( - const FilePath& file_path) { - return GetContentClient()->renderer()->CreatePluginReplacement( - render_view_, file_path); -} - webkit::ppapi::PluginDelegate::PlatformImage2D* PepperPluginDelegateImpl::CreateImage2D(int width, int height) { return PepperPlatformImage2DImpl::Create(width, height); diff --git a/content/renderer/pepper/pepper_plugin_delegate_impl.h b/content/renderer/pepper/pepper_plugin_delegate_impl.h index b3ebb10..c003a07 100644 --- a/content/renderer/pepper/pepper_plugin_delegate_impl.h +++ b/content/renderer/pepper/pepper_plugin_delegate_impl.h @@ -168,8 +168,6 @@ class PepperPluginDelegateImpl virtual void InstanceDeleted( webkit::ppapi::PluginInstance* instance) OVERRIDE; virtual SkBitmap* GetSadPluginBitmap() OVERRIDE; - virtual WebKit::WebPlugin* CreatePluginReplacement( - const FilePath& file_path) OVERRIDE; virtual uint32_t GetAudioHardwareOutputSampleRate() OVERRIDE; virtual uint32_t GetAudioHardwareOutputBufferSize() OVERRIDE; virtual PlatformAudioOutput* CreateAudioOutput( diff --git a/content/renderer/render_view_impl.cc b/content/renderer/render_view_impl.cc index e207b93..a3696bd 100644 --- a/content/renderer/render_view_impl.cc +++ b/content/renderer/render_view_impl.cc @@ -2135,17 +2135,6 @@ WebPlugin* RenderViewImpl::createPlugin(WebFrame* frame, return CreatePlugin(frame, info, params_to_use); } -WebPlugin* RenderViewImpl::createPluginReplacement( - WebFrame* frame, - const WebPluginParams& params) { - webkit::WebPluginInfo info; - std::string mime_type; - GetPluginInfo(params.url, frame->top()->document().url(), - params.mimeType.utf8(), &info, &mime_type); - return content::GetContentClient()->renderer()->CreatePluginReplacement( - this, info.path); -} - WebSharedWorker* RenderViewImpl::createSharedWorker( WebFrame* frame, const WebURL& url, const WebString& name, unsigned long long document_id) { @@ -3682,12 +3671,6 @@ webkit::npapi::WebPluginDelegate* RenderViewImpl::CreatePluginDelegate( return new WebPluginDelegateProxy(mime_type, AsWeakPtr()); } -WebKit::WebPlugin* RenderViewImpl::CreatePluginReplacement( - const FilePath& file_path) { - return content::GetContentClient()->renderer()->CreatePluginReplacement( - this, file_path); -} - void RenderViewImpl::CreatedPluginWindow(gfx::PluginWindowHandle window) { #if defined(USE_X11) Send(new ViewHostMsg_CreatePluginContainer(routing_id(), window)); diff --git a/content/renderer/render_view_impl.h b/content/renderer/render_view_impl.h index 77264de..9be49ba 100644 --- a/content/renderer/render_view_impl.h +++ b/content/renderer/render_view_impl.h @@ -445,9 +445,6 @@ class RenderViewImpl : public RenderWidget, virtual WebKit::WebPlugin* createPlugin( WebKit::WebFrame* frame, const WebKit::WebPluginParams& params); - virtual WebKit::WebPlugin* createPluginReplacement( - WebKit::WebFrame* frame, - const WebKit::WebPluginParams& params); virtual WebKit::WebSharedWorker* createSharedWorker( WebKit::WebFrame* frame, const WebKit::WebURL& url, const WebKit::WebString& name, unsigned long long documentId); @@ -640,8 +637,6 @@ class RenderViewImpl : public RenderWidget, virtual webkit::npapi::WebPluginDelegate* CreatePluginDelegate( const FilePath& file_path, const std::string& mime_type) OVERRIDE; - virtual WebKit::WebPlugin* CreatePluginReplacement( - const FilePath& file_path) OVERRIDE; virtual void CreatedPluginWindow(gfx::PluginWindowHandle handle) OVERRIDE; virtual void WillDestroyPluginWindow(gfx::PluginWindowHandle handle) OVERRIDE; virtual void DidMovePlugin( diff --git a/content/shell/shell_content_renderer_client.cc b/content/shell/shell_content_renderer_client.cc index ed789b1..2bcb24e 100644 --- a/content/shell/shell_content_renderer_client.cc +++ b/content/shell/shell_content_renderer_client.cc @@ -43,12 +43,6 @@ bool ShellContentRendererClient::OverrideCreatePlugin( return false; } -WebKit::WebPlugin* ShellContentRendererClient::CreatePluginReplacement( - RenderView* render_view, - const FilePath& plugin_path) { - return NULL; -} - bool ShellContentRendererClient::HasErrorPage(int http_status_code, std::string* error_domain) { return false; diff --git a/content/shell/shell_content_renderer_client.h b/content/shell/shell_content_renderer_client.h index 06828ab..a28f4f0 100644 --- a/content/shell/shell_content_renderer_client.h +++ b/content/shell/shell_content_renderer_client.h @@ -28,9 +28,6 @@ class ShellContentRendererClient : public ContentRendererClient { WebKit::WebFrame* frame, const WebKit::WebPluginParams& params, WebKit::WebPlugin** plugin) OVERRIDE; - virtual WebKit::WebPlugin* CreatePluginReplacement( - RenderView* render_view, - const FilePath& plugin_path) OVERRIDE; virtual bool HasErrorPage(int http_status_code, std::string* error_domain) OVERRIDE; virtual void GetNavigationErrorStrings( diff --git a/webkit/plugins/npapi/webplugin_impl.cc b/webkit/plugins/npapi/webplugin_impl.cc index 595f5c9..f776559 100644 --- a/webkit/plugins/npapi/webplugin_impl.cc +++ b/webkit/plugins/npapi/webplugin_impl.cc @@ -256,8 +256,10 @@ bool WebPluginImpl::initialize(WebPluginContainer* container) { WebPluginDelegate* plugin_delegate = page_delegate_->CreatePluginDelegate( file_path_, mime_type_); - if (!plugin_delegate) + if (!plugin_delegate) { + LOG(ERROR) << "Couldn't create plug-in delegate"; return false; + } // Set the container before Initialize because the plugin may // synchronously call NPN_GetValue to get its container during its @@ -268,14 +270,7 @@ bool WebPluginImpl::initialize(WebPluginContainer* container) { if (!ok) { LOG(ERROR) << "Couldn't initialize plug-in"; plugin_delegate->PluginDestroyed(); - - WebKit::WebPlugin* replacement_plugin = - page_delegate_->CreatePluginReplacement(file_path_); - if (!replacement_plugin->initialize(container)) - return false; - - container->setPlugin(replacement_plugin); - return true; + return false; } delegate_ = plugin_delegate; diff --git a/webkit/plugins/npapi/webplugin_page_delegate.h b/webkit/plugins/npapi/webplugin_page_delegate.h index 496bd6f..3176ccd 100644 --- a/webkit/plugins/npapi/webplugin_page_delegate.h +++ b/webkit/plugins/npapi/webplugin_page_delegate.h @@ -1,4 +1,4 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -13,7 +13,6 @@ class FilePath; namespace WebKit { class WebCookieJar; -class WebPlugin; } namespace webkit { @@ -32,10 +31,6 @@ class WebPluginPageDelegate { const FilePath& file_path, const std::string& mime_type) = 0; - // Caled to create a replacement plug-in when loading a plug-in failed. - virtual WebKit::WebPlugin* CreatePluginReplacement( - const FilePath& file_path) = 0; - // Called when a windowed plugin is created. // Lets the view delegate create anything it is using to wrap the plugin. virtual void CreatedPluginWindow( diff --git a/webkit/plugins/ppapi/mock_plugin_delegate.cc b/webkit/plugins/ppapi/mock_plugin_delegate.cc index 7944ac2..12fe0e7 100644 --- a/webkit/plugins/ppapi/mock_plugin_delegate.cc +++ b/webkit/plugins/ppapi/mock_plugin_delegate.cc @@ -50,11 +50,6 @@ SkBitmap* MockPluginDelegate::GetSadPluginBitmap() { return NULL; } -WebKit::WebPlugin* MockPluginDelegate::CreatePluginReplacement( - const FilePath& file_path) { - return NULL; -} - MockPluginDelegate::PlatformImage2D* MockPluginDelegate::CreateImage2D( int width, int height) { diff --git a/webkit/plugins/ppapi/mock_plugin_delegate.h b/webkit/plugins/ppapi/mock_plugin_delegate.h index 93d14a9..e62ecc0 100644 --- a/webkit/plugins/ppapi/mock_plugin_delegate.h +++ b/webkit/plugins/ppapi/mock_plugin_delegate.h @@ -28,7 +28,6 @@ class MockPluginDelegate : public PluginDelegate { virtual void InstanceCreated(PluginInstance* instance); virtual void InstanceDeleted(PluginInstance* instance); virtual SkBitmap* GetSadPluginBitmap(); - virtual WebKit::WebPlugin* CreatePluginReplacement(const FilePath& file_path); virtual PlatformImage2D* CreateImage2D(int width, int height); virtual PlatformContext3D* CreateContext3D(); virtual PlatformVideoDecoder* CreateVideoDecoder( diff --git a/webkit/plugins/ppapi/plugin_delegate.h b/webkit/plugins/ppapi/plugin_delegate.h index 96a9681..1514a96 100644 --- a/webkit/plugins/ppapi/plugin_delegate.h +++ b/webkit/plugins/ppapi/plugin_delegate.h @@ -32,10 +32,10 @@ #include "webkit/quota/quota_types.h" class GURL; -class SkBitmap; -class TransportDIB; struct PP_HostResolver_Private_Hint; struct PP_NetAddress_Private; +class SkBitmap; +class TransportDIB; namespace base { class MessageLoopProxy; @@ -69,7 +69,6 @@ class PlatformCanvas; namespace WebKit { class WebFileChooserCompletion; class WebGamepads; -class WebPlugin; struct WebCursorInfo; struct WebFileChooserParams; } @@ -334,11 +333,6 @@ class PluginDelegate { // sad plugin screen with. Returns NULL on failure. virtual SkBitmap* GetSadPluginBitmap() = 0; - // Creates a replacement plug-in that is shown when the plug-in at |file_path| - // couldn't be loaded. - virtual WebKit::WebPlugin* CreatePluginReplacement( - const FilePath& file_path) = 0; - // The caller will own the pointer returned from this. virtual PlatformImage2D* CreateImage2D(int width, int height) = 0; diff --git a/webkit/plugins/ppapi/ppapi_webplugin_impl.cc b/webkit/plugins/ppapi/ppapi_webplugin_impl.cc index 1c2fe51..fb01662 100644 --- a/webkit/plugins/ppapi/ppapi_webplugin_impl.cc +++ b/webkit/plugins/ppapi/ppapi_webplugin_impl.cc @@ -27,7 +27,6 @@ using ppapi::NPObjectVar; using WebKit::WebCanvas; -using WebKit::WebPlugin; using WebKit::WebPluginContainer; using WebKit::WebPluginParams; using WebKit::WebPoint; @@ -85,15 +84,7 @@ bool WebPluginImpl::initialize(WebPluginContainer* container) { if (!success) { instance_->Delete(); instance_ = NULL; - - WebKit::WebPlugin* replacement_plugin = - init_data_->delegate->CreatePluginReplacement( - init_data_->module->path()); - if (!replacement_plugin->initialize(container)) - return false; - - container->setPlugin(replacement_plugin); - return true; + return false; } init_data_.reset(); diff --git a/webkit/support/test_webplugin_page_delegate.cc b/webkit/support/test_webplugin_page_delegate.cc index 9ec4346..0c54097 100644 --- a/webkit/support/test_webplugin_page_delegate.cc +++ b/webkit/support/test_webplugin_page_delegate.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -19,11 +19,6 @@ TestWebPluginPageDelegate::CreatePluginDelegate( file_path, mime_type, 0); } -WebKit::WebPlugin* TestWebPluginPageDelegate::CreatePluginReplacement( - const FilePath& file_path) { - return NULL; -} - WebKit::WebCookieJar* TestWebPluginPageDelegate::GetCookieJar() { return WebKit::webKitPlatformSupport()->cookieJar(); } diff --git a/webkit/support/test_webplugin_page_delegate.h b/webkit/support/test_webplugin_page_delegate.h index 3949af7..27d8ba3 100644 --- a/webkit/support/test_webplugin_page_delegate.h +++ b/webkit/support/test_webplugin_page_delegate.h @@ -1,4 +1,4 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -20,8 +20,6 @@ class TestWebPluginPageDelegate : public webkit::npapi::WebPluginPageDelegate { virtual webkit::npapi::WebPluginDelegate* CreatePluginDelegate( const FilePath& file_path, const std::string& mime_type) OVERRIDE; - virtual WebKit::WebPlugin* CreatePluginReplacement( - const FilePath& file_path) OVERRIDE; virtual void CreatedPluginWindow(gfx::PluginWindowHandle handle) OVERRIDE {} virtual void WillDestroyPluginWindow( gfx::PluginWindowHandle handle) OVERRIDE {} diff --git a/webkit/tools/test_shell/test_webview_delegate.cc b/webkit/tools/test_shell/test_webview_delegate.cc index 70fae86..9c5d4f9 100644 --- a/webkit/tools/test_shell/test_webview_delegate.cc +++ b/webkit/tools/test_shell/test_webview_delegate.cc @@ -944,11 +944,6 @@ void TestWebViewDelegate::openFileSystem( // WebPluginPageDelegate ----------------------------------------------------- -WebKit::WebPlugin* TestWebViewDelegate::CreatePluginReplacement( - const FilePath& file_path) { - return NULL; -} - WebCookieJar* TestWebViewDelegate::GetCookieJar() { return WebKit::webKitPlatformSupport()->cookieJar(); } diff --git a/webkit/tools/test_shell/test_webview_delegate.h b/webkit/tools/test_shell/test_webview_delegate.h index 435830a..8a87db3 100644 --- a/webkit/tools/test_shell/test_webview_delegate.h +++ b/webkit/tools/test_shell/test_webview_delegate.h @@ -241,8 +241,6 @@ class TestWebViewDelegate : public WebKit::WebViewClient, virtual webkit::npapi::WebPluginDelegate* CreatePluginDelegate( const FilePath& url, const std::string& mime_type) OVERRIDE; - virtual WebKit::WebPlugin* CreatePluginReplacement( - const FilePath& file_path) OVERRIDE; virtual void CreatedPluginWindow( gfx::PluginWindowHandle handle) OVERRIDE; virtual void WillDestroyPluginWindow( |