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

Unified Diff: chrome/browser/tab_contents/render_view_context_menu.cc

Issue 6142013: Allow printing/saving a plugin through right click menu, even if it's in a fr... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/tab_contents/render_view_context_menu.h ('k') | chrome/browser/ui/cocoa/menu_controller.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/tab_contents/render_view_context_menu.cc
===================================================================
--- chrome/browser/tab_contents/render_view_context_menu.cc (revision 71495)
+++ chrome/browser/tab_contents/render_view_context_menu.cc (working copy)
@@ -399,7 +399,8 @@
case WebContextMenuData::MediaTypeAudio:
AppendAudioItems();
break;
- default:
+ case WebContextMenuData::MediaTypePlugin:
+ AppendPluginItems();
break;
}
@@ -526,6 +527,18 @@
IDS_CONTENT_CONTEXT_CONTROLS);
}
+void RenderViewContextMenu::AppendPluginItems() {
+ if (params_.page_url == params_.src_url) {
+ // Full page plugin, so show page menu items.
+ if (params_.link_url.is_empty() && params_.selection_text.empty())
+ AppendPageItems();
+ } else {
+ menu_model_.AddItemWithStringId(IDC_CONTENT_CONTEXT_SAVEAVAS,
+ IDS_CONTENT_CONTEXT_SAVEPAGEAS);
+ menu_model_.AddItemWithStringId(IDC_PRINT, IDS_CONTENT_CONTEXT_PRINT);
+ }
+}
+
void RenderViewContextMenu::AppendPageItems() {
menu_model_.AddItemWithStringId(IDC_BACK, IDS_CONTENT_CONTEXT_BACK);
menu_model_.AddItemWithStringId(IDC_FORWARD, IDS_CONTENT_CONTEXT_FORWARD);
@@ -937,6 +950,9 @@
return !params_.misspelled_word.empty();
case IDC_PRINT:
+ return params_.media_type == WebContextMenuData::MediaTypeNone ||
+ params_.media_flags & WebContextMenuData::MediaCanPrint;
+
case IDC_CONTENT_CONTEXT_SEARCHWEBFOR:
case IDC_CONTENT_CONTEXT_GOTOURL:
case IDC_SPELLCHECK_SUGGESTION_0:
@@ -1214,7 +1230,11 @@
break;
case IDC_PRINT:
- source_tab_contents_->PrintPreview();
+ if (params_.media_type == WebContextMenuData::MediaTypeNone) {
+ source_tab_contents_->PrintPreview();
+ } else {
+ source_tab_contents_->render_view_host()->PrintNodeUnderContextMenu();
+ }
break;
case IDC_VIEW_SOURCE:
@@ -1378,6 +1398,10 @@
}
}
+void RenderViewContextMenu::MenuClosed() {
+ source_tab_contents_->render_view_host()->ContextMenuClosed();
+}
+
bool RenderViewContextMenu::IsDevCommandEnabled(int id) const {
const CommandLine& command_line = *CommandLine::ForCurrentProcess();
if (command_line.HasSwitch(switches::kAlwaysEnableDevTools))
« no previous file with comments | « chrome/browser/tab_contents/render_view_context_menu.h ('k') | chrome/browser/ui/cocoa/menu_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698