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(scoped_ptr<base::DictionaryValue> new_settings, |
92 const base::Closure& callback) { | 92 const base::Closure& callback) { |
93 StartWorker(callback); | 93 StartWorker(callback); |
94 | 94 |
95 worker_->PostTask(FROM_HERE, | 95 worker_->PostTask(FROM_HERE, |
96 base::Bind(&PrintJobWorker::SetSettings, | 96 base::Bind(&PrintJobWorker::SetSettings, |
97 base::Unretained(worker_.get()), | 97 base::Unretained(worker_.get()), |
98 new_settings.DeepCopy())); | 98 base::Passed(&new_settings))); |
99 } | 99 } |
100 | 100 |
101 void PrinterQuery::SetWorkerDestination( | 101 void PrinterQuery::SetWorkerDestination( |
102 PrintDestinationInterface* destination) { | 102 PrintDestinationInterface* destination) { |
103 worker_->SetPrintDestination(destination); | 103 worker_->SetPrintDestination(destination); |
104 } | 104 } |
105 | 105 |
106 void PrinterQuery::StartWorker(const base::Closure& callback) { | 106 void PrinterQuery::StartWorker(const base::Closure& callback) { |
107 DCHECK(callback_.is_null()); | 107 DCHECK(callback_.is_null()); |
108 DCHECK(worker_.get()); | 108 DCHECK(worker_.get()); |
(...skipping 18 matching lines...) Expand all Loading... |
127 | 127 |
128 bool PrinterQuery::is_callback_pending() const { | 128 bool PrinterQuery::is_callback_pending() const { |
129 return !callback_.is_null(); | 129 return !callback_.is_null(); |
130 } | 130 } |
131 | 131 |
132 bool PrinterQuery::is_valid() const { | 132 bool PrinterQuery::is_valid() const { |
133 return worker_.get() != NULL; | 133 return worker_.get() != NULL; |
134 } | 134 } |
135 | 135 |
136 } // namespace printing | 136 } // namespace printing |
OLD | NEW |