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

Unified Diff: chrome/browser/printing/printer_query.cc

Issue 6533006: Print Preview: Hook up the print button to initiate printing without displaying a print dialog. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: '' Created 9 years, 10 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
Index: chrome/browser/printing/printer_query.cc
diff --git a/chrome/browser/printing/printer_query.cc b/chrome/browser/printing/printer_query.cc
index f39960f89ff0fd2db6c1802881b730a2bcfe29d4..f1566eb2410e46887109ba168eb2b62c20268ef7 100644
--- a/chrome/browser/printing/printer_query.cc
+++ b/chrome/browser/printing/printer_query.cc
@@ -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.
@@ -107,6 +107,32 @@ void PrinterQuery::GetSettings(GetSettingsAskParam ask_user_for_settings,
use_overlays));
}
+void PrinterQuery::SetSettings(const std::string& new_settings,
+ CancelableTask* callback) {
+ DCHECK(!callback_.get());
+ DCHECK(worker_.get());
+ if (!worker_.get())
+ return;
+
+ // Lazy create the worker thread. There is one worker thread per print job.
+ if (!worker_->message_loop()) {
+ if (!worker_->Start()) {
+ if (callback) {
+ callback->Cancel();
+ delete callback;
+ }
+ NOTREACHED();
+ return;
+ }
+ }
+
+ callback_.reset(callback);
+ worker_->message_loop()->PostTask(FROM_HERE, NewRunnableMethod(
+ worker_.get(),
+ &PrintJobWorker::SetSettings,
+ new_settings));
+}
+
void PrinterQuery::StopWorker() {
if (worker_.get()) {
// http://crbug.com/66082: We're blocking on the PrinterQuery's worker

Powered by Google App Engine
This is Rietveld 408576698