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

Unified Diff: chrome/browser/renderer_host/render_view_host.cc

Issue 6221005: Print Preview: Store preview data in the print preview controller.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 11 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/renderer_host/render_view_host.cc
===================================================================
--- chrome/browser/renderer_host/render_view_host.cc (revision 71344)
+++ chrome/browser/renderer_host/render_view_host.cc (working copy)
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -29,7 +29,7 @@
#include "chrome/browser/notifications/desktop_notification_service.h"
#include "chrome/browser/printing/printer_query.h"
#include "chrome/browser/printing/print_job_manager.h"
-#include "chrome/browser/printing/print_preview_tab_controller.h"
+#include "chrome/browser/printing/print_preview_manager.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/renderer_host/render_process_host.h"
#include "chrome/browser/renderer_host/render_view_host_delegate.h"
@@ -1973,10 +1973,10 @@
TabContents* initiator_tab = delegate_ ? delegate_->GetAsTabContents() : NULL;
if (initiator_tab) {
// Get/Create preview tab for initiator tab.
- printing::PrintPreviewTabController* tab_controller =
- printing::PrintPreviewTabController::GetInstance();
- if (tab_controller)
- return tab_controller->GetOrCreatePreviewTab(
+ printing::PrintPreviewManager* print_preview_manager =
+ printing::PrintPreviewManager::GetInstance();
+ if (print_preview_manager)
+ return print_preview_manager->GetOrCreatePreviewTab(
initiator_tab, delegate_->GetBrowserWindowID());
}
return NULL;
@@ -1985,24 +1985,24 @@
void RenderViewHost::OnPagesReadyForPreview(
const ViewHostMsg_DidPreviewDocument_Params& params) {
#if defined(OS_MACOSX)
- base::SharedMemory shared_buf(params.metafile_data_handle, true);
- if (!shared_buf.Map(params.data_size)) {
+ base::SharedMemory* shared_buf =
+ new base::SharedMemory(params.metafile_data_handle, true);
+ if (!shared_buf->Map(params.data_size)) {
NOTREACHED();
return;
}
- scoped_ptr<printing::NativeMetafile> metafile(new printing::NativeMetafile());
- if (!metafile->Init(shared_buf.memory(), params.data_size)) {
- NOTREACHED();
- return;
- }
-
- // TODO(kmadhusu): Add more functionality for the preview tab to access this
- // |metafile| data.
#endif
// Get/Create print preview tab.
TabContents* print_preview_tab = GetOrCreatePrintPreviewTab();
DCHECK(print_preview_tab);
+#if defined(OS_MACOSX)
+ printing::PrintPreviewManager* print_preview_manager =
+ printing::PrintPreviewManager::GetInstance();
+ DCHECK(print_preview_manager);
+ print_preview_manager->SetPrintPreviewData(
+ print_preview_tab, std::make_pair(shared_buf, params.data_size));
+#endif
scoped_refptr<printing::PrinterQuery> printer_query;
g_browser_process->print_job_manager()->PopPrinterQuery(
« no previous file with comments | « chrome/browser/printing/print_preview_tab_controller_unittest.cc ('k') | chrome/browser/tab_contents/tab_contents.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698