summaryrefslogtreecommitdiffstats
path: root/chrome/browser
diff options
context:
space:
mode:
authormark@chromium.org <mark@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-01-28 23:37:55 +0000
committermark@chromium.org <mark@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-01-28 23:37:55 +0000
commit87c0254db050a6df147be484e2496aaa4b4f95a1 (patch)
treef0db8c3d0ab2c5e92ae48e43cbf210ca1e3042dd /chrome/browser
parent0fc9dca2aae7f778a5a43aee1f898af7d93b15b8 (diff)
downloadchromium_src-87c0254db050a6df147be484e2496aaa4b4f95a1.zip
chromium_src-87c0254db050a6df147be484e2496aaa4b4f95a1.tar.gz
chromium_src-87c0254db050a6df147be484e2496aaa4b4f95a1.tar.bz2
Roll back r8821
Review URL: http://codereview.chromium.org/19453 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@8834 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r--chrome/browser/printing/print_view_manager.cc16
-rw-r--r--chrome/browser/renderer_host/render_view_host.cc8
-rw-r--r--chrome/browser/renderer_host/render_view_host.h16
-rw-r--r--chrome/browser/tab_contents/web_contents.cc13
4 files changed, 38 insertions, 15 deletions
diff --git a/chrome/browser/printing/print_view_manager.cc b/chrome/browser/printing/print_view_manager.cc
index 436742a..6813a15 100644
--- a/chrome/browser/printing/print_view_manager.cc
+++ b/chrome/browser/printing/print_view_manager.cc
@@ -254,8 +254,14 @@ void PrintViewManager::OnNotifyPrintJobInitEvent(
owner_.render_view_host()->IsRenderViewLive() &&
(!old_print_params.Equals(print_params_) ||
!event_details.document()->page_count())) {
- // TODO(maruel): Will never happen, this code is about to be deleted.
- NOTREACHED();
+ // This will generate a DidGetPrintedPagesCount() callback.
+ if (!owner_.render_view_host()->GetPrintedPagesCount(print_params_)) {
+ NOTREACHED();
+ if (inside_inner_message_loop_) {
+ MessageLoop::current()->Quit();
+ return;
+ }
+ }
}
// Continue even if owner_.render_view_host() is dead because we may already
@@ -471,8 +477,10 @@ void PrintViewManager::PrintNowInternal() {
if (!print_job_->document() ||
!print_job_->document()->IsComplete()) {
- // TODO(maruel): Will never happen. This code is about to be deleted.
- NOTREACHED();
+ ViewMsg_PrintPages_Params params;
+ params.params = print_params_;
+ params.pages = PageRange::GetPages(print_job_->settings().ranges);
+ owner_.render_view_host()->PrintPages(params);
}
}
diff --git a/chrome/browser/renderer_host/render_view_host.cc b/chrome/browser/renderer_host/render_view_host.cc
index 4a4a431..cfc8aff 100644
--- a/chrome/browser/renderer_host/render_view_host.cc
+++ b/chrome/browser/renderer_host/render_view_host.cc
@@ -321,8 +321,12 @@ void RenderViewHost::Stop() {
Send(new ViewMsg_Stop(routing_id()));
}
-bool RenderViewHost::PrintPages() {
- return Send(new ViewMsg_PrintPages(routing_id()));
+bool RenderViewHost::GetPrintedPagesCount(const ViewMsg_Print_Params& params) {
+ return Send(new ViewMsg_GetPrintedPagesCount(routing_id(), params));
+}
+
+bool RenderViewHost::PrintPages(const ViewMsg_PrintPages_Params& params) {
+ return Send(new ViewMsg_PrintPages(routing_id(), params));
}
void RenderViewHost::StartFinding(int request_id,
diff --git a/chrome/browser/renderer_host/render_view_host.h b/chrome/browser/renderer_host/render_view_host.h
index 19bb424..b355f48 100644
--- a/chrome/browser/renderer_host/render_view_host.h
+++ b/chrome/browser/renderer_host/render_view_host.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROME_BROWSER_RENDERER_HOST_RENDER_VIEW_HOST_H__
-#define CHROME_BROWSER_RENDERER_HOST_RENDER_VIEW_HOST_H__
+#ifndef CHROME_BROWSER_RENDER_VIEW_HOST_H__
+#define CHROME_BROWSER_RENDER_VIEW_HOST_H__
#include <string>
#include <vector>
@@ -180,9 +180,13 @@ class RenderViewHost : public RenderWidgetHost {
void Stop();
- // Asks the renderer to "render" printed pages and initiate printing on our
- // behalf.
- bool PrintPages();
+ // Retrieves the number of printed pages that would result for the current web
+ // page and the specified settings. The response is a
+ // ViewHostMsg_DidGetPrintedPagesCount.
+ bool GetPrintedPagesCount(const ViewMsg_Print_Params& params);
+
+ // Asks the renderer to "render" printed pages.
+ bool PrintPages(const ViewMsg_PrintPages_Params& params);
// Start looking for a string within the content of the page, with the
// specified options.
@@ -623,4 +627,4 @@ class RenderViewHostFactory {
base::WaitableEvent* modal_dialog_event) = 0;
};
-#endif // CHROME_BROWSER_RENDERER_HOST_RENDER_VIEW_HOST_H__
+#endif // CHROME_BROWSER_RENDER_VIEW_HOST_H__
diff --git a/chrome/browser/tab_contents/web_contents.cc b/chrome/browser/tab_contents/web_contents.cc
index 63e6689..5c2fdb2 100644
--- a/chrome/browser/tab_contents/web_contents.cc
+++ b/chrome/browser/tab_contents/web_contents.cc
@@ -589,8 +589,15 @@ void WebContents::SavePage(const std::wstring& main_file,
}
void WebContents::PrintPreview() {
- // We don't show the print preview yet, only the print dialog.
- PrintNow();
+ // We can't print interstitial page for now.
+ if (showing_interstitial_page())
+ return;
+
+ // If we have a find bar it needs to hide as well.
+ view_->HideFindBar(false);
+
+ // We don't show the print preview for the beta, only the print dialog.
+ printing_.ShowPrintDialog();
}
bool WebContents::PrintNow() {
@@ -601,7 +608,7 @@ bool WebContents::PrintNow() {
// If we have a find bar it needs to hide as well.
view_->HideFindBar(false);
- return render_view_host()->PrintPages();
+ return printing_.PrintNow();
}
bool WebContents::IsActiveEntry(int32 page_id) {