OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/printing/printer_query.h" | 5 #include "chrome/browser/printing/printer_query.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/threading/thread_restrictions.h" | 10 #include "base/threading/thread_restrictions.h" |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 worker_->PostTask(FROM_HERE, | 81 worker_->PostTask(FROM_HERE, |
82 base::Bind(&PrintJobWorker::GetSettings, | 82 base::Bind(&PrintJobWorker::GetSettings, |
83 base::Unretained(worker_.get()), | 83 base::Unretained(worker_.get()), |
84 is_print_dialog_box_shown_, | 84 is_print_dialog_box_shown_, |
85 base::Passed(&web_contents_observer), | 85 base::Passed(&web_contents_observer), |
86 expected_page_count, | 86 expected_page_count, |
87 has_selection, | 87 has_selection, |
88 margin_type)); | 88 margin_type)); |
89 } | 89 } |
90 | 90 |
91 void PrinterQuery::SetSettings(const base::DictionaryValue& new_settings, | 91 void PrinterQuery::SetSettings( |
92 const base::Closure& callback) { | 92 scoped_ptr<PrintingUIWebContentsObserver> web_contents_observer, |
| 93 scoped_ptr<base::DictionaryValue> new_settings, |
| 94 const base::Closure& callback) { |
93 StartWorker(callback); | 95 StartWorker(callback); |
94 | 96 |
95 worker_->PostTask(FROM_HERE, | 97 worker_->PostTask(FROM_HERE, |
96 base::Bind(&PrintJobWorker::SetSettings, | 98 base::Bind(&PrintJobWorker::SetSettings, |
97 base::Unretained(worker_.get()), | 99 base::Unretained(worker_.get()), |
98 new_settings.DeepCopy())); | 100 base::Passed(&web_contents_observer), |
| 101 base::Passed(&new_settings))); |
99 } | 102 } |
100 | 103 |
101 void PrinterQuery::SetWorkerDestination( | 104 void PrinterQuery::SetWorkerDestination( |
102 PrintDestinationInterface* destination) { | 105 PrintDestinationInterface* destination) { |
103 worker_->SetPrintDestination(destination); | 106 worker_->SetPrintDestination(destination); |
104 } | 107 } |
105 | 108 |
106 void PrinterQuery::StartWorker(const base::Closure& callback) { | 109 void PrinterQuery::StartWorker(const base::Closure& callback) { |
107 DCHECK(callback_.is_null()); | 110 DCHECK(callback_.is_null()); |
108 DCHECK(worker_.get()); | 111 DCHECK(worker_.get()); |
(...skipping 18 matching lines...) Expand all Loading... |
127 | 130 |
128 bool PrinterQuery::is_callback_pending() const { | 131 bool PrinterQuery::is_callback_pending() const { |
129 return !callback_.is_null(); | 132 return !callback_.is_null(); |
130 } | 133 } |
131 | 134 |
132 bool PrinterQuery::is_valid() const { | 135 bool PrinterQuery::is_valid() const { |
133 return worker_.get() != NULL; | 136 return worker_.get() != NULL; |
134 } | 137 } |
135 | 138 |
136 } // namespace printing | 139 } // namespace printing |
OLD | NEW |