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) { |
Lei Zhang
2011/02/24 03:49:32
nit: indentation doesn't follow the style in the r
kmadhusu
2011/03/01 01:55:50
Fixed.
|
+ DCHECK(!callback_.get()); |
Lei Zhang
2011/02/24 03:49:32
You're duplicating code from PrinterQuery::GetSett
kmadhusu
2011/03/01 01:55:50
Added a common method "StartWorker()".
|
+ 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 |