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 65b63f0e4e34ab0989f4ed0b11a03b234e9b57ad..3fa10e1c28b9a3730e1f4800c607eee3ed59b8a3 100644 |
--- a/chrome/browser/printing/print_view_manager.cc |
+++ b/chrome/browser/printing/print_view_manager.cc |
@@ -11,6 +11,7 @@ |
#include "chrome/browser/printing/print_job_manager.h" |
#include "chrome/browser/printing/print_preview_tab_controller.h" |
#include "chrome/browser/printing/printer_query.h" |
+#include "chrome/browser/printing/print_view_manager_observer.h" |
#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
#include "chrome/browser/ui/webui/print_preview_ui.h" |
#include "chrome/common/print_messages.h" |
@@ -47,7 +48,8 @@ PrintViewManager::PrintViewManager(TabContentsWrapper* tab) |
number_pages_(0), |
printing_succeeded_(false), |
inside_inner_message_loop_(false), |
- is_title_overridden_(false) { |
+ is_title_overridden_(false), |
+ observer_(NULL) { |
#if defined(OS_POSIX) && !defined(OS_MACOSX) |
expecting_first_page_ = true; |
#endif |
@@ -80,6 +82,11 @@ void PrintViewManager::PreviewPrintingRequestCancelled() { |
rvh->Send(new PrintMsg_PreviewPrintingRequestCancelled(rvh->routing_id())); |
} |
+void PrintViewManager::set_observer(PrintViewManagerObserver* observer) { |
+ DCHECK(!observer || !observer_); |
+ observer_ = observer; |
+} |
+ |
void PrintViewManager::StopNavigation() { |
// Cancel the current job, wait for the worker to finish. |
TerminatePrintJob(true); |
@@ -123,6 +130,11 @@ void PrintViewManager::OnDidGetPrintedPagesCount(int cookie, int number_pages) { |
OpportunisticallyCreatePrintJob(cookie); |
} |
+void PrintViewManager::OnDidShowPrintDialog() { |
+ if (observer_) |
+ observer_->OnPrintDialogShown(); |
+} |
+ |
void PrintViewManager::OnDidPrintPage( |
const PrintHostMsg_DidPrintPage_Params& params) { |
if (!OpportunisticallyCreatePrintJob(params.document_cookie)) |
@@ -205,6 +217,7 @@ bool PrintViewManager::OnMessageReceived(const IPC::Message& message) { |
IPC_BEGIN_MESSAGE_MAP(PrintViewManager, message) |
IPC_MESSAGE_HANDLER(PrintHostMsg_DidGetPrintedPagesCount, |
OnDidGetPrintedPagesCount) |
+ IPC_MESSAGE_HANDLER(PrintHostMsg_DidShowPrintDialog, OnDidShowPrintDialog) |
IPC_MESSAGE_HANDLER(PrintHostMsg_DidPrintPage, OnDidPrintPage) |
IPC_MESSAGE_HANDLER(PrintHostMsg_PrintingFailed, OnPrintingFailed) |
IPC_MESSAGE_UNHANDLED(handled = false) |