summaryrefslogtreecommitdiffstats
path: root/chrome/browser
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser')
-rw-r--r--chrome/browser/tab_contents/render_view_context_menu.cc24
1 files changed, 24 insertions, 0 deletions
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;