Index: chrome/browser/renderer_host/render_view_host.cc |
diff --git a/chrome/browser/renderer_host/render_view_host.cc b/chrome/browser/renderer_host/render_view_host.cc |
index 134274e3cb61becaf1d6accf71228e6ba647f745..124c92cd7352362cffbb62bbeb84b15f47f4f062 100644 |
--- a/chrome/browser/renderer_host/render_view_host.cc |
+++ b/chrome/browser/renderer_host/render_view_host.cc |
@@ -25,6 +25,7 @@ |
#include "chrome/browser/in_process_webkit/session_storage_namespace.h" |
#include "chrome/browser/net/predictor_api.h" |
#include "chrome/browser/notifications/desktop_notification_service.h" |
+#include "chrome/browser/printing/print_preview_tab_controller.h" |
#include "chrome/browser/profile.h" |
#include "chrome/browser/renderer_host/render_process_host.h" |
#include "chrome/browser/renderer_host/render_view_host_delegate.h" |
@@ -2235,9 +2236,27 @@ void RenderViewHost::OnMsgShowPopup( |
} |
#endif |
+TabContents* RenderViewHost::GetPrintPreviewTab() { |
+ // current_tab is initiator_tab |
Lei Zhang
2010/11/12 23:17:18
nit: |current_tab| is initiator tab
kmadhusu
2010/11/13 00:05:59
Done.
|
+ TabContents* current_tab = delegate_? delegate_->GetAsTabContents() : NULL; |
Lei Zhang
2010/11/12 23:17:18
nit: space before '?'
kmadhusu
2010/11/13 00:05:59
Done.
|
+ if (current_tab) { |
+ // Get/Create preview tab for initiator tab. |
+ printing::PrintPreviewTabController* tab_controller = |
+ printing::PrintPreviewTabController::GetInstance(); |
+ if (tab_controller) |
+ return tab_controller->GetOrCreatePreviewTab( |
+ current_tab, delegate_->GetBrowserWindowID()); |
+ } |
+ return NULL; |
+} |
+ |
#if defined(OS_MACOSX) || defined(OS_WIN) |
void RenderViewHost::OnPageReadyForPreview( |
const ViewHostMsg_DidPrintPage_Params& params) { |
+ // Get the print preview tab. |
+ TabContents* preview_tab = GetPrintPreviewTab(); |
+ DCHECK(preview_tab); |
+ |
// TODO(kmadhusu): Function definition needs to be changed. |
// 'params' contains the metafile handle for preview. |
@@ -2246,6 +2265,10 @@ void RenderViewHost::OnPageReadyForPreview( |
} |
#else |
void RenderViewHost::OnPagesReadyForPreview(int fd_in_browser) { |
+ // Get the print preview tab. |
+ TabContents* preview_tab = GetPrintPreviewTab(); |
+ DCHECK(preview_tab); |
+ |
// TODO(kmadhusu): Function definition needs to be changed. |
// fd_in_browser should be the file descriptor of the metafile. |