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

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

Issue 632243002: |Print..| menu should be consistent in contextmenu with and without selection. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comments update. Created 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/renderer_context_menu/render_view_context_menu.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/renderer_context_menu/render_view_context_menu.cc
diff --git a/chrome/browser/renderer_context_menu/render_view_context_menu.cc b/chrome/browser/renderer_context_menu/render_view_context_menu.cc
index 5574ba030d2f9ec91b3ebc43bcfd7fc0e6a52392..cb4a981c14cb60aa210b6fae391b620228436e7f 100644
--- a/chrome/browser/renderer_context_menu/render_view_context_menu.cc
+++ b/chrome/browser/renderer_context_menu/render_view_context_menu.cc
@@ -477,7 +477,7 @@ void RenderViewContextMenu::AppendCurrentExtensionItems() {
void RenderViewContextMenu::InitMenu() {
RenderViewContextMenuBase::InitMenu();
-
+ bool rotation_item_appended = false;
if (content_type_->SupportsGroup(ContextMenuContentType::ITEM_GROUP_PAGE))
AppendPageItems();
@@ -521,7 +521,7 @@ void RenderViewContextMenu::InitMenu() {
if (content_type_->SupportsGroup(
ContextMenuContentType::ITEM_GROUP_MEDIA_PLUGIN)) {
- AppendPluginItems();
+ rotation_item_appended = AppendPluginItems();
}
// ITEM_GROUP_MEDIA_FILE has no specific items.
@@ -543,6 +543,9 @@ void RenderViewContextMenu::InitMenu() {
if (content_type_->SupportsGroup(ContextMenuContentType::ITEM_GROUP_PRINT))
AppendPrintItem();
+ if (rotation_item_appended)
+ AppendRotationItems();
+
if (content_type_->SupportsGroup(
ContextMenuContentType::ITEM_GROUP_ALL_EXTENSION)) {
DCHECK(!content_type_->SupportsGroup(
@@ -761,7 +764,10 @@ void RenderViewContextMenu::AppendMediaItems() {
IDS_CONTENT_CONTEXT_CONTROLS);
}
-void RenderViewContextMenu::AppendPluginItems() {
+// This function will returns true if we need to add the rotation items else
+// returns false. As rotation items should be added after copy, search, print
+// context menu items.
Avi (use Gerrit) 2014/10/08 12:42:48 :\ When you return bool from a function it means s
Deepak 2014/10/08 13:38:26 Done.
+bool 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())
@@ -769,16 +775,17 @@ void RenderViewContextMenu::AppendPluginItems() {
} else {
menu_model_.AddItemWithStringId(IDC_CONTENT_CONTEXT_SAVEAVAS,
IDS_CONTENT_CONTEXT_SAVEPAGEAS);
- menu_model_.AddItemWithStringId(IDC_PRINT, IDS_CONTENT_CONTEXT_PRINT);
+ // |IDC_PRINT| should be added here as we want print menu item when pdf
+ // launched with out of process flags then |content_type_->SupportsGroup|
+ // does not have |ContextMenuContentType::ITEM_GROUP_PRINT|.
+ if (!content_type_->SupportsGroup(ContextMenuContentType::ITEM_GROUP_PRINT))
+ menu_model_.AddItemWithStringId(IDC_PRINT, IDS_CONTENT_CONTEXT_PRINT);
}
- if (params_.media_flags & WebContextMenuData::MediaCanRotate) {
- menu_model_.AddSeparator(ui::NORMAL_SEPARATOR);
- menu_model_.AddItemWithStringId(IDC_CONTENT_CONTEXT_ROTATECW,
- IDS_CONTENT_CONTEXT_ROTATECW);
- menu_model_.AddItemWithStringId(IDC_CONTENT_CONTEXT_ROTATECCW,
- IDS_CONTENT_CONTEXT_ROTATECCW);
- }
+ if (params_.media_flags & WebContextMenuData::MediaCanRotate)
+ return true;
Avi (use Gerrit) 2014/10/08 12:42:48 Is there a reason why we need the boolean at all?
Deepak 2014/10/08 13:38:26 Done.
+
+ return false;
}
void RenderViewContextMenu::AppendPageItems() {
@@ -837,6 +844,14 @@ void RenderViewContextMenu::AppendPrintItem() {
}
}
+void RenderViewContextMenu::AppendRotationItems() {
+ menu_model_.AddSeparator(ui::NORMAL_SEPARATOR);
+ menu_model_.AddItemWithStringId(IDC_CONTENT_CONTEXT_ROTATECW,
+ IDS_CONTENT_CONTEXT_ROTATECW);
+ menu_model_.AddItemWithStringId(IDC_CONTENT_CONTEXT_ROTATECCW,
+ IDS_CONTENT_CONTEXT_ROTATECCW);
+}
+
void RenderViewContextMenu::AppendSearchProvider() {
DCHECK(browser_context_);
« no previous file with comments | « chrome/browser/renderer_context_menu/render_view_context_menu.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698