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

Unified Diff: chrome/browser/ui/browser_commands.cc

Issue 1838043002: Disabled "Print" option in wrench menu for a crashed page. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Disabled "Print" option in wrench menu for a crashed page. Created 4 years, 9 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/ui/browser.cc ('k') | chrome/browser/ui/browser_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/browser_commands.cc
diff --git a/chrome/browser/ui/browser_commands.cc b/chrome/browser/ui/browser_commands.cc
index 13fd6faa1ee285410e749f112da391dfc4c59215..01c2dc8345f99231ef20de57f3c394631b5ad2a3 100644
--- a/chrome/browser/ui/browser_commands.cc
+++ b/chrome/browser/ui/browser_commands.cc
@@ -877,14 +877,17 @@ void Print(Browser* browser) {
bool CanPrint(Browser* browser) {
// Do not print when printing is disabled via pref or policy.
+ // Do not print when a page has crashed.
// Do not print when a constrained window is showing. It's confusing.
// TODO(gbillock): Need to re-assess the call to
// IsShowingWebContentsModalDialog after a popup management policy is
// refined -- we will probably want to just queue the print request, not
// block it.
+ WebContents* current_tab = browser->tab_strip_model()->GetActiveWebContents();
return browser->profile()->GetPrefs()->GetBoolean(prefs::kPrintingEnabled) &&
+ (current_tab && !current_tab->IsCrashed()) &&
!(IsShowingWebContentsModalDialog(browser) ||
- GetContentRestrictions(browser) & CONTENT_RESTRICTION_PRINT);
+ GetContentRestrictions(browser) & CONTENT_RESTRICTION_PRINT);
}
#if defined(ENABLE_BASIC_PRINTING)
« no previous file with comments | « chrome/browser/ui/browser.cc ('k') | chrome/browser/ui/browser_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698