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

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

Issue 23855002: Fixing spreadsheets printing. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 3 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_view_manager.h ('k') | chrome/common/print_messages.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/printing/print_view_manager.cc
diff --git a/chrome/browser/printing/print_view_manager.cc b/chrome/browser/printing/print_view_manager.cc
index 2b720370dbd7807d95b42e8dfa267296032ee28f..260c94b46af2bf85fa494304b267c1f4c673c0c5 100644
--- a/chrome/browser/printing/print_view_manager.cc
+++ b/chrome/browser/printing/print_view_manager.cc
@@ -97,7 +97,8 @@ bool PrintViewManager::PrintPreviewNow(bool selection_only) {
}
void PrintViewManager::PrintPreviewForWebNode() {
- DCHECK_EQ(NOT_PREVIEWING, print_preview_state_);
+ if (print_preview_state_ != NOT_PREVIEWING)
+ return;
print_preview_state_ = USER_INITIATED_PREVIEW;
}
@@ -133,8 +134,7 @@ void PrintViewManager::OnDidShowPrintDialog() {
observer_->OnPrintDialogShown();
}
-void PrintViewManager::OnScriptedPrintPreview(bool source_is_modifiable,
- IPC::Message* reply_msg) {
+void PrintViewManager::OnSetupScriptedPrintPreview(IPC::Message* reply_msg) {
BrowserThread::CurrentlyOn(BrowserThread::UI);
ScriptedPrintPreviewClosureMap& map =
g_scripted_print_preview_closure_map.Get();
@@ -168,7 +168,15 @@ void PrintViewManager::OnScriptedPrintPreview(bool source_is_modifiable,
reply_msg);
map[rph] = callback;
scripted_print_preview_rph_ = rph;
+}
+void PrintViewManager::OnShowScriptedPrintPreview(bool source_is_modifiable) {
+ PrintPreviewDialogController* dialog_controller =
+ PrintPreviewDialogController::GetInstance();
+ if (!dialog_controller) {
+ PrintPreviewDone();
+ return;
+ }
dialog_controller->PrintPreview(web_contents());
PrintHostMsg_RequestPrintPreview_Params params;
params.is_modifiable = source_is_modifiable;
@@ -185,8 +193,10 @@ bool PrintViewManager::OnMessageReceived(const IPC::Message& message) {
bool handled = true;
IPC_BEGIN_MESSAGE_MAP(PrintViewManager, message)
IPC_MESSAGE_HANDLER(PrintHostMsg_DidShowPrintDialog, OnDidShowPrintDialog)
- IPC_MESSAGE_HANDLER_DELAY_REPLY(PrintHostMsg_ScriptedPrintPreview,
- OnScriptedPrintPreview)
+ IPC_MESSAGE_HANDLER_DELAY_REPLY(PrintHostMsg_SetupScriptedPrintPreview,
+ OnSetupScriptedPrintPreview)
+ IPC_MESSAGE_HANDLER(PrintHostMsg_ShowScriptedPrintPreview,
+ OnShowScriptedPrintPreview)
IPC_MESSAGE_UNHANDLED(handled = false)
IPC_END_MESSAGE_MAP()
« no previous file with comments | « chrome/browser/printing/print_view_manager.h ('k') | chrome/common/print_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698