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

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

Issue 8428005: Print Preview: Making margin selection sticky (part 1/2). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Nit Created 9 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/ui/webui/print_preview_handler.h ('k') | printing/print_job_constants.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_handler.cc
diff --git a/chrome/browser/ui/webui/print_preview_handler.cc b/chrome/browser/ui/webui/print_preview_handler.cc
index d859e4cad9f023338ce4be0decc7e0de66ff484e..10e4081a0e2e2bbb03ee0cd08e53f68b073aa299 100644
--- a/chrome/browser/ui/webui/print_preview_handler.cc
+++ b/chrome/browser/ui/webui/print_preview_handler.cc
@@ -199,6 +199,8 @@ std::string* PrintPreviewHandler::last_used_printer_cloud_print_data_ = NULL;
std::string* PrintPreviewHandler::last_used_printer_name_ = NULL;
printing::ColorModels PrintPreviewHandler::last_used_color_model_ =
printing::UNKNOWN_COLOR_MODEL;
+printing::MarginType PrintPreviewHandler::last_used_margins_type_ =
+ printing::DEFAULT_MARGINS;
PrintPreviewHandler::PrintPreviewHandler()
: print_backend_(printing::PrintBackend::CreateInstance(NULL)),
@@ -389,6 +391,12 @@ void PrintPreviewHandler::HandlePrint(const ListValue* args) {
color_model = printing::GRAY;
last_used_color_model_ = static_cast<printing::ColorModels>(color_model);
+ // Storing last used margin settings.
+ int margin_type;
+ if (!settings->GetInteger(printing::kSettingMarginsType, &margin_type))
+ margin_type = printing::DEFAULT_MARGINS;
+ last_used_margins_type_ = static_cast<printing::MarginType>(margin_type);
+
bool print_to_pdf = false;
settings->GetBoolean(printing::kSettingPrintToPDF, &print_to_pdf);
@@ -647,9 +655,12 @@ void PrintPreviewHandler::SendPrinterCapabilities(
void PrintPreviewHandler::SendDefaultPrinter(
const StringValue& default_printer,
const StringValue& cloud_print_data) {
+ base::FundamentalValue margins_type(
+ PrintPreviewHandler::last_used_margins_type_);
web_ui_->CallJavascriptFunction("setDefaultPrinter",
default_printer,
- cloud_print_data);
+ cloud_print_data,
+ margins_type);
}
void PrintPreviewHandler::SetupPrinterList(const ListValue& printers) {
« no previous file with comments | « chrome/browser/ui/webui/print_preview_handler.h ('k') | printing/print_job_constants.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698