| 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 e1061fad8d294f085ea0b448eaf85f7872fa689d..6e03b392aae733477a059857f8b57f51409aa927 100644
|
| --- a/chrome/browser/printing/print_view_manager.cc
|
| +++ b/chrome/browser/printing/print_view_manager.cc
|
| @@ -17,6 +17,7 @@
|
| #include "chrome/browser/printing/print_preview_tab_controller.h"
|
| #include "chrome/browser/printing/print_view_manager_observer.h"
|
| #include "chrome/browser/printing/printer_query.h"
|
| +#include "chrome/browser/ui/browser_list.h"
|
| #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
|
| #include "chrome/browser/ui/webui/print_preview/print_preview_ui.h"
|
| #include "chrome/common/chrome_notification_types.h"
|
| @@ -259,6 +260,12 @@ void PrintViewManager::OnPrintingFailed(int cookie) {
|
| content::NotificationService::NoDetails());
|
| }
|
|
|
| +void PrintViewManager::OnCheckScriptedPrintAllowed(bool* allowed) {
|
| + // If our tab isn't isn't in the browser list, printing shouldn't
|
| + // be allowed. Most likely case is a blocked popup.
|
| + *allowed = BrowserList::FindBrowserWithWebContents(web_contents()) != NULL;
|
| +}
|
| +
|
| void PrintViewManager::OnScriptedPrintPreview(bool source_is_modifiable,
|
| IPC::Message* reply_msg) {
|
| BrowserThread::CurrentlyOn(BrowserThread::UI);
|
| @@ -316,6 +323,8 @@ bool PrintViewManager::OnMessageReceived(const IPC::Message& message) {
|
| IPC_MESSAGE_HANDLER(PrintHostMsg_DidShowPrintDialog, OnDidShowPrintDialog)
|
| IPC_MESSAGE_HANDLER(PrintHostMsg_DidPrintPage, OnDidPrintPage)
|
| IPC_MESSAGE_HANDLER(PrintHostMsg_PrintingFailed, OnPrintingFailed)
|
| + IPC_MESSAGE_HANDLER(PrintHostMsg_CheckScriptedPrintAllowed,
|
| + OnCheckScriptedPrintAllowed)
|
| IPC_MESSAGE_HANDLER_DELAY_REPLY(PrintHostMsg_ScriptedPrintPreview,
|
| OnScriptedPrintPreview)
|
| IPC_MESSAGE_UNHANDLED(handled = false)
|
|
|