summaryrefslogtreecommitdiffstats
path: root/printing
diff options
context:
space:
mode:
authorkmadhusu@chromium.org <kmadhusu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-05 00:12:53 +0000
committerkmadhusu@chromium.org <kmadhusu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-05 00:12:53 +0000
commit7868ecabafc39bcd917276899742be136cca2ae3 (patch)
treeb008edd73081d0df868eae216e18cc6dc56d382d /printing
parentf41067c4ff04b9552c48e89169b28cf078c1a8ba (diff)
downloadchromium_src-7868ecabafc39bcd917276899742be136cca2ae3.zip
chromium_src-7868ecabafc39bcd917276899742be136cca2ae3.tar.gz
chromium_src-7868ecabafc39bcd917276899742be136cca2ae3.tar.bz2
(1) Hook up the print button to send the pages to the default printer for printing without displaying a native dialog.
(2) Made code changes to accept a print page range from the user and to print only those specified pages. BUG=none TEST=Enable print preview on mac, provide a valid page range and make sure print button in print preview works. Review URL: http://codereview.chromium.org/6533006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@77003 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'printing')
-rw-r--r--printing/printing_context.h6
-rw-r--r--printing/printing_context_cairo.cc11
-rw-r--r--printing/printing_context_cairo.h1
-rw-r--r--printing/printing_context_mac.h3
-rw-r--r--printing/printing_context_mac.mm15
-rw-r--r--printing/printing_context_win.cc11
-rw-r--r--printing/printing_context_win.h3
7 files changed, 46 insertions, 4 deletions
diff --git a/printing/printing_context.h b/printing/printing_context.h
index 6d51f02..d7d5016 100644
--- a/printing/printing_context.h
+++ b/printing/printing_context.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -47,6 +47,10 @@ class PrintingContext {
// default device settings.
virtual Result UseDefaultSettings() = 0;
+ // Update print settings. As of now we are updating the page range settings.
+ // In the future, update other print job settings.
+ virtual Result UpdatePrintSettings(const PageRanges& ranges) = 0;
+
// Initializes with predefined settings.
virtual Result InitWithSettings(const PrintSettings& settings) = 0;
diff --git a/printing/printing_context_cairo.cc b/printing/printing_context_cairo.cc
index 84aaa64..c8b0ef3 100644
--- a/printing/printing_context_cairo.cc
+++ b/printing/printing_context_cairo.cc
@@ -151,6 +151,17 @@ PrintingContext::Result PrintingContextCairo::UseDefaultSettings() {
return OK;
}
+PrintingContext::Result PrintingContextCairo::UpdatePrintSettings(
+ const PageRanges& ranges) {
+ DCHECK(!in_print_job_);
+
+ settings_.ranges = ranges;
+
+ NOTIMPLEMENTED();
+
+ return FAILED;
+}
+
PrintingContext::Result PrintingContextCairo::InitWithSettings(
const PrintSettings& settings) {
DCHECK(!in_print_job_);
diff --git a/printing/printing_context_cairo.h b/printing/printing_context_cairo.h
index 9a88eae..514b341 100644
--- a/printing/printing_context_cairo.h
+++ b/printing/printing_context_cairo.h
@@ -40,6 +40,7 @@ class PrintingContextCairo : public PrintingContext {
bool has_selection,
PrintSettingsCallback* callback);
virtual Result UseDefaultSettings();
+ virtual Result UpdatePrintSettings(const PageRanges& ranges);
virtual Result InitWithSettings(const PrintSettings& settings);
virtual Result NewDocument(const string16& document_name);
virtual Result NewPage();
diff --git a/printing/printing_context_mac.h b/printing/printing_context_mac.h
index 8f6bf34..b709460 100644
--- a/printing/printing_context_mac.h
+++ b/printing/printing_context_mac.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -28,6 +28,7 @@ class PrintingContextMac : public PrintingContext {
bool has_selection,
PrintSettingsCallback* callback);
virtual Result UseDefaultSettings();
+ virtual Result UpdatePrintSettings(const PageRanges& ranges);
virtual Result InitWithSettings(const PrintSettings& settings);
virtual Result NewDocument(const string16& document_name);
virtual Result NewPage();
diff --git a/printing/printing_context_mac.mm b/printing/printing_context_mac.mm
index 1826c49..575875d 100644
--- a/printing/printing_context_mac.mm
+++ b/printing/printing_context_mac.mm
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -80,6 +80,19 @@ PrintingContext::Result PrintingContextMac::UseDefaultSettings() {
return OK;
}
+PrintingContext::Result PrintingContextMac::UpdatePrintSettings(
+ const PageRanges& ranges) {
+ DCHECK(!in_print_job_);
+
+ // TODO (kmadhusu): Update other print job settings such as number of copies,
+ // collate, etc.,
+
+ // Update the print range information.
+ settings_.ranges = ranges;
+
+ return OK;
+}
+
void PrintingContextMac::ParsePrintInfo(NSPrintInfo* print_info) {
ResetSettings();
print_info_ = [print_info retain];
diff --git a/printing/printing_context_win.cc b/printing/printing_context_win.cc
index 3d40739..467bf3c 100644
--- a/printing/printing_context_win.cc
+++ b/printing/printing_context_win.cc
@@ -208,6 +208,17 @@ PrintingContext::Result PrintingContextWin::UseDefaultSettings() {
return ParseDialogResult(dialog_options);
}
+PrintingContext::Result PrintingContextWin::UpdatePrintSettings(
+ const PageRanges& ranges) {
+ DCHECK(!in_print_job_);
+
+ settings_.ranges = ranges;
+
+ NOTIMPLEMENTED();
+
+ return FAILED;
+}
+
PrintingContext::Result PrintingContextWin::InitWithSettings(
const PrintSettings& settings) {
DCHECK(!in_print_job_);
diff --git a/printing/printing_context_win.h b/printing/printing_context_win.h
index d42bf97..4037536 100644
--- a/printing/printing_context_win.h
+++ b/printing/printing_context_win.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -28,6 +28,7 @@ class PrintingContextWin : public PrintingContext {
bool has_selection,
PrintSettingsCallback* callback);
virtual Result UseDefaultSettings();
+ virtual Result UpdatePrintSettings(const PageRanges& ranges);
virtual Result InitWithSettings(const PrintSettings& settings);
virtual Result NewDocument(const string16& document_name);
virtual Result NewPage();