| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/renderer/render_view.h" | 5 #include "chrome/renderer/render_view.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 563 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 574 | 574 |
| 575 // Get the size of the compiled EMF. | 575 // Get the size of the compiled EMF. |
| 576 unsigned buf_size = emf.GetDataSize(); | 576 unsigned buf_size = emf.GetDataSize(); |
| 577 DCHECK(buf_size > 128); | 577 DCHECK(buf_size > 128); |
| 578 ViewHostMsg_DidPrintPage_Params page_params; | 578 ViewHostMsg_DidPrintPage_Params page_params; |
| 579 page_params.data_size = 0; | 579 page_params.data_size = 0; |
| 580 page_params.emf_data_handle = NULL; | 580 page_params.emf_data_handle = NULL; |
| 581 page_params.page_number = params.page_number; | 581 page_params.page_number = params.page_number; |
| 582 page_params.document_cookie = params.params.document_cookie; | 582 page_params.document_cookie = params.params.document_cookie; |
| 583 page_params.actual_shrink = shrink; | 583 page_params.actual_shrink = shrink; |
| 584 SharedMemory shared_buf; | 584 base::SharedMemory shared_buf; |
| 585 | 585 |
| 586 // http://msdn2.microsoft.com/en-us/library/ms535522.aspx | 586 // http://msdn2.microsoft.com/en-us/library/ms535522.aspx |
| 587 // Windows 2000/XP: When a page in a spooled file exceeds approximately 350 | 587 // Windows 2000/XP: When a page in a spooled file exceeds approximately 350 |
| 588 // MB, it can fail to print and not send an error message. | 588 // MB, it can fail to print and not send an error message. |
| 589 if (buf_size < 350*1024*1024) { | 589 if (buf_size < 350*1024*1024) { |
| 590 // Allocate a shared memory buffer to hold the generated EMF data. | 590 // Allocate a shared memory buffer to hold the generated EMF data. |
| 591 if (shared_buf.Create(L"", false, false, buf_size) && | 591 if (shared_buf.Create(L"", false, false, buf_size) && |
| 592 shared_buf.Map(buf_size)) { | 592 shared_buf.Map(buf_size)) { |
| 593 // Copy the bits into shared memory. | 593 // Copy the bits into shared memory. |
| 594 if (emf.GetData(shared_buf.memory(), buf_size)) { | 594 if (emf.GetData(shared_buf.memory(), buf_size)) { |
| (...skipping 2129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2724 template_resource_id)); | 2724 template_resource_id)); |
| 2725 | 2725 |
| 2726 if (template_html.empty()) { | 2726 if (template_html.empty()) { |
| 2727 NOTREACHED() << "unable to load template. ID: " << template_resource_id; | 2727 NOTREACHED() << "unable to load template. ID: " << template_resource_id; |
| 2728 return ""; | 2728 return ""; |
| 2729 } | 2729 } |
| 2730 // "t" is the id of the templates root node. | 2730 // "t" is the id of the templates root node. |
| 2731 return jstemplate_builder::GetTemplateHtml( | 2731 return jstemplate_builder::GetTemplateHtml( |
| 2732 template_html, &error_strings, "t"); | 2732 template_html, &error_strings, "t"); |
| 2733 } | 2733 } |
| OLD | NEW |