OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "base/scoped_ptr.h" | 7 #include "base/scoped_ptr.h" |
8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
9 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
10 #include "chrome/browser/printing/print_job.h" | 10 #include "chrome/browser/printing/print_job.h" |
11 #include "chrome/browser/printing/print_job_manager.h" | 11 #include "chrome/browser/printing/print_job_manager.h" |
12 #include "chrome/browser/printing/printer_query.h" | 12 #include "chrome/browser/printing/printer_query.h" |
13 #include "chrome/browser/renderer_host/render_view_host.h" | 13 #include "chrome/browser/renderer_host/render_view_host.h" |
14 #include "chrome/browser/tab_contents/navigation_entry.h" | 14 #include "chrome/browser/tab_contents/navigation_entry.h" |
15 #include "chrome/browser/tab_contents/tab_contents.h" | 15 #include "chrome/browser/tab_contents/tab_contents.h" |
16 #include "chrome/common/notification_details.h" | 16 #include "chrome/common/notification_details.h" |
17 #include "chrome/common/notification_source.h" | 17 #include "chrome/common/notification_source.h" |
18 #include "chrome/common/render_messages.h" | 18 #include "chrome/common/render_messages.h" |
19 #include "chrome/common/render_messages_params.h" | 19 #include "chrome/common/render_messages_params.h" |
20 #include "grit/generated_resources.h" | 20 #include "grit/generated_resources.h" |
21 #include "printing/native_metafile.h" | 21 #include "printing/native_metafile.h" |
22 #include "printing/native_metafile_factory.h" | |
James Hawkins
2011/02/28 22:26:45
nit: The rule for alphabetizing includes is to rem
dpapad
2011/02/28 23:50:59
Done.
| |
22 #include "printing/printed_document.h" | 23 #include "printing/printed_document.h" |
23 #include "ui/base/l10n/l10n_util.h" | 24 #include "ui/base/l10n/l10n_util.h" |
24 | 25 |
25 using base::TimeDelta; | 26 using base::TimeDelta; |
26 | 27 |
27 namespace printing { | 28 namespace printing { |
28 | 29 |
29 PrintViewManager::PrintViewManager(TabContents* tab_contents) | 30 PrintViewManager::PrintViewManager(TabContents* tab_contents) |
30 : TabContentsObserver(tab_contents), | 31 : TabContentsObserver(tab_contents), |
31 number_pages_(0), | 32 number_pages_(0), |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
123 | 124 |
124 base::SharedMemory shared_buf(params.metafile_data_handle, true); | 125 base::SharedMemory shared_buf(params.metafile_data_handle, true); |
125 if (metafile_must_be_valid) { | 126 if (metafile_must_be_valid) { |
126 if (!shared_buf.Map(params.data_size)) { | 127 if (!shared_buf.Map(params.data_size)) { |
127 NOTREACHED() << "couldn't map"; | 128 NOTREACHED() << "couldn't map"; |
128 tab_contents()->Stop(); | 129 tab_contents()->Stop(); |
129 return; | 130 return; |
130 } | 131 } |
131 } | 132 } |
132 | 133 |
133 scoped_ptr<NativeMetafile> metafile(new NativeMetafile()); | 134 scoped_ptr<NativeMetafile> metafile(NativeMetafileFactory::CreateMetafile()); |
134 if (metafile_must_be_valid) { | 135 if (metafile_must_be_valid) { |
135 if (!metafile->Init(shared_buf.memory(), params.data_size)) { | 136 if (!metafile->Init(shared_buf.memory(), params.data_size)) { |
136 NOTREACHED() << "Invalid metafile header"; | 137 NOTREACHED() << "Invalid metafile header"; |
137 tab_contents()->Stop(); | 138 tab_contents()->Stop(); |
138 return; | 139 return; |
139 } | 140 } |
140 } | 141 } |
141 | 142 |
142 // Update the rendered document. It will send notifications to the listener. | 143 // Update the rendered document. It will send notifications to the listener. |
143 document->SetPage(params.page_number, | 144 document->SetPage(params.page_number, |
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
423 return false; | 424 return false; |
424 } | 425 } |
425 | 426 |
426 // Settings are already loaded. Go ahead. This will set | 427 // Settings are already loaded. Go ahead. This will set |
427 // print_job_->is_job_pending() to true. | 428 // print_job_->is_job_pending() to true. |
428 print_job_->StartPrinting(); | 429 print_job_->StartPrinting(); |
429 return true; | 430 return true; |
430 } | 431 } |
431 | 432 |
432 } // namespace printing | 433 } // namespace printing |
OLD | NEW |