diff options
author | ananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-11-17 19:44:36 +0000 |
---|---|---|
committer | ananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-11-17 19:44:36 +0000 |
commit | ddda69148bc587dfc093e162998aa2ef89172dd3 (patch) | |
tree | b00672c5bab746bf80b3bca20b48c6f8c3b43f13 /webkit | |
parent | 5fbe37561634943cdcbb3de9664d4d08d7cd17fd (diff) | |
download | chromium_src-ddda69148bc587dfc093e162998aa2ef89172dd3.zip chromium_src-ddda69148bc587dfc093e162998aa2ef89172dd3.tar.gz chromium_src-ddda69148bc587dfc093e162998aa2ef89172dd3.tar.bz2 |
Translate volume information passed to the instance of Windows media player
instantiated by the Activex shim. The Activex shim gets instantiated as a NPAPI
plugin, which hosts the Media player activex. Volume defaults differ between the media player NPAPI plugin and the Activex.
Fixes bug http://code.google.com/p/chromium/issues/detail?id=1163
R=amit
Bug=1163
Review URL: http://codereview.chromium.org/11409
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@5563 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r-- | webkit/activex_shim/activex_plugin.cc | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/webkit/activex_shim/activex_plugin.cc b/webkit/activex_shim/activex_plugin.cc index 33d417e..ae638a3 100644 --- a/webkit/activex_shim/activex_plugin.cc +++ b/webkit/activex_shim/activex_plugin.cc @@ -93,12 +93,28 @@ void ActiveXPlugin::ConvertForEmbeddedWmp() { ControlParam* existing_url_param = NULL; std::wstring src; // Find the src parameter and use it to add a new url parameter. + // Find the volume parameter and setup defaults which make sense in + // the Activex media player world. for (unsigned int i = 0; i < params_.size(); i++) { - if (LowerCaseEqualsASCII(params_[i].name, "src")) + if (LowerCaseEqualsASCII(params_[i].name, "src")) { src = params_[i].value; - else if (LowerCaseEqualsASCII(params_[i].name, "url")) + } else if (LowerCaseEqualsASCII(params_[i].name, "url")) { existing_url_param = ¶ms_[i]; + } else if (LowerCaseEqualsASCII(params_[i].name, "volume")) { + // In the NPAPI media player world a volume value lesser than + // -3000 turns off the volume. A volume value of 0 indicates + // full volume. Translate these to their Activex counterparts. + int specified_volume = 0; + if (StringToInt(params_[i].value, &specified_volume)) { + // Valid volume lies between 0 and -3000 + specified_volume = std::min (0, std::max(-3000, specified_volume)); + // Translate to a value between 0 and 100. + int activex_volume = specified_volume / 30 + 100; + params_[i].value = IntToWString(activex_volume); + } + } } + if (!src.empty()) { if (existing_url_param == NULL) params_.push_back(ControlParam(L"url", src)); |