Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1050)

Unified Diff: webkit/activex_shim/activex_plugin.cc

Issue 11409: Translate volume information passed to the instance of Windows media player... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 12 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/activex_shim/activex_plugin.cc
===================================================================
--- webkit/activex_shim/activex_plugin.cc (revision 5528)
+++ webkit/activex_shim/activex_plugin.cc (working copy)
@@ -93,12 +93,28 @@
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 = &params_[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));
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698