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

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

Issue 2215123002: Disable Print in the context menu when a modal dialog is shown (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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 210adc6d75d706936ca9186a699bc107e60d67e6..7b69204f111a89cd2b1e45441fee0f89533ac86e 100644
--- a/chrome/browser/renderer_context_menu/render_view_context_menu.cc
+++ b/chrome/browser/renderer_context_menu/render_view_context_menu.cc
@@ -1427,8 +1427,6 @@ bool RenderViewContextMenu::IsCommandIdEnabled(int id) const {
int content_restrictions = 0;
if (core_tab_helper)
content_restrictions = core_tab_helper->content_restrictions();
- if (id == IDC_PRINT && (content_restrictions & CONTENT_RESTRICTION_PRINT))
Lei Zhang 2016/08/04 23:54:08 Maybe just leave this check in since it's relative
takumif 2016/08/05 00:40:08 Done.
- return false;
if (id == IDC_SAVE_PAGE &&
(content_restrictions & CONTENT_RESTRICTION_SAVE)) {
@@ -1583,9 +1581,7 @@ bool RenderViewContextMenu::IsCommandIdEnabled(int id) const {
incognito_avail != IncognitoModePrefs::DISABLED;
case IDC_PRINT:
- return prefs->GetBoolean(prefs::kPrintingEnabled) &&
- (params_.media_type == WebContextMenuData::MediaTypeNone ||
- params_.media_flags & WebContextMenuData::MediaCanPrint);
+ return IsPrintPreviewEnabled();
case IDC_CONTENT_CONTEXT_SEARCHWEBFOR:
case IDC_CONTENT_CONTEXT_GOTOURL:
@@ -2082,6 +2078,14 @@ bool RenderViewContextMenu::IsPasteAndMatchStyleEnabled() const {
ui::CLIPBOARD_TYPE_COPY_PASTE);
}
+bool RenderViewContextMenu::IsPrintPreviewEnabled() const {
+ Browser* browser = chrome::FindLastActive();
Lei Zhang 2016/08/04 23:54:09 Seems everyone else here is calling chrome::FindBr
takumif 2016/08/05 00:40:08 chrome::FindBrowserWithWebContents returns null in
Lei Zhang 2016/08/05 01:48:47 How is checking chrome::FindBrowserWithWebContents
takumif 2016/08/05 18:12:29 It was unexpected to me that chrome::FindBrowserWi
+ return browser &&
+ chrome::CanPrint(browser) &&
+ (params_.media_type == WebContextMenuData::MediaTypeNone ||
Lei Zhang 2016/08/04 23:54:09 Check these separately first because it is the che
takumif 2016/08/05 00:40:08 Done.
+ params_.media_flags & WebContextMenuData::MediaCanPrint);
+}
+
bool RenderViewContextMenu::IsRouteMediaEnabled() const {
if (!media_router::MediaRouterEnabled(browser_context_))
return false;
« 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