| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_base.h" | 5 #include "chrome/browser/printing/print_view_manager_base.h" |
| 6 | 6 |
| 7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/location.h" |
| 9 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/prefs/pref_service.h" | 11 #include "base/prefs/pref_service.h" |
| 12 #include "base/single_thread_task_runner.h" |
| 11 #include "base/strings/utf_string_conversions.h" | 13 #include "base/strings/utf_string_conversions.h" |
| 14 #include "base/thread_task_runner_handle.h" |
| 12 #include "base/timer/timer.h" | 15 #include "base/timer/timer.h" |
| 13 #include "chrome/browser/browser_process.h" | 16 #include "chrome/browser/browser_process.h" |
| 14 #include "chrome/browser/chrome_notification_types.h" | 17 #include "chrome/browser/chrome_notification_types.h" |
| 15 #include "chrome/browser/printing/print_job.h" | 18 #include "chrome/browser/printing/print_job.h" |
| 16 #include "chrome/browser/printing/print_job_manager.h" | 19 #include "chrome/browser/printing/print_job_manager.h" |
| 17 #include "chrome/browser/printing/printer_query.h" | 20 #include "chrome/browser/printing/printer_query.h" |
| 18 #include "chrome/browser/profiles/profile.h" | 21 #include "chrome/browser/profiles/profile.h" |
| 19 #include "chrome/browser/ui/simple_message_box.h" | 22 #include "chrome/browser/ui/simple_message_box.h" |
| 20 #include "chrome/common/pref_names.h" | 23 #include "chrome/common/pref_names.h" |
| 21 #include "chrome/grit/generated_resources.h" | 24 #include "chrome/grit/generated_resources.h" |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 | 204 |
| 202 ReleasePrinterQuery(); | 205 ReleasePrinterQuery(); |
| 203 | 206 |
| 204 content::NotificationService::current()->Notify( | 207 content::NotificationService::current()->Notify( |
| 205 chrome::NOTIFICATION_PRINT_JOB_RELEASED, | 208 chrome::NOTIFICATION_PRINT_JOB_RELEASED, |
| 206 content::Source<content::WebContents>(web_contents()), | 209 content::Source<content::WebContents>(web_contents()), |
| 207 content::NotificationService::NoDetails()); | 210 content::NotificationService::NoDetails()); |
| 208 } | 211 } |
| 209 | 212 |
| 210 void PrintViewManagerBase::OnShowInvalidPrinterSettingsError() { | 213 void PrintViewManagerBase::OnShowInvalidPrinterSettingsError() { |
| 211 base::MessageLoop::current()->PostTask( | 214 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 212 FROM_HERE, base::Bind(&ShowWarningMessageBox, | 215 FROM_HERE, base::Bind(&ShowWarningMessageBox, |
| 213 l10n_util::GetStringUTF16( | 216 l10n_util::GetStringUTF16( |
| 214 IDS_PRINT_INVALID_PRINTER_SETTINGS))); | 217 IDS_PRINT_INVALID_PRINTER_SETTINGS))); |
| 215 } | 218 } |
| 216 | 219 |
| 217 void PrintViewManagerBase::DidStartLoading() { | 220 void PrintViewManagerBase::DidStartLoading() { |
| 218 UpdateScriptedPrintingBlocked(); | 221 UpdateScriptedPrintingBlocked(); |
| 219 } | 222 } |
| 220 | 223 |
| 221 bool PrintViewManagerBase::OnMessageReceived(const IPC::Message& message) { | 224 bool PrintViewManagerBase::OnMessageReceived(const IPC::Message& message) { |
| (...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 526 scoped_refptr<printing::PrinterQuery> printer_query; | 529 scoped_refptr<printing::PrinterQuery> printer_query; |
| 527 printer_query = queue_->PopPrinterQuery(cookie); | 530 printer_query = queue_->PopPrinterQuery(cookie); |
| 528 if (!printer_query.get()) | 531 if (!printer_query.get()) |
| 529 return; | 532 return; |
| 530 BrowserThread::PostTask( | 533 BrowserThread::PostTask( |
| 531 BrowserThread::IO, FROM_HERE, | 534 BrowserThread::IO, FROM_HERE, |
| 532 base::Bind(&PrinterQuery::StopWorker, printer_query.get())); | 535 base::Bind(&PrinterQuery::StopWorker, printer_query.get())); |
| 533 } | 536 } |
| 534 | 537 |
| 535 } // namespace printing | 538 } // namespace printing |
| OLD | NEW |