| 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/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| 11 #include "base/timer/timer.h" | 11 #include "base/timer/timer.h" |
| 12 #include "chrome/browser/browser_process.h" | 12 #include "chrome/browser/browser_process.h" |
| 13 #include "chrome/browser/chrome_notification_types.h" | 13 #include "chrome/browser/chrome_notification_types.h" |
| 14 #include "chrome/browser/printing/print_job.h" | 14 #include "chrome/browser/printing/print_job.h" |
| 15 #include "chrome/browser/printing/print_job_manager.h" | 15 #include "chrome/browser/printing/print_job_manager.h" |
| 16 #include "chrome/browser/printing/printer_query.h" | 16 #include "chrome/browser/printing/printer_query.h" |
| 17 #include "chrome/browser/profiles/profile.h" | 17 #include "chrome/browser/profiles/profile.h" |
| 18 #include "chrome/browser/ui/simple_message_box.h" | 18 #include "chrome/browser/ui/simple_message_box.h" |
| 19 #include "chrome/common/pref_names.h" | 19 #include "chrome/common/pref_names.h" |
| 20 #include "chrome/common/print_messages.h" | 20 #include "chrome/common/print_messages.h" |
| 21 #include "chrome/grit/generated_resources.h" | 21 #include "chrome/grit/generated_resources.h" |
| 22 #include "content/public/browser/browser_thread.h" | 22 #include "content/public/browser/browser_thread.h" |
| 23 #include "content/public/browser/notification_details.h" | 23 #include "content/public/browser/notification_details.h" |
| 24 #include "content/public/browser/notification_service.h" | 24 #include "content/public/browser/notification_service.h" |
| 25 #include "content/public/browser/notification_source.h" | 25 #include "content/public/browser/notification_source.h" |
| 26 #include "content/public/browser/render_view_host.h" | 26 #include "content/public/browser/render_view_host.h" |
| 27 #include "content/public/browser/web_contents.h" | 27 #include "content/public/browser/web_contents.h" |
| 28 #include "printing/metafile_impl.h" | 28 #include "printing/pdf_metafile_skia.h" |
| 29 #include "printing/printed_document.h" | 29 #include "printing/printed_document.h" |
| 30 #include "ui/base/l10n/l10n_util.h" | 30 #include "ui/base/l10n/l10n_util.h" |
| 31 | 31 |
| 32 #if defined(ENABLE_FULL_PRINTING) | 32 #if defined(ENABLE_FULL_PRINTING) |
| 33 #include "chrome/browser/printing/print_error_dialog.h" | 33 #include "chrome/browser/printing/print_error_dialog.h" |
| 34 #endif | 34 #endif |
| 35 | 35 |
| 36 #if defined(OS_WIN) | 36 #if defined(OS_WIN) |
| 37 #include "base/memory/ref_counted.h" | 37 #include "base/memory/ref_counted.h" |
| 38 #include "base/memory/ref_counted_memory.h" | 38 #include "base/memory/ref_counted_memory.h" |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 | 176 |
| 177 base::SharedMemory shared_buf(params.metafile_data_handle, true); | 177 base::SharedMemory shared_buf(params.metafile_data_handle, true); |
| 178 if (metafile_must_be_valid) { | 178 if (metafile_must_be_valid) { |
| 179 if (!shared_buf.Map(params.data_size)) { | 179 if (!shared_buf.Map(params.data_size)) { |
| 180 NOTREACHED() << "couldn't map"; | 180 NOTREACHED() << "couldn't map"; |
| 181 web_contents()->Stop(); | 181 web_contents()->Stop(); |
| 182 return; | 182 return; |
| 183 } | 183 } |
| 184 } | 184 } |
| 185 | 185 |
| 186 scoped_ptr<NativeMetafile> metafile(new NativeMetafile); | 186 scoped_ptr<PdfMetafileSkia> metafile(new PdfMetafileSkia); |
| 187 if (metafile_must_be_valid) { | 187 if (metafile_must_be_valid) { |
| 188 if (!metafile->InitFromData(shared_buf.memory(), params.data_size)) { | 188 if (!metafile->InitFromData(shared_buf.memory(), params.data_size)) { |
| 189 NOTREACHED() << "Invalid metafile header"; | 189 NOTREACHED() << "Invalid metafile header"; |
| 190 web_contents()->Stop(); | 190 web_contents()->Stop(); |
| 191 return; | 191 return; |
| 192 } | 192 } |
| 193 } | 193 } |
| 194 | 194 |
| 195 #if !defined(OS_WIN) | 195 #if !defined(OS_WIN) |
| 196 // Update the rendered document. It will send notifications to the listener. | 196 // Update the rendered document. It will send notifications to the listener. |
| (...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 563 scoped_refptr<printing::PrinterQuery> printer_query; | 563 scoped_refptr<printing::PrinterQuery> printer_query; |
| 564 printer_query = queue_->PopPrinterQuery(cookie); | 564 printer_query = queue_->PopPrinterQuery(cookie); |
| 565 if (!printer_query.get()) | 565 if (!printer_query.get()) |
| 566 return; | 566 return; |
| 567 BrowserThread::PostTask( | 567 BrowserThread::PostTask( |
| 568 BrowserThread::IO, FROM_HERE, | 568 BrowserThread::IO, FROM_HERE, |
| 569 base::Bind(&PrinterQuery::StopWorker, printer_query.get())); | 569 base::Bind(&PrinterQuery::StopWorker, printer_query.get())); |
| 570 } | 570 } |
| 571 | 571 |
| 572 } // namespace printing | 572 } // namespace printing |
| OLD | NEW |