| 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" |
| 11 #include "base/values.h" | 11 #include "base/values.h" |
| 12 #include "chrome/browser/printing/print_job_worker.h" | 12 #include "chrome/browser/printing/print_job_worker.h" |
| 13 #include "chrome/browser/printing/printing_ui_web_contents_observer.h" | 13 #include "chrome/browser/printing/printing_ui_web_contents_observer.h" |
| 14 | 14 |
| 15 namespace printing { | 15 namespace printing { |
| 16 | 16 |
| 17 PrinterQuery::PrinterQuery() | 17 PrinterQuery::PrinterQuery() |
| 18 : io_message_loop_(base::MessageLoop::current()), | 18 : io_message_loop_(base::MessageLoop::current()), |
| 19 worker_(new PrintJobWorker(this)), | 19 worker_(new PrintJobWorker(this)), |
| 20 is_print_dialog_box_shown_(false), | 20 is_print_dialog_box_shown_(false), |
| 21 cookie_(PrintSettings::NewCookie()), | 21 cookie_(PrintSettings::NewCookie()), |
| 22 last_status_(PrintingContext::FAILED) { | 22 last_status_(PrintingContext::FAILED) { |
| 23 DCHECK_EQ(io_message_loop_->type(), base::MessageLoop::TYPE_IO); | 23 DCHECK(base::MessageLoopForIO::IsCurrent()); |
| 24 } | 24 } |
| 25 | 25 |
| 26 PrinterQuery::~PrinterQuery() { | 26 PrinterQuery::~PrinterQuery() { |
| 27 // The job should be finished (or at least canceled) when it is destroyed. | 27 // The job should be finished (or at least canceled) when it is destroyed. |
| 28 DCHECK(!is_print_dialog_box_shown_); | 28 DCHECK(!is_print_dialog_box_shown_); |
| 29 // If this fires, it is that this pending printer context has leaked. | 29 // If this fires, it is that this pending printer context has leaked. |
| 30 DCHECK(!worker_.get()); | 30 DCHECK(!worker_.get()); |
| 31 } | 31 } |
| 32 | 32 |
| 33 void PrinterQuery::GetSettingsDone(const PrintSettings& new_settings, | 33 void PrinterQuery::GetSettingsDone(const PrintSettings& new_settings, |
| (...skipping 100 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 |