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

Unified Diff: chrome/browser/printing/print_preview_message_handler.cc

Issue 7063030: PrintPreview: Print Preview is not staying associated with initiator renderer. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: '' 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
« no previous file with comments | « chrome/browser/printing/print_preview_data_service.cc ('k') | chrome/browser/resources/print_preview.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/printing/print_preview_message_handler.cc
diff --git a/chrome/browser/printing/print_preview_message_handler.cc b/chrome/browser/printing/print_preview_message_handler.cc
index 0b1494c2ca488e5d4f3c76d0e7c8c7a5619e615f..d293d6f1d6e2829f2f43e1e7e3964fb66a627179 100644
--- a/chrome/browser/printing/print_preview_message_handler.cc
+++ b/chrome/browser/printing/print_preview_message_handler.cc
@@ -4,6 +4,7 @@
#include "chrome/browser/printing/print_preview_message_handler.h"
+#include "base/memory/ref_counted.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/printing/print_job_manager.h"
#include "chrome/browser/printing/print_preview_tab_controller.h"
@@ -12,7 +13,6 @@
#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
#include "chrome/browser/ui/webui/print_preview_handler.h"
#include "chrome/browser/ui/webui/print_preview_ui.h"
-#include "chrome/browser/ui/webui/print_preview_ui_html_source.h"
#include "chrome/common/print_messages.h"
#include "content/browser/browser_thread.h"
#include "content/browser/renderer_host/render_view_host.h"
@@ -88,9 +88,17 @@ void PrintPreviewMessageHandler::OnPagesReadyForPreview(
PrintPreviewUI* print_preview_ui =
static_cast<PrintPreviewUI*>(print_preview_tab->web_ui());
- PrintPreviewUIHTMLSource* html_source = print_preview_ui->html_source();
- html_source->SetPrintPreviewData(
- std::make_pair(shared_buf, params.data_size));
+
+ char* preview_data = static_cast<char*>(shared_buf->memory());
+ uint32 preview_data_size = params.data_size;
+
+ scoped_refptr<RefCountedBytes> html_bytes(new RefCountedBytes);
+ html_bytes->data.resize(preview_data_size);
+ std::vector<unsigned char>::iterator it = html_bytes->data.begin();
+ for (uint32 i = 0; i < preview_data_size; ++i, ++it)
+ *it = *(preview_data + i);
+
+ print_preview_ui->SetPrintPreviewData(html_bytes.get());
print_preview_ui->OnPreviewDataIsAvailable(
params.expected_pages_count,
wrapper->print_view_manager()->RenderSourceName(),
« no previous file with comments | « chrome/browser/printing/print_preview_data_service.cc ('k') | chrome/browser/resources/print_preview.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698