diff options
author | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-04-04 16:01:09 +0000 |
---|---|---|
committer | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-04-04 16:01:09 +0000 |
commit | 96dcc176c46003af0176f0f4772affc741aa772a (patch) | |
tree | b2f46757dc96b8503d4dae36b050c0af30db28a6 /content | |
parent | f66a0ff593d3d4a54c02792e277b70c097fbc0af (diff) | |
download | chromium_src-96dcc176c46003af0176f0f4772affc741aa772a.zip chromium_src-96dcc176c46003af0176f0f4772affc741aa772a.tar.gz chromium_src-96dcc176c46003af0176f0f4772affc741aa772a.tar.bz2 |
When out-of-process PPAPI plugins fail to initialize, don't fall back on trying
to load them as NPAPI.
BUG=78115
Review URL: http://codereview.chromium.org/6771057
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@80317 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content')
-rw-r--r-- | content/renderer/pepper_plugin_delegate_impl.cc | 17 | ||||
-rw-r--r-- | content/renderer/pepper_plugin_delegate_impl.h | 12 | ||||
-rw-r--r-- | content/renderer/render_view.cc | 11 |
3 files changed, 32 insertions, 8 deletions
diff --git a/content/renderer/pepper_plugin_delegate_impl.cc b/content/renderer/pepper_plugin_delegate_impl.cc index 7c94c1e..72fb46d 100644 --- a/content/renderer/pepper_plugin_delegate_impl.cc +++ b/content/renderer/pepper_plugin_delegate_impl.cc @@ -337,7 +337,11 @@ PepperPluginDelegateImpl::~PepperPluginDelegateImpl() { } scoped_refptr<webkit::ppapi::PluginModule> -PepperPluginDelegateImpl::CreatePepperPlugin(const FilePath& path) { +PepperPluginDelegateImpl::CreatePepperPlugin( + const FilePath& path, + bool* pepper_plugin_was_registered) { + *pepper_plugin_was_registered = true; + // See if a module has already been loaded for this plugin. scoped_refptr<webkit::ppapi::PluginModule> module = PepperPluginRegistry::GetInstance()->GetLiveModule(path); @@ -345,12 +349,17 @@ PepperPluginDelegateImpl::CreatePepperPlugin(const FilePath& path) { return module; // In-process plugins will have always been created up-front to avoid the - // sandbox restrictions. So gettin here implies it doesn't exist or should + // sandbox restrictions. So getting here implies it doesn't exist or should // be out of process. const PepperPluginInfo* info = PepperPluginRegistry::GetInstance()->GetInfoForPlugin(path); - if (!info || !info->is_out_of_process) - return module; // Return the NULL module. + if (!info) { + *pepper_plugin_was_registered = false; + return scoped_refptr<webkit::ppapi::PluginModule>(); + } else if (!info->is_out_of_process) { + // In-process plugin not preloaded, it probably couldn't be initialized. + return scoped_refptr<webkit::ppapi::PluginModule>(); + } // Out of process: have the browser start the plugin process for us. base::ProcessHandle plugin_process_handle = base::kNullProcessHandle; diff --git a/content/renderer/pepper_plugin_delegate_impl.h b/content/renderer/pepper_plugin_delegate_impl.h index 2d65ac992..f839229 100644 --- a/content/renderer/pepper_plugin_delegate_impl.h +++ b/content/renderer/pepper_plugin_delegate_impl.h @@ -50,8 +50,18 @@ class PepperPluginDelegateImpl explicit PepperPluginDelegateImpl(RenderView* render_view); virtual ~PepperPluginDelegateImpl(); + // Attempts to create a PPAPI plugin for the given filepath. On success, it + // will return the newly-created module. + // + // There are two reasons for failure. The first is that the plugin isn't + // a PPAPI plugin. In this case, |*pepper_plugin_was_registered| will be set + // to false and the caller may want to fall back on creating an NPAPI plugin. + // the second is that the plugin failed to initialize. In this case, + // |*pepper_plugin_was_registered| will be set to true and the caller should + // not fall back on any other plugin types. scoped_refptr<webkit::ppapi::PluginModule> CreatePepperPlugin( - const FilePath& path); + const FilePath& path, + bool* pepper_plugin_was_registered); // Called by RenderView to tell us about painting events, these two functions // just correspond to the DidInitiatePaint and DidFlushPaint in R.V.. diff --git a/content/renderer/render_view.cc b/content/renderer/render_view.cc index d0cf681..e2d2441 100644 --- a/content/renderer/render_view.cc +++ b/content/renderer/render_view.cc @@ -847,10 +847,15 @@ WebPlugin* RenderView::CreatePluginNoCheck(WebFrame* frame, if (!found || !webkit::npapi::IsPluginEnabled(info)) return NULL; + bool pepper_plugin_was_registered = false; scoped_refptr<webkit::ppapi::PluginModule> pepper_module( - pepper_delegate_.CreatePepperPlugin(info.path)); - if (pepper_module) - return CreatePepperPlugin(frame, params, info.path, pepper_module.get()); + pepper_delegate_.CreatePepperPlugin(info.path, + &pepper_plugin_was_registered)); + if (pepper_plugin_was_registered) { + if (pepper_module) + return CreatePepperPlugin(frame, params, info.path, pepper_module.get()); + return NULL; + } return CreateNPAPIPlugin(frame, params, info.path, mime_type); } |