Chromium Code Reviews| Index: chrome/browser/ui/webui/print_preview_ui_html_source.cc |
| diff --git a/chrome/browser/ui/webui/print_preview_ui_html_source.cc b/chrome/browser/ui/webui/print_preview_ui_html_source.cc |
| index be4b583b5190583bb94e9ab2cc247e53f21d8651..71b9c2aa06a1621e69562bad3deaf643de0d50fe 100644 |
| --- a/chrome/browser/ui/webui/print_preview_ui_html_source.cc |
| +++ b/chrome/browser/ui/webui/print_preview_ui_html_source.cc |
| @@ -160,6 +160,22 @@ void PrintPreviewUIHTMLSource::StartDataRequest(const std::string& path, |
| *it = *(preview_data + i); |
| SendResponse(request_id, html_bytes); |
| return; |
| + } else if (path == "blank.pdf") { |
| + scoped_refptr<RefCountedBytes> dummy_bytes(new RefCountedBytes); |
|
vandebo (ex-Chrome)
2011/05/11 18:37:18
dummy_bytes != blank_pdf
vandebo (ex-Chrome)
2011/05/11 19:04:55
Nevermind, I read it wrong.
|
| + std::string blank_pdf("%PDF-1.4\n3 0 obj<</Type/Catalog/Pages 1 0 R>>" |
|
vandebo (ex-Chrome)
2011/05/11 19:04:55
Should this be a constant? const char kBlankPdf[]
dpapad
2011/05/11 22:08:20
Done.
|
| + "endobj 2 0 obj<</Type/Page/Parent 1 0 R/Resources" |
| + "<<>>/MediaBox[0 0 612 792]>>endobj 1 0 obj<</Type" |
| + "/Pages/Kids[2 0 R]/Count 1>>endobj\nxref\n0 4" |
| + "0000000000 65535 f \n0000000129 00000 n \n" |
| + "0000000052 00000 n \n0000000009 00000 n \ntrailer<<" |
| + "/Size 4/Root 3 0 R>>startxref\n178\n%%EOF\n"); |
| + const char* dummy_data = blank_pdf.c_str(); |
| + dummy_bytes->data.resize(blank_pdf.length()); |
| + std::vector<unsigned char>::iterator it = dummy_bytes->data.begin(); |
| + for (uint32 i = 0; i < blank_pdf.length(); ++i, ++it) |
| + *it = *(dummy_data + i); |
| + SendResponse(request_id, dummy_bytes); |
| + return; |
| } else { |
| // Invalid request. |
| scoped_refptr<RefCountedBytes> empty_bytes(new RefCountedBytes); |