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

Side by Side 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: Fixing nit 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/resources/print_preview.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/ui/webui/print_preview_ui_html_source.h" 5 #include "chrome/browser/ui/webui/print_preview_ui_html_source.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/message_loop.h" 10 #include "base/message_loop.h"
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 char* preview_data = reinterpret_cast<char*>(data_.first->memory()); 153 char* preview_data = reinterpret_cast<char*>(data_.first->memory());
154 uint32 preview_data_size = data_.second; 154 uint32 preview_data_size = data_.second;
155 155
156 scoped_refptr<RefCountedBytes> html_bytes(new RefCountedBytes); 156 scoped_refptr<RefCountedBytes> html_bytes(new RefCountedBytes);
157 html_bytes->data.resize(preview_data_size); 157 html_bytes->data.resize(preview_data_size);
158 std::vector<unsigned char>::iterator it = html_bytes->data.begin(); 158 std::vector<unsigned char>::iterator it = html_bytes->data.begin();
159 for (uint32 i = 0; i < preview_data_size; ++i, ++it) 159 for (uint32 i = 0; i < preview_data_size; ++i, ++it)
160 *it = *(preview_data + i); 160 *it = *(preview_data + i);
161 SendResponse(request_id, html_bytes); 161 SendResponse(request_id, html_bytes);
162 return; 162 return;
163 } else if (path == "dummy.pdf") {
vandebo (ex-Chrome) 2011/05/12 02:10:12 It occurs to me that since the plugin doesn't need
Lei Zhang 2011/05/12 02:19:34 I would double check and make sure that doesn't cr
dpapad 2011/05/12 17:26:44 Removed the "else if". As far as detecting the exi
Lei Zhang 2011/05/12 17:50:45 Well, if it crashes, then it is taking down the re
164 scoped_refptr<RefCountedStaticMemory> dummy_bytes(
165 new RefCountedStaticMemory());
166 SendResponse(request_id, dummy_bytes);
167 return;
163 } else { 168 } else {
164 // Invalid request. 169 // Invalid request.
165 scoped_refptr<RefCountedBytes> empty_bytes(new RefCountedBytes); 170 scoped_refptr<RefCountedBytes> empty_bytes(new RefCountedBytes);
166 SendResponse(request_id, empty_bytes); 171 SendResponse(request_id, empty_bytes);
167 return; 172 return;
168 } 173 }
169 } 174 }
170 175
171 std::string PrintPreviewUIHTMLSource::GetMimeType( 176 std::string PrintPreviewUIHTMLSource::GetMimeType(
172 const std::string& path) const { 177 const std::string& path) const {
173 // Print Preview Index page. 178 // Print Preview Index page.
174 if (path.empty()) 179 if (path.empty())
175 return "text/html"; 180 return "text/html";
176 // Print Preview data. 181 // Print Preview data.
177 return "application/pdf"; 182 return "application/pdf";
178 } 183 }
OLDNEW
« no previous file with comments | « chrome/browser/resources/print_preview.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698