Commit e62310f4 authored by cpu@chromium.org's avatar cpu@chromium.org

Move the Ash NPAPI plugin blocker logic

To RenderviewCreated, so in theory there we can
catch cases that we are missing, because we have a crash
which is trying to reparent an NPAPI plugin in metro
ash which should not be happening (should be blocked).

BUG=315565
TEST=see bug
R=jam@chromium.org

Review URL: https://codereview.chromium.org/62373004

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@233455 0039d316-1c4b-4281-b951-d872f2087c98
parent 16a13fad
...@@ -182,6 +182,25 @@ PluginObserver::~PluginObserver() { ...@@ -182,6 +182,25 @@ PluginObserver::~PluginObserver() {
#endif #endif
} }
void PluginObserver::RenderViewCreated(
content::RenderViewHost* render_view_host) {
#if defined(USE_AURA) && defined(OS_WIN)
// If the window belongs to the Ash desktop, before we navigate we need
// to tell the renderview that NPAPI plugins are not supported so it does
// not try to instantiate them. The final decision is actually done in
// the IO thread by PluginInfoMessageFilter of this proces,s but it's more
// complex to manage a map of Ash views in PluginInfoMessageFilter than
// just telling the renderer via IPC.
content::WebContentsView* wcv = web_contents()->GetView();
aura::Window* window = wcv->GetNativeView();
if (chrome::GetHostDesktopTypeForNativeView(window) ==
chrome::HOST_DESKTOP_TYPE_ASH) {
int routing_id = render_view_host->GetRoutingID();
render_view_host->Send(new ChromeViewMsg_NPAPINotSupported(routing_id));
}
#endif
}
void PluginObserver::PluginCrashed(const base::FilePath& plugin_path, void PluginObserver::PluginCrashed(const base::FilePath& plugin_path,
base::ProcessId plugin_pid) { base::ProcessId plugin_pid) {
DCHECK(!plugin_path.value().empty()); DCHECK(!plugin_path.value().empty());
...@@ -254,31 +273,6 @@ bool PluginObserver::OnMessageReceived(const IPC::Message& message) { ...@@ -254,31 +273,6 @@ bool PluginObserver::OnMessageReceived(const IPC::Message& message) {
return true; return true;
} }
void PluginObserver::AboutToNavigateRenderView(
content::RenderViewHost* render_view_host) {
#if defined(USE_AURA) && defined(OS_WIN)
// If the window belongs to the Ash desktop, before we navigate we need
// to tell the renderview that NPAPI plugins are not supported so it does
// not try to instantiate them. The final decision is actually done in
// the IO thread by PluginInfoMessageFilter of this proces,s but it's more
// complex to manage a map of Ash views in PluginInfoMessageFilter than
// just telling the renderer via IPC.
if (!web_contents())
return;
content::WebContentsView* wcv = web_contents()->GetView();
if (!wcv)
return;
aura::Window* window = wcv->GetNativeView();
if (chrome::GetHostDesktopTypeForNativeView(window) ==
chrome::HOST_DESKTOP_TYPE_ASH) {
int routing_id = render_view_host->GetRoutingID();
render_view_host->Send(new ChromeViewMsg_NPAPINotSupported(routing_id));
}
#endif
}
void PluginObserver::OnBlockedUnauthorizedPlugin( void PluginObserver::OnBlockedUnauthorizedPlugin(
const string16& name, const string16& name,
const std::string& identifier) { const std::string& identifier) {
......
...@@ -34,11 +34,11 @@ class PluginObserver : public content::WebContentsObserver, ...@@ -34,11 +34,11 @@ class PluginObserver : public content::WebContentsObserver,
virtual ~PluginObserver(); virtual ~PluginObserver();
// content::WebContentsObserver implementation. // content::WebContentsObserver implementation.
virtual void RenderViewCreated(
content::RenderViewHost* render_view_host) OVERRIDE;
virtual void PluginCrashed(const base::FilePath& plugin_path, virtual void PluginCrashed(const base::FilePath& plugin_path,
base::ProcessId plugin_pid) OVERRIDE; base::ProcessId plugin_pid) OVERRIDE;
virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
virtual void AboutToNavigateRenderView(
content::RenderViewHost* render_view_host) OVERRIDE;
private: private:
explicit PluginObserver(content::WebContents* web_contents); explicit PluginObserver(content::WebContents* web_contents);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment