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

Unified Diff: chrome/browser/ui/webui/print_preview/print_preview_handler.cc

Issue 1368013004: Define Print Preview default printer selection policy (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add tags to DefaultPrinterSelection policy. Created 5 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/resources/print_preview/print_preview.js ('k') | chrome/common/pref_names.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/webui/print_preview/print_preview_handler.cc
diff --git a/chrome/browser/ui/webui/print_preview/print_preview_handler.cc b/chrome/browser/ui/webui/print_preview/print_preview_handler.cc
index acd2fe5ddea5d155881f8a0b34d4c4926e64ab54..bff5620d03866cbeb64c6cb5c25e78517a5e99a9 100644
--- a/chrome/browser/ui/webui/print_preview/print_preview_handler.cc
+++ b/chrome/browser/ui/webui/print_preview/print_preview_handler.cc
@@ -169,6 +169,9 @@ const char kHidePrintWithSystemDialogLink[] = "hidePrintWithSystemDialogLink";
#endif
// Name of a dictionary field holding the state of selection for document.
const char kDocumentHasSelection[] = "documentHasSelection";
+// Dictionary field holding the default destination selection rules.
+const char kDefaultDestinationSelectionRules[] =
+ "defaultDestinationSelectionRules";
// Id of the predefined PDF printer.
const char kLocalPdfPrinterId[] = "Save as PDF";
@@ -1256,9 +1259,10 @@ void PrintPreviewHandler::SendInitialSettings(
print_preview_ui()->source_has_selection());
initial_settings.SetBoolean(printing::kSettingShouldPrintSelectionOnly,
print_preview_ui()->print_selection_only());
+ PrefService* prefs = Profile::FromBrowserContext(
+ preview_web_contents()->GetBrowserContext())->GetPrefs();
printing::StickySettings* sticky_settings = GetStickySettings();
- sticky_settings->RestoreFromPrefs(Profile::FromBrowserContext(
- preview_web_contents()->GetBrowserContext())->GetPrefs());
+ sticky_settings->RestoreFromPrefs(prefs);
if (sticky_settings->printer_app_state()) {
initial_settings.SetString(kAppState,
*sticky_settings->printer_app_state());
@@ -1276,6 +1280,12 @@ void PrintPreviewHandler::SendInitialSettings(
bool is_ash = (chrome::GetActiveDesktop() == chrome::HOST_DESKTOP_TYPE_ASH);
initial_settings.SetBoolean(kHidePrintWithSystemDialogLink, is_ash);
#endif
+ if (prefs) {
+ const std::string rules_str =
+ prefs->GetString(prefs::kPrintPreviewDefaultDestinationSelectionRules);
+ if (!rules_str.empty())
+ initial_settings.SetString(kDefaultDestinationSelectionRules, rules_str);
+ }
if (print_preview_ui()->source_is_modifiable())
GetNumberFormatAndMeasurementSystem(&initial_settings);
« no previous file with comments | « chrome/browser/resources/print_preview/print_preview.js ('k') | chrome/common/pref_names.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698