| 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" |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 if (metafile_must_be_valid) { | 129 if (metafile_must_be_valid) { |
| 130 if (!shared_buf.Map(params.data_size)) { | 130 if (!shared_buf.Map(params.data_size)) { |
| 131 NOTREACHED() << "couldn't map"; | 131 NOTREACHED() << "couldn't map"; |
| 132 tab_contents()->Stop(); | 132 tab_contents()->Stop(); |
| 133 return; | 133 return; |
| 134 } | 134 } |
| 135 } | 135 } |
| 136 | 136 |
| 137 scoped_ptr<NativeMetafile> metafile(NativeMetafileFactory::CreateMetafile()); | 137 scoped_ptr<NativeMetafile> metafile(NativeMetafileFactory::CreateMetafile()); |
| 138 if (metafile_must_be_valid) { | 138 if (metafile_must_be_valid) { |
| 139 if (!metafile->Init(shared_buf.memory(), params.data_size)) { | 139 if (!metafile->InitFromData(shared_buf.memory(), params.data_size)) { |
| 140 NOTREACHED() << "Invalid metafile header"; | 140 NOTREACHED() << "Invalid metafile header"; |
| 141 tab_contents()->Stop(); | 141 tab_contents()->Stop(); |
| 142 return; | 142 return; |
| 143 } | 143 } |
| 144 } | 144 } |
| 145 | 145 |
| 146 // Update the rendered document. It will send notifications to the listener. | 146 // Update the rendered document. It will send notifications to the listener. |
| 147 document->SetPage(params.page_number, | 147 document->SetPage(params.page_number, |
| 148 metafile.release(), | 148 metafile.release(), |
| 149 params.actual_shrink, | 149 params.actual_shrink, |
| (...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 431 return false; | 431 return false; |
| 432 } | 432 } |
| 433 | 433 |
| 434 // Settings are already loaded. Go ahead. This will set | 434 // Settings are already loaded. Go ahead. This will set |
| 435 // print_job_->is_job_pending() to true. | 435 // print_job_->is_job_pending() to true. |
| 436 print_job_->StartPrinting(); | 436 print_job_->StartPrinting(); |
| 437 return true; | 437 return true; |
| 438 } | 438 } |
| 439 | 439 |
| 440 } // namespace printing | 440 } // namespace printing |
| OLD | NEW |