summaryrefslogtreecommitdiffstats
path: root/printing
diff options
context:
space:
mode:
authorrltoscano@chromium.org <rltoscano@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-01-14 00:59:46 +0000
committerrltoscano@chromium.org <rltoscano@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-01-14 00:59:46 +0000
commit19d1c2d57b0086979e416e418117314b1af7f2a4 (patch)
tree43f839607007da5aa0f6d403eb389ce323fad046 /printing
parent57f6212707a418941288c5f127535755e0dbeb17 (diff)
downloadchromium_src-19d1c2d57b0086979e416e418117314b1af7f2a4.zip
chromium_src-19d1c2d57b0086979e416e418117314b1af7f2a4.tar.gz
chromium_src-19d1c2d57b0086979e416e418117314b1af7f2a4.tar.bz2
Adds option to enable CSS backgrounds for printing.
BUG=113594 Review URL: https://chromiumcodereview.appspot.com/11818062 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@176617 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'printing')
-rw-r--r--printing/print_job_constants.cc3
-rw-r--r--printing/print_job_constants.h1
-rw-r--r--printing/print_settings.cc5
-rw-r--r--printing/print_settings.h3
-rw-r--r--printing/printing_context.cc6
5 files changed, 17 insertions, 1 deletions
diff --git a/printing/print_job_constants.cc b/printing/print_job_constants.cc
index 8cd6208..55397b6 100644
--- a/printing/print_job_constants.cc
+++ b/printing/print_job_constants.cc
@@ -116,6 +116,9 @@ const char kSettingPrinterName[] = "printerName";
// Print to PDF option: true if selected, false if not.
const char kSettingPrintToPDF[] = "printToPDF";
+// Whether to print CSS backgrounds.
+const char kSettingShouldPrintBackgrounds[] = "shouldPrintBackgrounds";
+
// Indices used to represent first preview page and complete preview document.
const int FIRST_PAGE_INDEX = 0;
const int COMPLETE_PREVIEW_DOCUMENT_INDEX = -1;
diff --git a/printing/print_job_constants.h b/printing/print_job_constants.h
index 88bf125..fcee819 100644
--- a/printing/print_job_constants.h
+++ b/printing/print_job_constants.h
@@ -47,6 +47,7 @@ PRINTING_EXPORT extern const char kSettingPrintableAreaWidth[];
PRINTING_EXPORT extern const char kSettingPrintableAreaHeight[];
PRINTING_EXPORT extern const char kSettingPrinterName[];
PRINTING_EXPORT extern const char kSettingPrintToPDF[];
+PRINTING_EXPORT extern const char kSettingShouldPrintBackgrounds[];
PRINTING_EXPORT extern const int FIRST_PAGE_INDEX;
PRINTING_EXPORT extern const int COMPLETE_PREVIEW_DOCUMENT_INDEX;
diff --git a/printing/print_settings.cc b/printing/print_settings.cc
index 2b9b6f4..e665c17 100644
--- a/printing/print_settings.cc
+++ b/printing/print_settings.cc
@@ -117,6 +117,7 @@ PrintSettings::PrintSettings()
selection_only(false),
margin_type(DEFAULT_MARGINS),
display_header_footer(false),
+ should_print_backgrounds(false),
dpi_(0),
landscape_(false),
supports_alpha_blend_(true) {
@@ -141,6 +142,7 @@ void PrintSettings::Clear() {
dpi_ = 0;
landscape_ = false;
supports_alpha_blend_ = true;
+ should_print_backgrounds = false;
}
void PrintSettings::SetPrinterPrintableArea(
@@ -231,7 +233,8 @@ bool PrintSettings::Equals(const PrintSettings& rhs) const {
device_name_ == rhs.device_name_ &&
page_setup_device_units_.Equals(rhs.page_setup_device_units_) &&
dpi_ == rhs.dpi_ &&
- landscape_ == rhs.landscape_;
+ landscape_ == rhs.landscape_ &&
+ should_print_backgrounds == rhs.should_print_backgrounds;
}
int PrintSettings::NewCookie() {
diff --git a/printing/print_settings.h b/printing/print_settings.h
index 8026cbc..3a55502 100644
--- a/printing/print_settings.h
+++ b/printing/print_settings.h
@@ -116,6 +116,9 @@ class PRINTING_EXPORT PrintSettings {
// True if the user wants headers and footers to be displayed.
bool display_header_footer;
+ // True if the user wants to print CSS backgrounds.
+ bool should_print_backgrounds;
+
private:
//////////////////////////////////////////////////////////////////////////////
// Settings that can't be changed without side-effects.
diff --git a/printing/printing_context.cc b/printing/printing_context.cc
index 09a93ff..a29b31a 100644
--- a/printing/printing_context.cc
+++ b/printing/printing_context.cc
@@ -78,6 +78,12 @@ PrintingContext::Result PrintingContext::UpdatePrintSettings(
PrintingContext::Result result = UpdatePrinterSettings(job_settings, ranges);
PrintSettingsInitializer::InitHeaderFooterStrings(job_settings, &settings_);
+
+ if (!job_settings.GetBoolean(kSettingShouldPrintBackgrounds,
+ &settings_.should_print_backgrounds)) {
+ NOTREACHED();
+ }
+
return result;
}