Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(299)

Side by Side Diff: chrome/browser/tab_contents/render_view_context_menu.cc

Issue 251103: Move MediaPlayerAction to WebMediaPlayerAction. Switch to an enum and a... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/tab_contents/render_view_context_menu.h ('k') | chrome/common/render_messages.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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/clipboard/clipboard.h" 7 #include "app/clipboard/clipboard.h"
8 #include "app/clipboard/scoped_clipboard_writer.h" 8 #include "app/clipboard/scoped_clipboard_writer.h"
9 #include "app/l10n_util.h" 9 #include "app/l10n_util.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 11 matching lines...) Expand all
22 #include "chrome/browser/spellchecker.h" 22 #include "chrome/browser/spellchecker.h"
23 #include "chrome/browser/spellchecker_platform_engine.h" 23 #include "chrome/browser/spellchecker_platform_engine.h"
24 #include "chrome/browser/tab_contents/navigation_entry.h" 24 #include "chrome/browser/tab_contents/navigation_entry.h"
25 #include "chrome/browser/tab_contents/tab_contents.h" 25 #include "chrome/browser/tab_contents/tab_contents.h"
26 #include "chrome/common/chrome_switches.h" 26 #include "chrome/common/chrome_switches.h"
27 #include "chrome/common/platform_util.h" 27 #include "chrome/common/platform_util.h"
28 #include "chrome/common/pref_service.h" 28 #include "chrome/common/pref_service.h"
29 #include "chrome/common/url_constants.h" 29 #include "chrome/common/url_constants.h"
30 #include "grit/generated_resources.h" 30 #include "grit/generated_resources.h"
31 #include "net/base/escape.h" 31 #include "net/base/escape.h"
32 #include "webkit/glue/media_player_action.h" 32 #include "webkit/api/public/WebMediaPlayerAction.h"
33
34 using WebKit::WebMediaPlayerAction;
33 35
34 namespace { 36 namespace {
35 37
36 string16 EscapeAmpersands(const string16& text) { 38 string16 EscapeAmpersands(const string16& text) {
37 string16 ret; 39 string16 ret;
38 ret.reserve(text.length() * 2); 40 ret.reserve(text.length() * 2);
39 for (string16::const_iterator i = text.begin(); 41 for (string16::const_iterator i = text.begin();
40 i != text.end(); ++i) { 42 i != text.end(); ++i) {
41 // The escape for an ampersand is two ampersands. 43 // The escape for an ampersand is two ampersands.
42 if ('&' == *i) 44 if ('&' == *i)
(...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after
536 break; 538 break;
537 539
538 case IDS_CONTENT_CONTEXT_OPENAUDIONEWTAB: 540 case IDS_CONTENT_CONTEXT_OPENAUDIONEWTAB:
539 case IDS_CONTENT_CONTEXT_OPENVIDEONEWTAB: 541 case IDS_CONTENT_CONTEXT_OPENVIDEONEWTAB:
540 case IDS_CONTENT_CONTEXT_OPENIMAGENEWTAB: 542 case IDS_CONTENT_CONTEXT_OPENIMAGENEWTAB:
541 OpenURL(params_.src_url, NEW_BACKGROUND_TAB, PageTransition::LINK); 543 OpenURL(params_.src_url, NEW_BACKGROUND_TAB, PageTransition::LINK);
542 break; 544 break;
543 545
544 case IDS_CONTENT_CONTEXT_PLAY: 546 case IDS_CONTENT_CONTEXT_PLAY:
545 UserMetrics::RecordAction(L"MediaContextMenu_Play", profile_); 547 UserMetrics::RecordAction(L"MediaContextMenu_Play", profile_);
546 MediaPlayerActionAt(params_.x, 548 MediaPlayerActionAt(gfx::Point(params_.x, params_.y),
547 params_.y, 549 WebMediaPlayerAction(
548 MediaPlayerAction(MediaPlayerAction::PLAY)); 550 WebMediaPlayerAction::Play, true));
549 break; 551 break;
550 552
551 case IDS_CONTENT_CONTEXT_PAUSE: 553 case IDS_CONTENT_CONTEXT_PAUSE:
552 UserMetrics::RecordAction(L"MediaContextMenu_Pause", profile_); 554 UserMetrics::RecordAction(L"MediaContextMenu_Pause", profile_);
553 MediaPlayerActionAt(params_.x, 555 MediaPlayerActionAt(gfx::Point(params_.x, params_.y),
554 params_.y, 556 WebMediaPlayerAction(
555 MediaPlayerAction(MediaPlayerAction::PAUSE)); 557 WebMediaPlayerAction::Play, false));
556 break; 558 break;
557 559
558 case IDS_CONTENT_CONTEXT_MUTE: 560 case IDS_CONTENT_CONTEXT_MUTE:
559 UserMetrics::RecordAction(L"MediaContextMenu_Mute", profile_); 561 UserMetrics::RecordAction(L"MediaContextMenu_Mute", profile_);
560 MediaPlayerActionAt(params_.x, 562 MediaPlayerActionAt(gfx::Point(params_.x, params_.y),
561 params_.y, 563 WebMediaPlayerAction(
562 MediaPlayerAction(MediaPlayerAction::MUTE)); 564 WebMediaPlayerAction::Mute, true));
563 break; 565 break;
564 566
565 case IDS_CONTENT_CONTEXT_UNMUTE: 567 case IDS_CONTENT_CONTEXT_UNMUTE:
566 UserMetrics::RecordAction(L"MediaContextMenu_Unmute", profile_); 568 UserMetrics::RecordAction(L"MediaContextMenu_Unmute", profile_);
567 MediaPlayerActionAt(params_.x, 569 MediaPlayerActionAt(gfx::Point(params_.x, params_.y),
568 params_.y, 570 WebMediaPlayerAction(
569 MediaPlayerAction(MediaPlayerAction::UNMUTE)); 571 WebMediaPlayerAction::Mute, false));
570 break; 572 break;
571 573
572 case IDS_CONTENT_CONTEXT_LOOP: 574 case IDS_CONTENT_CONTEXT_LOOP:
573 UserMetrics::RecordAction(L"MediaContextMenu_Loop", profile_); 575 UserMetrics::RecordAction(L"MediaContextMenu_Loop", profile_);
574 if (ItemIsChecked(IDS_CONTENT_CONTEXT_LOOP)) { 576 MediaPlayerActionAt(gfx::Point(params_.x, params_.y),
575 MediaPlayerActionAt(params_.x, 577 WebMediaPlayerAction(
576 params_.y, 578 WebMediaPlayerAction::Loop,
577 MediaPlayerAction(MediaPlayerAction::NO_LOOP)); 579 !ItemIsChecked(IDS_CONTENT_CONTEXT_LOOP)));
578 } else {
579 MediaPlayerActionAt(params_.x,
580 params_.y,
581 MediaPlayerAction(MediaPlayerAction::LOOP));
582 }
583 break; 580 break;
584 581
585 case IDS_CONTENT_CONTEXT_BACK: 582 case IDS_CONTENT_CONTEXT_BACK:
586 source_tab_contents_->controller().GoBack(); 583 source_tab_contents_->controller().GoBack();
587 break; 584 break;
588 585
589 case IDS_CONTENT_CONTEXT_FORWARD: 586 case IDS_CONTENT_CONTEXT_FORWARD:
590 source_tab_contents_->controller().GoForward(); 587 source_tab_contents_->controller().GoForward();
591 break; 588 break;
592 589
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
802 } 799 }
803 800
804 void RenderViewContextMenu::WriteURLToClipboard(const GURL& url) { 801 void RenderViewContextMenu::WriteURLToClipboard(const GURL& url) {
805 chrome_browser_net::WriteURLToClipboard( 802 chrome_browser_net::WriteURLToClipboard(
806 url, 803 url,
807 profile_->GetPrefs()->GetString(prefs::kAcceptLanguages), 804 profile_->GetPrefs()->GetString(prefs::kAcceptLanguages),
808 g_browser_process->clipboard()); 805 g_browser_process->clipboard());
809 } 806 }
810 807
811 void RenderViewContextMenu::MediaPlayerActionAt( 808 void RenderViewContextMenu::MediaPlayerActionAt(
812 int x, 809 const gfx::Point& location,
813 int y, 810 const WebMediaPlayerAction& action) {
814 const MediaPlayerAction& action) { 811 source_tab_contents_->render_view_host()->MediaPlayerActionAt(
815 source_tab_contents_->render_view_host()->MediaPlayerActionAt(x, y, action); 812 location, action);
816 } 813 }
OLDNEW
« no previous file with comments | « chrome/browser/tab_contents/render_view_context_menu.h ('k') | chrome/common/render_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698