| 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/print_view_manager.h" | 5 #include "chrome/browser/printing/print_view_manager.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 map.find(scripted_print_preview_rph_); | 126 map.find(scripted_print_preview_rph_); |
| 127 CHECK(it != map.end()); | 127 CHECK(it != map.end()); |
| 128 it->second.Run(); | 128 it->second.Run(); |
| 129 map.erase(scripted_print_preview_rph_); | 129 map.erase(scripted_print_preview_rph_); |
| 130 scripted_print_preview_rph_ = NULL; | 130 scripted_print_preview_rph_ = NULL; |
| 131 } | 131 } |
| 132 print_preview_state_ = NOT_PREVIEWING; | 132 print_preview_state_ = NOT_PREVIEWING; |
| 133 } | 133 } |
| 134 | 134 |
| 135 void PrintViewManager::PreviewPrintingRequestCancelled() { | 135 void PrintViewManager::PreviewPrintingRequestCancelled() { |
| 136 if (!web_contents()) | |
| 137 return; | |
| 138 Send(new PrintMsg_PreviewPrintingRequestCancelled(routing_id())); | 136 Send(new PrintMsg_PreviewPrintingRequestCancelled(routing_id())); |
| 139 } | 137 } |
| 140 | 138 |
| 139 void PrintViewManager::SetScriptedPrintingBlocked(bool blocked) { |
| 140 Send(new PrintMsg_SetScriptedPrintingBlocked(routing_id(), blocked)); |
| 141 } |
| 142 |
| 141 void PrintViewManager::set_observer(PrintViewManagerObserver* observer) { | 143 void PrintViewManager::set_observer(PrintViewManagerObserver* observer) { |
| 142 DCHECK(!observer || !observer_); | 144 DCHECK(!observer || !observer_); |
| 143 observer_ = observer; | 145 observer_ = observer; |
| 144 } | 146 } |
| 145 | 147 |
| 146 void PrintViewManager::StopNavigation() { | 148 void PrintViewManager::StopNavigation() { |
| 147 // Cancel the current job, wait for the worker to finish. | 149 // Cancel the current job, wait for the worker to finish. |
| 148 TerminatePrintJob(true); | 150 TerminatePrintJob(true); |
| 149 } | 151 } |
| 150 | 152 |
| (...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 614 scoped_refptr<printing::PrinterQuery> printer_query; | 616 scoped_refptr<printing::PrinterQuery> printer_query; |
| 615 print_job_manager->PopPrinterQuery(cookie, &printer_query); | 617 print_job_manager->PopPrinterQuery(cookie, &printer_query); |
| 616 if (!printer_query.get()) | 618 if (!printer_query.get()) |
| 617 return; | 619 return; |
| 618 BrowserThread::PostTask( | 620 BrowserThread::PostTask( |
| 619 BrowserThread::IO, FROM_HERE, | 621 BrowserThread::IO, FROM_HERE, |
| 620 base::Bind(&PrinterQuery::StopWorker, printer_query.get())); | 622 base::Bind(&PrinterQuery::StopWorker, printer_query.get())); |
| 621 } | 623 } |
| 622 | 624 |
| 623 } // namespace printing | 625 } // namespace printing |
| OLD | NEW |