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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 scoped_ptr<PrintingUIWebContentsObserver> web_contents_observer, | 74 scoped_ptr<PrintingUIWebContentsObserver> web_contents_observer, |
75 int expected_page_count, | 75 int expected_page_count, |
76 bool has_selection, | 76 bool has_selection, |
77 MarginType margin_type, | 77 MarginType margin_type, |
78 const base::Closure& callback) { | 78 const base::Closure& callback) { |
79 DCHECK_EQ(io_message_loop_, base::MessageLoop::current()); | 79 DCHECK_EQ(io_message_loop_, base::MessageLoop::current()); |
80 DCHECK(!is_print_dialog_box_shown_); | 80 DCHECK(!is_print_dialog_box_shown_); |
81 | 81 |
82 StartWorker(callback); | 82 StartWorker(callback); |
83 | 83 |
84 // Real work is done in PrintJobWorker::Init(). | 84 // Real work is done in PrintJobWorker::GetSettings(). |
85 is_print_dialog_box_shown_ = ask_user_for_settings == ASK_USER; | 85 is_print_dialog_box_shown_ = ask_user_for_settings == ASK_USER; |
86 worker_->message_loop()->PostTask( | 86 worker_->message_loop()->PostTask( |
87 FROM_HERE, | 87 FROM_HERE, |
88 base::Bind(&PrintJobWorker::GetSettings, | 88 base::Bind(&PrintJobWorker::GetSettings, |
89 base::Unretained(worker_.get()), | 89 base::Unretained(worker_.get()), |
90 is_print_dialog_box_shown_, | 90 is_print_dialog_box_shown_, |
91 base::Passed(&web_contents_observer), | 91 base::Passed(&web_contents_observer), |
92 expected_page_count, | 92 expected_page_count, |
93 has_selection, | 93 has_selection, |
94 margin_type)); | 94 margin_type)); |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 | 134 |
135 bool PrinterQuery::is_callback_pending() const { | 135 bool PrinterQuery::is_callback_pending() const { |
136 return !callback_.is_null(); | 136 return !callback_.is_null(); |
137 } | 137 } |
138 | 138 |
139 bool PrinterQuery::is_valid() const { | 139 bool PrinterQuery::is_valid() const { |
140 return worker_.get() != NULL; | 140 return worker_.get() != NULL; |
141 } | 141 } |
142 | 142 |
143 } // namespace printing | 143 } // namespace printing |
OLD | NEW |