| OLD | NEW |
| 1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 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/tab_contents/render_view_context_menu.h" | 5 #include "chrome/browser/tab_contents/render_view_context_menu.h" |
| 6 | 6 |
| 7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
| 8 #include "base/clipboard.h" | 8 #include "base/clipboard.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 310 return true; | 310 return true; |
| 311 | 311 |
| 312 case IDS_CONTENT_CONTEXT_FULLSCREEN: | 312 case IDS_CONTENT_CONTEXT_FULLSCREEN: |
| 313 // TODO(ajwong): Enable fullscreen after we actually implement this. | 313 // TODO(ajwong): Enable fullscreen after we actually implement this. |
| 314 return false; | 314 return false; |
| 315 | 315 |
| 316 // Media control commands should all be disabled if the player is in an | 316 // Media control commands should all be disabled if the player is in an |
| 317 // error state. | 317 // error state. |
| 318 case IDS_CONTENT_CONTEXT_PLAY: | 318 case IDS_CONTENT_CONTEXT_PLAY: |
| 319 case IDS_CONTENT_CONTEXT_PAUSE: | 319 case IDS_CONTENT_CONTEXT_PAUSE: |
| 320 case IDS_CONTENT_CONTEXT_LOOP: |
| 321 return (params_.media_params.player_state & |
| 322 ContextMenuMediaParams::IN_ERROR) == 0; |
| 323 |
| 324 // Mute and unmute should also be disabled if the player has no audio. |
| 320 case IDS_CONTENT_CONTEXT_MUTE: | 325 case IDS_CONTENT_CONTEXT_MUTE: |
| 321 case IDS_CONTENT_CONTEXT_UNMUTE: | 326 case IDS_CONTENT_CONTEXT_UNMUTE: |
| 322 case IDS_CONTENT_CONTEXT_LOOP: | 327 return params_.media_params.has_audio && |
| 323 return (params_.media_params.player_state & | 328 (params_.media_params.player_state & |
| 324 ContextMenuMediaParams::IN_ERROR) == 0; | 329 ContextMenuMediaParams::IN_ERROR) == 0; |
| 325 | 330 |
| 326 case IDS_CONTENT_CONTEXT_SAVESCREENSHOTAS: | 331 case IDS_CONTENT_CONTEXT_SAVESCREENSHOTAS: |
| 327 // TODO(ajwong): Enable save screenshot after we actually implement | 332 // TODO(ajwong): Enable save screenshot after we actually implement |
| 328 // this. | 333 // this. |
| 329 return false; | 334 return false; |
| 330 | 335 |
| 331 case IDS_CONTENT_CONTEXT_COPYAUDIOLOCATION: | 336 case IDS_CONTENT_CONTEXT_COPYAUDIOLOCATION: |
| 332 case IDS_CONTENT_CONTEXT_COPYVIDEOLOCATION: | 337 case IDS_CONTENT_CONTEXT_COPYVIDEOLOCATION: |
| 333 case IDS_CONTENT_CONTEXT_COPYIMAGELOCATION: | 338 case IDS_CONTENT_CONTEXT_COPYIMAGELOCATION: |
| (...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 774 WriteTextToClipboard(UTF8ToUTF16(utf8_text)); | 779 WriteTextToClipboard(UTF8ToUTF16(utf8_text)); |
| 775 DidWriteURLToClipboard(utf8_text); | 780 DidWriteURLToClipboard(utf8_text); |
| 776 } | 781 } |
| 777 | 782 |
| 778 void RenderViewContextMenu::MediaPlayerActionAt( | 783 void RenderViewContextMenu::MediaPlayerActionAt( |
| 779 int x, | 784 int x, |
| 780 int y, | 785 int y, |
| 781 const MediaPlayerAction& action) { | 786 const MediaPlayerAction& action) { |
| 782 source_tab_contents_->render_view_host()->MediaPlayerActionAt(x, y, action); | 787 source_tab_contents_->render_view_host()->MediaPlayerActionAt(x, y, action); |
| 783 } | 788 } |
| OLD | NEW |