summaryrefslogtreecommitdiffstats
path: root/chrome/browser
diff options
context:
space:
mode:
authorscherkus@chromium.org <scherkus@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-31 02:52:04 +0000
committerscherkus@chromium.org <scherkus@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-31 02:52:04 +0000
commit19cde896841c99ad5c016c79abf8d2d49517fb68 (patch)
tree90b4df7971a5902f2d1ce2bae2131a464c4752fb /chrome/browser
parent0ee84fc076751138ff80f6c8a253a06e24fe5ef8 (diff)
downloadchromium_src-19cde896841c99ad5c016c79abf8d2d49517fb68.zip
chromium_src-19cde896841c99ad5c016c79abf8d2d49517fb68.tar.gz
chromium_src-19cde896841c99ad5c016c79abf8d2d49517fb68.tar.bz2
Added item to Show/Hide video controls in the context menu for <video>.
Patch by sergeyu@chromium.org http://codereview.chromium.org/1081011/show BUG=19848 TEST=Right-click on video, toggle "Show Controls". For audio the item must be disabled. Review URL: http://codereview.chromium.org/1589003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@43172 0039d316-1c4b-4281-b951-d872f2087c98
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;