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

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

Issue 4338001: Implement print preview tab controller. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed a style issue. Created 10 years, 1 month 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
diff --git a/chrome/browser/renderer_host/render_view_host.cc b/chrome/browser/renderer_host/render_view_host.cc
index 134274e3cb61becaf1d6accf71228e6ba647f745..21a97a58c6c6ac4e34e9852ca7d01b07f7ac5b90 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,26 @@ void RenderViewHost::OnMsgShowPopup(
}
#endif
+TabContents* RenderViewHost::GetPrintPreviewTab() {
+ // current_tab is initiator_tab
+ TabContents* current_tab = delegate_? delegate_->GetAsTabContents() : NULL;
+ if (current_tab != NULL) {
+ // Get/Create preview tab for initiator tab.
+ printing::PrintPreviewTabController* tab_controller =
Lei Zhang 2010/11/12 02:10:55 What happens when GetInstance() returns NULL?
kmadhusu 2010/11/12 22:21:48 Made code change to check the return value.
+ printing::PrintPreviewTabController::GetInstance();
+ return tab_controller->get_print_preview_tab(
+ 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 != NULL);
+
// TODO(kmadhusu): Function definition needs to be changed.
// 'params' contains the metafile handle for preview.
@@ -2246,6 +2264,10 @@ void RenderViewHost::OnPageReadyForPreview(
}
#else
void RenderViewHost::OnPagesReadyForPreview(int fd_in_browser) {
+ // Get the print preview tab.
+ TabContents* preview_tab = GetPrintPreviewTab();
+ DCHECK(preview_tab != NULL);
+
// TODO(kmadhusu): Function definition needs to be changed.
// fd_in_browser should be the file descriptor of the metafile.

Powered by Google App Engine
This is Rietveld 408576698