OLD | NEW |
---|---|
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/message_loop.h" | 7 #include "base/message_loop.h" |
8 #include "base/thread_restrictions.h" | |
8 #include "chrome/browser/printing/print_job_worker.h" | 9 #include "chrome/browser/printing/print_job_worker.h" |
9 | 10 |
10 namespace printing { | 11 namespace printing { |
11 | 12 |
12 PrinterQuery::PrinterQuery() | 13 PrinterQuery::PrinterQuery() |
13 : io_message_loop_(MessageLoop::current()), | 14 : io_message_loop_(MessageLoop::current()), |
14 ALLOW_THIS_IN_INITIALIZER_LIST(worker_(new PrintJobWorker(this))), | 15 ALLOW_THIS_IN_INITIALIZER_LIST(worker_(new PrintJobWorker(this))), |
15 is_print_dialog_box_shown_(false), | 16 is_print_dialog_box_shown_(false), |
16 cookie_(PrintSettings::NewCookie()), | 17 cookie_(PrintSettings::NewCookie()), |
17 last_status_(PrintingContext::FAILED) { | 18 last_status_(PrintingContext::FAILED) { |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
89 &PrintJobWorker::GetSettings, | 90 &PrintJobWorker::GetSettings, |
90 is_print_dialog_box_shown_, | 91 is_print_dialog_box_shown_, |
91 parent_view, | 92 parent_view, |
92 expected_page_count, | 93 expected_page_count, |
93 has_selection, | 94 has_selection, |
94 use_overlays)); | 95 use_overlays)); |
95 } | 96 } |
96 | 97 |
97 void PrinterQuery::StopWorker() { | 98 void PrinterQuery::StopWorker() { |
98 if (worker_.get()) { | 99 if (worker_.get()) { |
100 // http://crbug.com/66082 | |
Evan Martin
2010/12/10 21:43:04
Also include a note here about the bug. (E.g. it'
| |
101 base::ThreadRestrictions::ScopedAllowIO allow_io; | |
99 worker_->Stop(); | 102 worker_->Stop(); |
100 worker_.reset(); | 103 worker_.reset(); |
101 } | 104 } |
102 } | 105 } |
103 | 106 |
104 bool PrinterQuery::is_print_dialog_box_shown() const { | 107 bool PrinterQuery::is_print_dialog_box_shown() const { |
105 return is_print_dialog_box_shown_; | 108 return is_print_dialog_box_shown_; |
106 } | 109 } |
107 | 110 |
108 bool PrinterQuery::is_callback_pending() const { | 111 bool PrinterQuery::is_callback_pending() const { |
109 return callback_.get() != NULL; | 112 return callback_.get() != NULL; |
110 } | 113 } |
111 | 114 |
112 bool PrinterQuery::is_valid() const { | 115 bool PrinterQuery::is_valid() const { |
113 return worker_.get() != NULL; | 116 return worker_.get() != NULL; |
114 } | 117 } |
115 | 118 |
116 } // namespace printing | 119 } // namespace printing |
OLD | NEW |