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_preview_message_handler.h" | 5 #include "chrome/browser/printing/print_preview_message_handler.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
(...skipping 20 matching lines...) Expand all Loading... |
31 | 31 |
32 namespace { | 32 namespace { |
33 | 33 |
34 void StopWorker(int document_cookie) { | 34 void StopWorker(int document_cookie) { |
35 if (document_cookie <= 0) | 35 if (document_cookie <= 0) |
36 return; | 36 return; |
37 scoped_refptr<printing::PrintQueriesQueue> queue = | 37 scoped_refptr<printing::PrintQueriesQueue> queue = |
38 g_browser_process->print_job_manager()->queue(); | 38 g_browser_process->print_job_manager()->queue(); |
39 scoped_refptr<printing::PrinterQuery> printer_query = | 39 scoped_refptr<printing::PrinterQuery> printer_query = |
40 queue->PopPrinterQuery(document_cookie); | 40 queue->PopPrinterQuery(document_cookie); |
41 if (printer_query) { | 41 if (printer_query.get()) { |
42 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, | 42 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, |
43 base::Bind(&printing::PrinterQuery::StopWorker, | 43 base::Bind(&printing::PrinterQuery::StopWorker, |
44 printer_query)); | 44 printer_query)); |
45 } | 45 } |
46 } | 46 } |
47 | 47 |
48 base::RefCountedBytes* GetDataFromHandle(base::SharedMemoryHandle handle, | 48 base::RefCountedBytes* GetDataFromHandle(base::SharedMemoryHandle handle, |
49 uint32 data_size) { | 49 uint32 data_size) { |
50 scoped_ptr<base::SharedMemory> shared_buf( | 50 scoped_ptr<base::SharedMemory> shared_buf( |
51 new base::SharedMemory(handle, true)); | 51 new base::SharedMemory(handle, true)); |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 IPC_MESSAGE_HANDLER(PrintHostMsg_PrintPreviewInvalidPrinterSettings, | 223 IPC_MESSAGE_HANDLER(PrintHostMsg_PrintPreviewInvalidPrinterSettings, |
224 OnInvalidPrinterSettings) | 224 OnInvalidPrinterSettings) |
225 IPC_MESSAGE_HANDLER(PrintHostMsg_SetOptionsFromDocument, | 225 IPC_MESSAGE_HANDLER(PrintHostMsg_SetOptionsFromDocument, |
226 OnSetOptionsFromDocument) | 226 OnSetOptionsFromDocument) |
227 IPC_MESSAGE_UNHANDLED(handled = false) | 227 IPC_MESSAGE_UNHANDLED(handled = false) |
228 IPC_END_MESSAGE_MAP() | 228 IPC_END_MESSAGE_MAP() |
229 return handled; | 229 return handled; |
230 } | 230 } |
231 | 231 |
232 } // namespace printing | 232 } // namespace printing |
OLD | NEW |