Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2947)

Unified Diff: chrome/browser/ui/webui/print_preview_ui_html_source.cc

Issue 6982030: Print Preview: Detecting plugin existence before generating the preview. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Minor fix Created 9 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..88fe310f4de8376e806654de33812a706d6805d5 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 == "dummy.pdf") {
+ scoped_refptr<RefCountedBytes> dummy_bytes(new RefCountedBytes);
+ std::string dummy_string("%PDF-1.4\n4 0 obj\n<</Type /Catalog /Pages 1 0 R"
vandebo (ex-Chrome) 2011/05/11 18:00:05 I squished this down a bit more (to 316 bytes):
dpapad 2011/05/11 18:35:38 Done.
+ " >> endobj 2 0 obj\n<</Type /Page /Parent 1 0 R /MediaBox [0 0 612 792"
+ "] /Contents 3 0 R >> endobj 3 0 obj\n<</Length 0 >> stream\nendstream\n"
+ "endobj\n1 0 obj\n<</Type /Pages /Kids [2 0 R] /Count 1 >> endobj\n"
+ "xref\n0 5\n0000000000 65535 f \n0000000200 00000 n \n0000000067 00000"
+ " n \n0000000153 00000 n \n0000000019 00000 n \ntrailer\n<</Size 8\n"
+ "/Root 4 0 R\n>>\nstartxref\n256\n%%EOF");
+ const char* dummy_data = dummy_string.c_str();
+ dummy_bytes->data.resize(dummy_string.length());
+ std::vector<unsigned char>::iterator it = dummy_bytes->data.begin();
+ for (uint32 i = 0; i < dummy_string.length(); ++i, ++it)
+ *it = *(dummy_data + i);
+ SendResponse(request_id, dummy_bytes);
+ return;
} else {
// Invalid request.
scoped_refptr<RefCountedBytes> empty_bytes(new RefCountedBytes);
« chrome/browser/resources/print_preview.html ('K') | « chrome/browser/resources/print_preview.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698