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

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

Issue 10808006: Move printing.* prefs from local state to profile (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased just in case as the CL is a few days old now plus I got my branches all mixed up a bit. Created 8 years, 5 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_command_controller.cc ('k') | chrome/browser/ui/browser_ui_prefs.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 14c1957a533061531b962ea5297480f81542a552..c3ee94d93d81faca1679e3be092ffc031e9752a3 100644
--- a/chrome/browser/ui/browser_commands.cc
+++ b/chrome/browser/ui/browser_commands.cc
@@ -654,8 +654,8 @@ void ShowChromeToMobileBubble(Browser* browser) {
}
void Print(Browser* browser) {
- if (g_browser_process->local_state()->GetBoolean(
- prefs::kPrintPreviewDisabled)) {
+ if (browser->profile()->GetPrefs()->GetBoolean(
+ prefs::kPrintPreviewDisabled)) {
GetActiveTabContents(browser)->print_view_manager()->PrintNow();
} else {
GetActiveTabContents(browser)->print_view_manager()->
@@ -664,15 +664,11 @@ void Print(Browser* browser) {
}
bool CanPrint(const Browser* browser) {
- // LocalState can be NULL in tests.
- if (g_browser_process->local_state() &&
- !g_browser_process->local_state()->GetBoolean(prefs::kPrintingEnabled)) {
- return false;
- }
-
+ // Do not print when printing is disabled via pref or policy.
// Do not print when a constrained window is showing. It's confusing.
// Do not print if instant extended API is enabled and mode is NTP.
- return !(HasConstrainedWindow(browser) ||
+ return browser->profile()->GetPrefs()->GetBoolean(prefs::kPrintingEnabled) &&
+ !(HasConstrainedWindow(browser) ||
GetContentRestrictions(browser) & content::CONTENT_RESTRICTION_PRINT ||
IsNTPModeForInstantExtendedAPI(browser));
}
@@ -683,14 +679,10 @@ void AdvancedPrint(Browser* browser) {
}
bool CanAdvancedPrint(const Browser* browser) {
- // LocalState can be NULL in tests.
- if (g_browser_process->local_state() &&
- !g_browser_process->local_state()->GetBoolean(prefs::kPrintingEnabled)) {
- return false;
- }
-
- // It is always possible to advanced print when print preview is visible.
- return PrintPreviewShowing(browser) || CanPrint(browser);
+ // If printing is not disabled via pref or policy, it is always possible to
+ // advanced print when the print preview is visible.
+ return browser->profile()->GetPrefs()->GetBoolean(prefs::kPrintingEnabled) &&
+ (PrintPreviewShowing(browser) || CanPrint(browser));
}
void PrintToDestination(Browser* browser) {
« no previous file with comments | « chrome/browser/ui/browser_command_controller.cc ('k') | chrome/browser/ui/browser_ui_prefs.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698