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

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

Issue 169093009: Separate out logic to handle different category/group of context menu items from RVContextMenu class (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@work-mmm-refactor1
Patch Set: fix incorrect dcheck + platform app logic Created 6 years, 10 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 <algorithm> 7 #include <algorithm>
8 #include <set> 8 #include <set>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 29 matching lines...) Expand all
40 #include "chrome/browser/prefs/incognito_mode_prefs.h" 40 #include "chrome/browser/prefs/incognito_mode_prefs.h"
41 #include "chrome/browser/profiles/profile.h" 41 #include "chrome/browser/profiles/profile.h"
42 #include "chrome/browser/profiles/profile_io_data.h" 42 #include "chrome/browser/profiles/profile_io_data.h"
43 #include "chrome/browser/search/search.h" 43 #include "chrome/browser/search/search.h"
44 #include "chrome/browser/search_engines/search_terms_data.h" 44 #include "chrome/browser/search_engines/search_terms_data.h"
45 #include "chrome/browser/search_engines/template_url.h" 45 #include "chrome/browser/search_engines/template_url.h"
46 #include "chrome/browser/search_engines/template_url_service.h" 46 #include "chrome/browser/search_engines/template_url_service.h"
47 #include "chrome/browser/search_engines/template_url_service_factory.h" 47 #include "chrome/browser/search_engines/template_url_service_factory.h"
48 #include "chrome/browser/spellchecker/spellcheck_host_metrics.h" 48 #include "chrome/browser/spellchecker/spellcheck_host_metrics.h"
49 #include "chrome/browser/spellchecker/spellcheck_service.h" 49 #include "chrome/browser/spellchecker/spellcheck_service.h"
50 #include "chrome/browser/tab_contents/menu_category_factory.h"
50 #include "chrome/browser/tab_contents/retargeting_details.h" 51 #include "chrome/browser/tab_contents/retargeting_details.h"
51 #include "chrome/browser/tab_contents/spellchecker_submenu_observer.h" 52 #include "chrome/browser/tab_contents/spellchecker_submenu_observer.h"
52 #include "chrome/browser/tab_contents/spelling_menu_observer.h" 53 #include "chrome/browser/tab_contents/spelling_menu_observer.h"
53 #include "chrome/browser/translate/translate_manager.h" 54 #include "chrome/browser/translate/translate_manager.h"
54 #include "chrome/browser/translate/translate_tab_helper.h" 55 #include "chrome/browser/translate/translate_tab_helper.h"
55 #include "chrome/browser/ui/browser.h" 56 #include "chrome/browser/ui/browser.h"
56 #include "chrome/browser/ui/browser_commands.h" 57 #include "chrome/browser/ui/browser_commands.h"
57 #include "chrome/browser/ui/browser_finder.h" 58 #include "chrome/browser/ui/browser_finder.h"
58 #include "chrome/browser/ui/search_engines/search_engine_tab_helper.h" 59 #include "chrome/browser/ui/search_engines/search_engine_tab_helper.h"
59 #include "chrome/browser/ui/tab_contents/core_tab_helper.h" 60 #include "chrome/browser/ui/tab_contents/core_tab_helper.h"
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after
407 render_frame_id_(render_frame_host->GetRoutingID()), 408 render_frame_id_(render_frame_host->GetRoutingID()),
408 profile_(Profile::FromBrowserContext( 409 profile_(Profile::FromBrowserContext(
409 source_web_contents_->GetBrowserContext())), 410 source_web_contents_->GetBrowserContext())),
410 menu_model_(this), 411 menu_model_(this),
411 extension_items_(profile_, this, &menu_model_, 412 extension_items_(profile_, this, &menu_model_,
412 base::Bind(MenuItemMatchesParams, params_)), 413 base::Bind(MenuItemMatchesParams, params_)),
413 speech_input_submenu_model_(this), 414 speech_input_submenu_model_(this),
414 protocol_handler_submenu_model_(this), 415 protocol_handler_submenu_model_(this),
415 protocol_handler_registry_( 416 protocol_handler_registry_(
416 ProtocolHandlerRegistryFactory::GetForProfile(profile_)), 417 ProtocolHandlerRegistryFactory::GetForProfile(profile_)),
417 command_executed_(false), 418 command_executed_(false) {
418 is_guest_(false) { 419 menu_category_.reset(MenuCategoryFactory::Create(source_web_contents_,
419 RenderViewHost* rvh = source_web_contents_->GetRenderViewHost(); 420 render_frame_host, params));
420 if (rvh && rvh->GetProcess()->IsGuest())
421 is_guest_ = true;
422 } 421 }
423 422
424 RenderViewContextMenu::~RenderViewContextMenu() { 423 RenderViewContextMenu::~RenderViewContextMenu() {
425 } 424 }
426 425
427 // Menu construction functions ------------------------------------------------- 426 // Menu construction functions -------------------------------------------------
428 427
429 void RenderViewContextMenu::Init() { 428 void RenderViewContextMenu::Init() {
430 InitMenu(); 429 InitMenu();
431 PlatformInit(); 430 PlatformInit();
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
555 const std::string& id = map_ids[sorted_menu_titles[i]]; 554 const std::string& id = map_ids[sorted_menu_titles[i]];
556 extension_items_.AppendExtensionItems(id, printable_selection_text, 555 extension_items_.AppendExtensionItems(id, printable_selection_text,
557 &index); 556 &index);
558 } 557 }
559 558
560 UMA_HISTOGRAM_TIMES("Extensions.ContextMenus_BuildTime", 559 UMA_HISTOGRAM_TIMES("Extensions.ContextMenus_BuildTime",
561 base::TimeTicks::Now() - begin); 560 base::TimeTicks::Now() - begin);
562 UMA_HISTOGRAM_COUNTS("Extensions.ContextMenus_ItemCount", index); 561 UMA_HISTOGRAM_COUNTS("Extensions.ContextMenus_ItemCount", index);
563 } 562 }
564 563
564 void RenderViewContextMenu::AppendCurrentExtensionItems() {
565 // Avoid appending extension related items when |extension| is null. This
566 // happens when the panel is navigated to a url outside of the extension's
567 // package.
568 const Extension* extension = GetExtension();
569 if (extension) {
570 // Only add extension items from this extension.
571 int index = 0;
572 extension_items_.AppendExtensionItems(extension->id(),
573 PrintableSelectionText(), &index);
574 }
575 }
576
565 void RenderViewContextMenu::InitMenu() { 577 void RenderViewContextMenu::InitMenu() {
566 if (chrome::IsRunningInForcedAppMode()) { 578 int items = menu_category_->GetCategories();
567 AppendAppModeItems(); 579
568 return; 580 if (items & (1 << MenuCategoryBase::ITEM_CATEGORY_CUSTOM))
Fady Samuel 2014/02/24 19:07:29 I would prefer this syntax: if (context_->Support
lazyboy 2014/02/24 23:45:00 Done.
581 AppendCustomItems();
582 if (items & (1 << MenuCategoryBase::ITEM_CATEGORY_PAGE))
583 AppendPageItems();
584 if (items & (1 << MenuCategoryBase::ITEM_CATEGORY_FRAME)) {
585 DCHECK(items & MenuCategoryBase::ITEM_CATEGORY_PAGE);
586 AppendFrameItems();
569 } 587 }
570 588 if (items & (1 << MenuCategoryBase::ITEM_CATEGORY_LINK)) {
571 extensions::ViewType view_type =
572 extensions::GetViewType(source_web_contents_);
573 if (view_type == extensions::VIEW_TYPE_APP_WINDOW) {
574 AppendPlatformAppItems();
575 return;
576 } else if (view_type == extensions::VIEW_TYPE_EXTENSION_POPUP) {
577 AppendPopupExtensionItems();
578 return;
579 } else if (view_type == extensions::VIEW_TYPE_PANEL) {
580 AppendPanelItems();
581 return;
582 }
583
584 const bool has_link = !params_.unfiltered_link_url.is_empty();
585 const bool has_selection = !params_.selection_text.empty();
586
587 if (AppendCustomItems()) {
588 // If there's a selection, don't early return when there are custom items,
589 // but fall through to adding the normal ones after the custom ones.
590 if (has_selection) {
591 menu_model_.AddSeparator(ui::NORMAL_SEPARATOR);
592 } else {
593 // Don't add items for Pepper menu.
594 if (!params_.custom_context.is_pepper_menu)
595 AppendDeveloperItems();
596 return;
597 }
598 }
599
600 // When no special node or text is selected and selection has no link,
601 // show page items.
602 if (params_.media_type == WebContextMenuData::MediaTypeNone &&
603 !has_link &&
604 !params_.is_editable &&
605 !is_guest_ &&
606 !has_selection) {
607 if (!params_.page_url.is_empty()) {
608 bool is_devtools = IsDevToolsURL(params_.page_url);
609 if (!is_devtools && !IsInternalResourcesURL(params_.page_url)) {
610 AppendPageItems();
611 // Merge in frame items if we clicked within a frame that needs them.
612 if (!params_.frame_url.is_empty()) {
613 is_devtools = IsDevToolsURL(params_.frame_url);
614 if (!is_devtools && !IsInternalResourcesURL(params_.frame_url)) {
615 menu_model_.AddSeparator(ui::NORMAL_SEPARATOR);
616 AppendFrameItems();
617 }
618 }
619 }
620 } else {
621 DCHECK(params_.frame_url.is_empty());
622 }
623 }
624
625 // Do not show link related items for guest.
626 if (has_link && !is_guest_) {
627 AppendLinkItems(); 589 AppendLinkItems();
628 if (params_.media_type != WebContextMenuData::MediaTypeNone) 590 if (params_.media_type != WebContextMenuData::MediaTypeNone)
629 menu_model_.AddSeparator(ui::NORMAL_SEPARATOR); 591 menu_model_.AddSeparator(ui::NORMAL_SEPARATOR);
630 } 592 }
593 if (items & (1 << MenuCategoryBase::ITEM_CATEGORY_MEDIA_IMAGE))
594 AppendImageItems();
595 if (items & (1 << MenuCategoryBase::ITEM_CATEGORY_SEARCHWEBFORIMAGE))
596 AppendSearchWebForImageItems();
597 if (items & (1 << MenuCategoryBase::ITEM_CATEGORY_MEDIA_VIDEO))
598 AppendVideoItems();
599 if (items & (1 << MenuCategoryBase::ITEM_CATEGORY_MEDIA_AUDIO))
600 AppendAudioItems();
601 if (items & (1 << MenuCategoryBase::ITEM_CATEGORY_MEDIA_PLUGIN))
602 AppendPluginItems();
603 // if (items & (1 << ITEM_CATEGORY_MEDIA_FILE)) ...
604 if (items & (1 << MenuCategoryBase::ITEM_CATEGORY_EDITABLE))
605 AppendEditableItems();
631 606
632 switch (params_.media_type) { 607 if (items & (1 << MenuCategoryBase::ITEM_CATEGORY_COPY)) {
633 case WebContextMenuData::MediaTypeNone: 608 DCHECK(!(items & (1 << MenuCategoryBase::ITEM_CATEGORY_EDITABLE)));
634 break; 609 AppendCopyItem();
635 case WebContextMenuData::MediaTypeImage:
636 AppendImageItems();
637 break;
638 case WebContextMenuData::MediaTypeVideo:
639 AppendVideoItems();
640 break;
641 case WebContextMenuData::MediaTypeAudio:
642 AppendAudioItems();
643 break;
644 case WebContextMenuData::MediaTypePlugin:
645 AppendPluginItems();
646 break;
647 #ifdef WEBCONTEXT_MEDIATYPEFILE_DEFINED
648 case WebContextMenuData::MediaTypeFile:
649 break;
650 #endif
651 } 610 }
652 611
653 if (params_.is_editable) 612 if (items & (1 << MenuCategoryBase::ITEM_CATEGORY_PRINT))
654 AppendEditableItems(); 613 AppendPrintItem();
655 else if (has_selection)
656 AppendCopyItem();
657 614
658 if (!is_guest_ && has_selection) { 615 if (items & (1 << MenuCategoryBase::ITEM_CATEGORY_ALL_EXTENSION)) {
659 AppendSearchProvider(); 616 DCHECK(!(items & (1 << MenuCategoryBase::ITEM_CATEGORY_CURRENT_EXTENSION)));
660 if (!IsDevToolsURL(params_.page_url)) 617 AppendAllExtensionItems();
661 AppendPrintItem(); 618 }
619 if (items & (1 << MenuCategoryBase::ITEM_CATEGORY_CURRENT_EXTENSION)) {
620 DCHECK(!(items & (1 << MenuCategoryBase::ITEM_CATEGORY_ALL_EXTENSION)));
621 AppendCurrentExtensionItems();
662 } 622 }
663 623
664 if (!IsDevToolsURL(params_.page_url) && !is_guest_) 624 if (items & (1 << MenuCategoryBase::ITEM_CATEGORY_DEVELOPER))
665 AppendAllExtensionItems(); 625 AppendDeveloperItems();
666 626
667 AppendDeveloperItems(); 627 if (items &(1 << MenuCategoryBase::ITEM_CATEGORY_DEVTOOLS_UNPACKED_EXT))
628 AppendDevtoolsForUnpackedExtensions();
668 629
669 if (!is_guest_) { 630 if (items & (1 << MenuCategoryBase::ITEM_CATEGORY_PRINT_PREVIEW))
631 AppendPrintPreviewItems();
632 }
633
634 void RenderViewContextMenu::AppendPrintPreviewItems() {
670 #if defined(ENABLE_FULL_PRINTING) 635 #if defined(ENABLE_FULL_PRINTING)
671 if (!print_preview_menu_observer_.get()) { 636 if (!print_preview_menu_observer_.get()) {
672 print_preview_menu_observer_.reset( 637 print_preview_menu_observer_.reset(
673 new PrintPreviewContextMenuObserver(source_web_contents_)); 638 new PrintPreviewContextMenuObserver(source_web_contents_));
674 } 639 }
675 640
676 observers_.AddObserver(print_preview_menu_observer_.get()); 641 observers_.AddObserver(print_preview_menu_observer_.get());
677 #endif 642 #endif
678 }
679 } 643 }
680 644
681 const Extension* RenderViewContextMenu::GetExtension() const { 645 const Extension* RenderViewContextMenu::GetExtension() const {
682 extensions::ExtensionSystem* system = 646 extensions::ExtensionSystem* system =
683 extensions::ExtensionSystem::Get(profile_); 647 extensions::ExtensionSystem::Get(profile_);
684 // There is no process manager in some tests. 648 // There is no process manager in some tests.
685 if (!system->process_manager()) 649 if (!system->process_manager())
686 return NULL; 650 return NULL;
687 651
688 return system->process_manager()->GetExtensionForRenderViewHost( 652 return system->process_manager()->GetExtensionForRenderViewHost(
689 source_web_contents_->GetRenderViewHost()); 653 source_web_contents_->GetRenderViewHost());
690 } 654 }
691 655
692 void RenderViewContextMenu::AppendAppModeItems() {
693 const bool has_selection = !params_.selection_text.empty();
694
695 if (params_.is_editable)
696 AppendEditableItems();
697 else if (has_selection)
698 AppendCopyItem();
699 }
700
701 void RenderViewContextMenu::AppendPlatformAppItems() {
702 const Extension* platform_app = GetExtension();
703
704 // The RVH might be for a process sandboxed from the extension.
705 if (!platform_app)
706 return;
707
708 DCHECK(platform_app->is_platform_app());
709
710 const bool has_selection = !params_.selection_text.empty();
711
712 // Add undo/redo, cut/copy/paste etc for text fields.
713 if (params_.is_editable)
714 AppendEditableItems();
715 else if (has_selection)
716 AppendCopyItem();
717
718 int index = 0;
719 extension_items_.AppendExtensionItems(platform_app->id(),
720 PrintableSelectionText(), &index);
721
722 // Add dev tools for unpacked extensions.
723 if (extensions::Manifest::IsUnpackedLocation(platform_app->location()) ||
724 CommandLine::ForCurrentProcess()->HasSwitch(
725 switches::kDebugPackedApps)) {
726 // Add a separator if there are any items already in the menu.
727 menu_model_.AddSeparator(ui::NORMAL_SEPARATOR);
728
729 menu_model_.AddItemWithStringId(IDC_CONTENT_CONTEXT_RELOAD_PACKAGED_APP,
730 IDS_CONTENT_CONTEXT_RELOAD_PACKAGED_APP);
731 menu_model_.AddItemWithStringId(IDC_CONTENT_CONTEXT_RESTART_PACKAGED_APP,
732 IDS_CONTENT_CONTEXT_RESTART_APP);
733 AppendDeveloperItems();
734 menu_model_.AddItemWithStringId(IDC_CONTENT_CONTEXT_INSPECTBACKGROUNDPAGE,
735 IDS_CONTENT_CONTEXT_INSPECTBACKGROUNDPAGE);
736 }
737 }
738
739 void RenderViewContextMenu::AppendPopupExtensionItems() {
740 const bool has_selection = !params_.selection_text.empty();
741
742 if (params_.is_editable)
743 AppendEditableItems();
744 else if (has_selection)
745 AppendCopyItem();
746
747 if (has_selection)
748 AppendSearchProvider();
749
750 AppendAllExtensionItems();
751 AppendDeveloperItems();
752 }
753
754 void RenderViewContextMenu::AppendPanelItems() {
755 bool has_selection = !params_.selection_text.empty();
756
757 // Checking link should take precedence before checking selection since on Mac
758 // right-clicking a link will also make it selected.
759 if (params_.unfiltered_link_url.is_valid())
760 AppendLinkItems();
761
762 if (params_.is_editable)
763 AppendEditableItems();
764 else if (has_selection)
765 AppendCopyItem();
766
767 // Avoid appending extension related items when |extension| is null. This
768 // happens when the panel is navigated to a url outside of the extension's
769 // package.
770 const Extension* extension = GetExtension();
771 if (extension) {
772 // Only add extension items from this extension.
773 int index = 0;
774 extension_items_.AppendExtensionItems(extension->id(),
775 PrintableSelectionText(), &index);
776 }
777 }
778
779 void RenderViewContextMenu::AddMenuItem(int command_id, 656 void RenderViewContextMenu::AddMenuItem(int command_id,
780 const base::string16& title) { 657 const base::string16& title) {
781 menu_model_.AddItem(command_id, title); 658 menu_model_.AddItem(command_id, title);
782 } 659 }
783 660
784 void RenderViewContextMenu::AddCheckItem(int command_id, 661 void RenderViewContextMenu::AddCheckItem(int command_id,
785 const base::string16& title) { 662 const base::string16& title) {
786 menu_model_.AddCheckItem(command_id, title); 663 menu_model_.AddCheckItem(command_id, title);
787 } 664 }
788 665
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
835 if (!show_developer_items) 712 if (!show_developer_items)
836 return; 713 return;
837 714
838 // In the DevTools popup menu, "developer items" is normally the only 715 // In the DevTools popup menu, "developer items" is normally the only
839 // section, so omit the separator there. 716 // section, so omit the separator there.
840 menu_model_.AddSeparator(ui::NORMAL_SEPARATOR); 717 menu_model_.AddSeparator(ui::NORMAL_SEPARATOR);
841 menu_model_.AddItemWithStringId(IDC_CONTENT_CONTEXT_INSPECTELEMENT, 718 menu_model_.AddItemWithStringId(IDC_CONTENT_CONTEXT_INSPECTELEMENT,
842 IDS_CONTENT_CONTEXT_INSPECTELEMENT); 719 IDS_CONTENT_CONTEXT_INSPECTELEMENT);
843 } 720 }
844 721
722 void RenderViewContextMenu::AppendDevtoolsForUnpackedExtensions() {
723 // Add a separator if there are any items already in the menu.
724 menu_model_.AddSeparator(ui::NORMAL_SEPARATOR);
725
726 menu_model_.AddItemWithStringId(IDC_CONTENT_CONTEXT_RELOAD_PACKAGED_APP,
727 IDS_CONTENT_CONTEXT_RELOAD_PACKAGED_APP);
728 menu_model_.AddItemWithStringId(IDC_CONTENT_CONTEXT_RESTART_PACKAGED_APP,
729 IDS_CONTENT_CONTEXT_RESTART_APP);
730 AppendDeveloperItems();
731 menu_model_.AddItemWithStringId(IDC_CONTENT_CONTEXT_INSPECTBACKGROUNDPAGE,
732 IDS_CONTENT_CONTEXT_INSPECTBACKGROUNDPAGE);
733 }
734
845 void RenderViewContextMenu::AppendLinkItems() { 735 void RenderViewContextMenu::AppendLinkItems() {
846 if (!params_.link_url.is_empty()) { 736 if (!params_.link_url.is_empty()) {
847 menu_model_.AddItemWithStringId(IDC_CONTENT_CONTEXT_OPENLINKNEWTAB, 737 menu_model_.AddItemWithStringId(IDC_CONTENT_CONTEXT_OPENLINKNEWTAB,
848 IDS_CONTENT_CONTEXT_OPENLINKNEWTAB); 738 IDS_CONTENT_CONTEXT_OPENLINKNEWTAB);
849 menu_model_.AddItemWithStringId(IDC_CONTENT_CONTEXT_OPENLINKNEWWINDOW, 739 menu_model_.AddItemWithStringId(IDC_CONTENT_CONTEXT_OPENLINKNEWWINDOW,
850 IDS_CONTENT_CONTEXT_OPENLINKNEWWINDOW); 740 IDS_CONTENT_CONTEXT_OPENLINKNEWWINDOW);
851 if (params_.link_url.is_valid()) { 741 if (params_.link_url.is_valid()) {
852 AppendProtocolHandlerSubMenu(); 742 AppendProtocolHandlerSubMenu();
853 } 743 }
854 744
(...skipping 12 matching lines...) Expand all
867 757
868 void RenderViewContextMenu::AppendImageItems() { 758 void RenderViewContextMenu::AppendImageItems() {
869 menu_model_.AddItemWithStringId(IDC_CONTENT_CONTEXT_SAVEIMAGEAS, 759 menu_model_.AddItemWithStringId(IDC_CONTENT_CONTEXT_SAVEIMAGEAS,
870 IDS_CONTENT_CONTEXT_SAVEIMAGEAS); 760 IDS_CONTENT_CONTEXT_SAVEIMAGEAS);
871 menu_model_.AddItemWithStringId(IDC_CONTENT_CONTEXT_COPYIMAGELOCATION, 761 menu_model_.AddItemWithStringId(IDC_CONTENT_CONTEXT_COPYIMAGELOCATION,
872 IDS_CONTENT_CONTEXT_COPYIMAGELOCATION); 762 IDS_CONTENT_CONTEXT_COPYIMAGELOCATION);
873 menu_model_.AddItemWithStringId(IDC_CONTENT_CONTEXT_COPYIMAGE, 763 menu_model_.AddItemWithStringId(IDC_CONTENT_CONTEXT_COPYIMAGE,
874 IDS_CONTENT_CONTEXT_COPYIMAGE); 764 IDS_CONTENT_CONTEXT_COPYIMAGE);
875 menu_model_.AddItemWithStringId(IDC_CONTENT_CONTEXT_OPENIMAGENEWTAB, 765 menu_model_.AddItemWithStringId(IDC_CONTENT_CONTEXT_OPENIMAGENEWTAB,
876 IDS_CONTENT_CONTEXT_OPENIMAGENEWTAB); 766 IDS_CONTENT_CONTEXT_OPENIMAGENEWTAB);
767 }
768
769 void RenderViewContextMenu::AppendSearchWebForImageItems() {
877 const TemplateURL* const default_provider = 770 const TemplateURL* const default_provider =
878 TemplateURLServiceFactory::GetForProfile(profile_)-> 771 TemplateURLServiceFactory::GetForProfile(profile_)->
879 GetDefaultSearchProvider(); 772 GetDefaultSearchProvider();
880 if (!is_guest_ && params_.has_image_contents && default_provider && 773 if (params_.has_image_contents && default_provider &&
881 !default_provider->image_url().empty() && 774 !default_provider->image_url().empty() &&
882 default_provider->image_url_ref().IsValid()) { 775 default_provider->image_url_ref().IsValid()) {
883 menu_model_.AddItem( 776 menu_model_.AddItem(
884 IDC_CONTENT_CONTEXT_SEARCHWEBFORIMAGE, 777 IDC_CONTENT_CONTEXT_SEARCHWEBFORIMAGE,
885 l10n_util::GetStringFUTF16(IDS_CONTENT_CONTEXT_SEARCHWEBFORIMAGE, 778 l10n_util::GetStringFUTF16(IDS_CONTENT_CONTEXT_SEARCHWEBFORIMAGE,
886 default_provider->short_name())); 779 default_provider->short_name()));
887 } 780 }
888 AppendPrintItem();
889 } 781 }
890 782
891 void RenderViewContextMenu::AppendAudioItems() { 783 void RenderViewContextMenu::AppendAudioItems() {
892 AppendMediaItems(); 784 AppendMediaItems();
893 menu_model_.AddSeparator(ui::NORMAL_SEPARATOR); 785 menu_model_.AddSeparator(ui::NORMAL_SEPARATOR);
894 menu_model_.AddItemWithStringId(IDC_CONTENT_CONTEXT_SAVEAVAS, 786 menu_model_.AddItemWithStringId(IDC_CONTENT_CONTEXT_SAVEAVAS,
895 IDS_CONTENT_CONTEXT_SAVEAUDIOAS); 787 IDS_CONTENT_CONTEXT_SAVEAUDIOAS);
896 menu_model_.AddItemWithStringId(IDC_CONTENT_CONTEXT_COPYAVLOCATION, 788 menu_model_.AddItemWithStringId(IDC_CONTENT_CONTEXT_COPYAVLOCATION,
897 IDS_CONTENT_CONTEXT_COPYAUDIOLOCATION); 789 IDS_CONTENT_CONTEXT_COPYAUDIOLOCATION);
898 menu_model_.AddItemWithStringId(IDC_CONTENT_CONTEXT_OPENAVNEWTAB, 790 menu_model_.AddItemWithStringId(IDC_CONTENT_CONTEXT_OPENAVNEWTAB,
(...skipping 1212 matching lines...) Expand 10 before | Expand all | Expand 10 after
2111 source_web_contents_->GetRenderViewHost()-> 2003 source_web_contents_->GetRenderViewHost()->
2112 ExecuteMediaPlayerActionAtLocation(location, action); 2004 ExecuteMediaPlayerActionAtLocation(location, action);
2113 } 2005 }
2114 2006
2115 void RenderViewContextMenu::PluginActionAt( 2007 void RenderViewContextMenu::PluginActionAt(
2116 const gfx::Point& location, 2008 const gfx::Point& location,
2117 const WebPluginAction& action) { 2009 const WebPluginAction& action) {
2118 source_web_contents_->GetRenderViewHost()-> 2010 source_web_contents_->GetRenderViewHost()->
2119 ExecutePluginActionAtLocation(location, action); 2011 ExecutePluginActionAtLocation(location, action);
2120 } 2012 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698