summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/app/generated_resources.grd6
-rw-r--r--chrome/browser/tab_contents/render_view_context_menu.cc24
2 files changed, 30 insertions, 0 deletions
diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd
index 19f83fd..bec3601 100644
--- a/chrome/app/generated_resources.grd
+++ b/chrome/app/generated_resources.grd
@@ -425,6 +425,9 @@ each locale. -->
<message name="IDS_CONTENT_CONTEXT_UNMUTE" desc="The name of the Unmute command for audio and video playback in the content area context menu">
Un&amp;mute
</message>
+ <message name="IDS_CONTENT_CONTEXT_CONTROLS" desc="The name of the Show Controls command for audio and video playback in the content area context menu">
+ Show &amp;Controls
+ </message>
<message name="IDS_CONTENT_CONTEXT_FULLSCREEN" desc="The name of the Fullscreen command for the video element in the content area context menu">
&amp;Full Screen
@@ -613,6 +616,9 @@ each locale. -->
<message name="IDS_CONTENT_CONTEXT_UNMUTE" desc="In Title Case: The name of the Unmute command for audio and video playback in the content area context menu">
Un&amp;mute
</message>
+ <message name="IDS_CONTENT_CONTEXT_CONTROLS" desc="In Title Case: The name of the Show Controls command for audio and video playback in the content area context menu">
+ Show &amp;Controls
+ </message>
<message name="IDS_CONTENT_CONTEXT_FULLSCREEN" desc="In Title Case: The name of the Fullscreen command for the video element in the content area context menu">
&amp;Full Screen
diff --git a/chrome/browser/tab_contents/render_view_context_menu.cc b/chrome/browser/tab_contents/render_view_context_menu.cc
index 7cf0c86..da20bec 100644
--- a/chrome/browser/tab_contents/render_view_context_menu.cc
+++ b/chrome/browser/tab_contents/render_view_context_menu.cc
@@ -395,6 +395,9 @@ void RenderViewContextMenu::AppendMediaItems() {
AppendCheckboxMenuItem(IDS_CONTENT_CONTEXT_LOOP,
l10n_util::GetStringUTF16(IDS_CONTENT_CONTEXT_LOOP));
+
+ AppendCheckboxMenuItem(IDS_CONTENT_CONTEXT_CONTROLS,
+ l10n_util::GetStringUTF16(IDS_CONTENT_CONTEXT_CONTROLS));
}
void RenderViewContextMenu::AppendPageItems() {
@@ -681,6 +684,13 @@ bool RenderViewContextMenu::IsItemCommandEnabled(int id) const {
(params_.media_flags &
WebContextMenuData::MediaInError) == 0;
+ // Media controls can be toggled only for video player. If we toggle
+ // controls for audio then the player disappears, and there is no way to
+ // return it back.
+ case IDS_CONTENT_CONTEXT_CONTROLS:
+ return (params_.media_flags &
+ WebContextMenuData::MediaHasVideo) != 0;
+
case IDS_CONTENT_CONTEXT_SAVESCREENSHOTAS:
// TODO(ajwong): Enable save screenshot after we actually implement
// this.
@@ -811,6 +821,11 @@ bool RenderViewContextMenu::ItemIsChecked(int id) const {
WebContextMenuData::MediaLoop) != 0;
}
+ if (id == IDS_CONTENT_CONTEXT_CONTROLS) {
+ return (params_.media_flags &
+ WebContextMenuData::MediaControls) != 0;
+ }
+
if (id >= IDC_EXTENSIONS_CONTEXT_CUSTOM_FIRST &&
id <= IDC_EXTENSIONS_CONTEXT_CUSTOM_LAST) {
ExtensionMenuItem* item = GetExtensionMenuItem(id);
@@ -981,6 +996,15 @@ void RenderViewContextMenu::ExecuteItemCommand(int id) {
!ItemIsChecked(IDS_CONTENT_CONTEXT_LOOP)));
break;
+ case IDS_CONTENT_CONTEXT_CONTROLS:
+ UserMetrics::RecordAction(UserMetricsAction("MediaContextMenu_Controls"),
+ profile_);
+ MediaPlayerActionAt(gfx::Point(params_.x, params_.y),
+ WebMediaPlayerAction(
+ WebMediaPlayerAction::Controls,
+ !ItemIsChecked(IDS_CONTENT_CONTEXT_CONTROLS)));
+ break;
+
case IDS_CONTENT_CONTEXT_BACK:
source_tab_contents_->controller().GoBack();
break;