diff options
author | ananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-04-11 06:24:44 +0000 |
---|---|---|
committer | ananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-04-11 06:24:44 +0000 |
commit | 80be1d88700fff788f873971ee90cba5e813195d (patch) | |
tree | 65c22e9388787dc360c15839de7586d364d7e44a /webkit | |
parent | eb169bacbcdd25706efbe7ddd0117e9766496205 (diff) | |
download | chromium_src-80be1d88700fff788f873971ee90cba5e813195d.zip chromium_src-80be1d88700fff788f873971ee90cba5e813195d.tar.gz chromium_src-80be1d88700fff788f873971ee90cba5e813195d.tar.bz2 |
Removing the Activex shim plugin from the list of default plugins caused some activex shim tests to fail. This basically fails for pages which instantiate the media player like an activex only. To handle this case we attempt to map the clsid to a NPAPI mime type if possible in the shim. If we succeed then the shim is instantiated as an NPAPI plugin as before. It internally loads the media player activex.
Review URL: http://codereview.chromium.org/66072
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@13558 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r-- | webkit/activex_shim/activex_shared.cc | 13 | ||||
-rw-r--r-- | webkit/activex_shim/activex_shared.h | 4 | ||||
-rw-r--r-- | webkit/glue/webframeloaderclient_impl.cc | 25 |
3 files changed, 32 insertions, 10 deletions
diff --git a/webkit/activex_shim/activex_shared.cc b/webkit/activex_shim/activex_shared.cc index c5b06a5..649ce01 100644 --- a/webkit/activex_shim/activex_shared.cc +++ b/webkit/activex_shim/activex_shared.cc @@ -225,4 +225,17 @@ bool IsMimeTypeActiveX(const std::string& mimetype) { LowerCaseEqualsASCII(mimetype, "application/oleobject"); } +bool GetMimeTypeForClsid(const std::string& clsid, std::string* mime_type) { + DCHECK(mime_type != NULL); + + if (!base::strcasecmp(clsid.c_str(), + "6BF52A52-394A-11D3-B153-00C04F79FAA6") || + !base::strcasecmp(clsid.c_str(), + "22D6F312-B0F6-11D0-94AB-0080C74C7E95")) { + *mime_type = "application/x-mplayer2"; + return true; + } + return false; +} + } // namespace activex_shim diff --git a/webkit/activex_shim/activex_shared.h b/webkit/activex_shim/activex_shared.h index 9b34dc9..062dd8d 100644 --- a/webkit/activex_shim/activex_shared.h +++ b/webkit/activex_shim/activex_shared.h @@ -61,6 +61,10 @@ bool IsCodebaseAllowed(const std::string& clsid, const std::string& codebase); // "application/oleobject" bool IsMimeTypeActiveX(const std::string& mimetype); +// Returns the NPAPI mime type for the CLSID passed in. On failure +// return false +bool GetMimeTypeForClsid(const std::string& clsid, std::string* mime_type); + } // namespace activex_shim #endif // #ifndef WEBKIT_ACTIVEX_SHIM_ACTIVEX_SHARED_H__ diff --git a/webkit/glue/webframeloaderclient_impl.cc b/webkit/glue/webframeloaderclient_impl.cc index 29407d9..fb44f4d 100644 --- a/webkit/glue/webframeloaderclient_impl.cc +++ b/webkit/glue/webframeloaderclient_impl.cc @@ -1447,16 +1447,21 @@ Widget* WebFrameLoaderClient::createPlugin(const IntSize& size, // TODO(erikkay) webkit_glue::CStringToStdString(param_values[i].latin1())); } } - // We only allowed specific ActiveX controls to run from certain websites. - if (!activex_shim::IsActiveXAllowed(clsid, url)) - return NULL; - // We need to pass the combined clsid + version to PluginsList, so that it - // would detect if the requested version is installed. If not, it needs - // to use the default plugin to update the control. - if (!version.empty()) - combined_clsid = clsid + "#" + version; - else - combined_clsid = clsid; + + // Attempt to map this clsid to a known NPAPI mime type if possible, failing + // which we attempt to load the activex shim for the clsid. + if (!activex_shim::GetMimeTypeForClsid(clsid, &my_mime_type)) { + // We only allowed specific ActiveX controls to run from certain websites. + if (!activex_shim::IsActiveXAllowed(clsid, url)) + return NULL; + // We need to pass the combined clsid + version to PluginsList, so that it + // would detect if the requested version is installed. If not, it needs + // to use the default plugin to update the control. + if (!version.empty()) + combined_clsid = clsid + "#" + version; + else + combined_clsid = clsid; + } } #endif |