OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/renderer_context_menu/render_view_context_menu.h" | 5 #include "chrome/browser/renderer_context_menu/render_view_context_menu.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <set> | 8 #include <set> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 1235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1246 return (params_.media_flags & | 1246 return (params_.media_flags & |
1247 WebContextMenuData::MediaInError) == 0; | 1247 WebContextMenuData::MediaInError) == 0; |
1248 | 1248 |
1249 // Mute and unmute should also be disabled if the player has no audio. | 1249 // Mute and unmute should also be disabled if the player has no audio. |
1250 case IDC_CONTENT_CONTEXT_MUTE: | 1250 case IDC_CONTENT_CONTEXT_MUTE: |
1251 return (params_.media_flags & | 1251 return (params_.media_flags & |
1252 WebContextMenuData::MediaHasAudio) != 0 && | 1252 WebContextMenuData::MediaHasAudio) != 0 && |
1253 (params_.media_flags & | 1253 (params_.media_flags & |
1254 WebContextMenuData::MediaInError) == 0; | 1254 WebContextMenuData::MediaInError) == 0; |
1255 | 1255 |
1256 // Media controls can be toggled only for video player. If we toggle | |
1257 // controls for audio then the player disappears, and there is no way to | |
1258 // return it back. | |
1259 case IDC_CONTENT_CONTEXT_CONTROLS: | 1256 case IDC_CONTENT_CONTEXT_CONTROLS: |
1260 return (params_.media_flags & | 1257 return (params_.media_flags & |
1261 WebContextMenuData::MediaHasVideo) != 0; | 1258 WebContextMenuData::MediaCanToggleControls) != 0; |
1262 | 1259 |
1263 case IDC_CONTENT_CONTEXT_ROTATECW: | 1260 case IDC_CONTENT_CONTEXT_ROTATECW: |
1264 case IDC_CONTENT_CONTEXT_ROTATECCW: | 1261 case IDC_CONTENT_CONTEXT_ROTATECCW: |
1265 return | 1262 return |
1266 (params_.media_flags & WebContextMenuData::MediaCanRotate) != 0; | 1263 (params_.media_flags & WebContextMenuData::MediaCanRotate) != 0; |
1267 | 1264 |
1268 case IDC_CONTENT_CONTEXT_COPYAVLOCATION: | 1265 case IDC_CONTENT_CONTEXT_COPYAVLOCATION: |
1269 case IDC_CONTENT_CONTEXT_COPYIMAGELOCATION: | 1266 case IDC_CONTENT_CONTEXT_COPYIMAGELOCATION: |
1270 return params_.src_url.is_valid(); | 1267 return params_.src_url.is_valid(); |
1271 | 1268 |
(...skipping 789 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2061 source_web_contents_->GetRenderViewHost()-> | 2058 source_web_contents_->GetRenderViewHost()-> |
2062 ExecuteMediaPlayerActionAtLocation(location, action); | 2059 ExecuteMediaPlayerActionAtLocation(location, action); |
2063 } | 2060 } |
2064 | 2061 |
2065 void RenderViewContextMenu::PluginActionAt( | 2062 void RenderViewContextMenu::PluginActionAt( |
2066 const gfx::Point& location, | 2063 const gfx::Point& location, |
2067 const WebPluginAction& action) { | 2064 const WebPluginAction& action) { |
2068 source_web_contents_->GetRenderViewHost()-> | 2065 source_web_contents_->GetRenderViewHost()-> |
2069 ExecutePluginActionAtLocation(location, action); | 2066 ExecutePluginActionAtLocation(location, action); |
2070 } | 2067 } |
OLD | NEW |