summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorscherkus@chromium.org <scherkus@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-20 21:28:17 +0000
committerscherkus@chromium.org <scherkus@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-20 21:28:17 +0000
commitbdaa1b75f4585b79cf64788f4011e39b01bdfabf (patch)
treeae28f297eb34366fc62ec659bb2cc88ed0c9be8b /chrome
parent527f0441b0a66b5d3032a58b1dcdae696268b177 (diff)
downloadchromium_src-bdaa1b75f4585b79cf64788f4011e39b01bdfabf.zip
chromium_src-bdaa1b75f4585b79cf64788f4011e39b01bdfabf.tar.gz
chromium_src-bdaa1b75f4585b79cf64788f4011e39b01bdfabf.tar.bz2
Disable mute/unmute when media does not have an audio track.
BUG=18970 TEST=test matrix videos ending in 0 should have mute context menu disabled Review URL: http://codereview.chromium.org/174018 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@23889 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/tab_contents/render_view_context_menu.cc9
-rw-r--r--chrome/common/render_messages.h4
2 files changed, 10 insertions, 3 deletions
diff --git a/chrome/browser/tab_contents/render_view_context_menu.cc b/chrome/browser/tab_contents/render_view_context_menu.cc
index 75d02c0..62cfdbc 100644
--- a/chrome/browser/tab_contents/render_view_context_menu.cc
+++ b/chrome/browser/tab_contents/render_view_context_menu.cc
@@ -317,12 +317,17 @@ bool RenderViewContextMenu::IsItemCommandEnabled(int id) const {
// error state.
case IDS_CONTENT_CONTEXT_PLAY:
case IDS_CONTENT_CONTEXT_PAUSE:
- case IDS_CONTENT_CONTEXT_MUTE:
- case IDS_CONTENT_CONTEXT_UNMUTE:
case IDS_CONTENT_CONTEXT_LOOP:
return (params_.media_params.player_state &
ContextMenuMediaParams::IN_ERROR) == 0;
+ // Mute and unmute should also be disabled if the player has no audio.
+ case IDS_CONTENT_CONTEXT_MUTE:
+ case IDS_CONTENT_CONTEXT_UNMUTE:
+ return params_.media_params.has_audio &&
+ (params_.media_params.player_state &
+ ContextMenuMediaParams::IN_ERROR) == 0;
+
case IDS_CONTENT_CONTEXT_SAVESCREENSHOTAS:
// TODO(ajwong): Enable save screenshot after we actually implement
// this.
diff --git a/chrome/common/render_messages.h b/chrome/common/render_messages.h
index ee8c751..af0e901 100644
--- a/chrome/common/render_messages.h
+++ b/chrome/common/render_messages.h
@@ -879,10 +879,12 @@ struct ParamTraits<ContextMenuMediaParams> {
typedef ContextMenuMediaParams param_type;
static void Write(Message* m, const param_type& p) {
WriteParam(m, p.player_state);
+ WriteParam(m, p.has_audio);
}
static bool Read(const Message* m, void** iter, param_type* p) {
return
- ReadParam(m, iter, &p->player_state);
+ ReadParam(m, iter, &p->player_state) &&
+ ReadParam(m, iter, &p->has_audio);
}
};