Index: chrome/browser/printing/print_job_worker.cc |
diff --git a/chrome/browser/printing/print_job_worker.cc b/chrome/browser/printing/print_job_worker.cc |
index 3f277c594182f0c9904fb903c3e1e70b1436946d..b99cfce235a940163243e7f644276fecd5805110 100644 |
--- a/chrome/browser/printing/print_job_worker.cc |
+++ b/chrome/browser/printing/print_job_worker.cc |
@@ -24,6 +24,10 @@ |
#include "printing/printing_utils.h" |
#include "ui/base/l10n/l10n_util.h" |
+#if defined(OS_ANDROID) |
+#include "chrome/browser/android/tab_android.h" |
+#endif |
+ |
using content::BrowserThread; |
namespace printing { |
@@ -120,7 +124,8 @@ void PrintJobWorker::GetSettings( |
bool ask_user_for_settings, |
int document_page_count, |
bool has_selection, |
- MarginType margin_type) { |
+ MarginType margin_type, |
+ bool is_scripted) { |
DCHECK(task_runner_->RunsTasksOnCurrentThread()); |
DCHECK_EQ(page_number_, PageNumber::npos()); |
@@ -141,7 +146,8 @@ void PrintJobWorker::GetSettings( |
base::Bind(&PrintJobWorker::GetSettingsWithUI, |
base::Unretained(this), |
document_page_count, |
- has_selection))); |
+ has_selection, |
+ is_scripted))); |
} else { |
BrowserThread::PostTask( |
BrowserThread::UI, FROM_HERE, |
@@ -193,11 +199,28 @@ void PrintJobWorker::GetSettingsDone(PrintingContext::Result result) { |
void PrintJobWorker::GetSettingsWithUI( |
int document_page_count, |
- bool has_selection) { |
+ bool has_selection, |
+ bool is_scripted) { |
DCHECK_CURRENTLY_ON(BrowserThread::UI); |
+ |
+#if defined(OS_ANDROID) |
+ if (is_scripted) { |
+ PrintingContextDelegate* pcd = |
+ static_cast<PrintingContextDelegate*>(printing_context_delegate_.get()); |
+ content::WebContents* wc = pcd->GetWebContents(); |
Bernhard Bauer
2014/12/15 09:38:02
Nit: Try not to use abbreviations. Maybe |contents
dgn
2014/12/15 10:27:05
Done.
|
+ TabAndroid* tab = TabAndroid::FromWebContents(wc); |
+ if (tab) { |
+ // If fails or is not called, attempting to start a pending print does |
Bernhard Bauer
2014/12/15 09:38:02
If what fails?
dgn
2014/12/15 10:27:06
If setPendingPrint fails (if there is a print in p
|
+ // nothing and will notify that printing is finished. |
+ tab->SetPendingPrint(); |
+ } |
+ } |
+#endif |
+ |
printing_context_->AskUserForSettings( |
document_page_count, |
has_selection, |
+ is_scripted, |
base::Bind(&PrintJobWorker::GetSettingsWithUIDone, |
base::Unretained(this))); |
} |