OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/printing/print_job_worker.h" | 5 #include "chrome/browser/printing/print_job_worker.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 #include "content/public/browser/browser_thread.h" | 26 #include "content/public/browser/browser_thread.h" |
27 #include "content/public/browser/notification_service.h" | 27 #include "content/public/browser/notification_service.h" |
28 #include "content/public/browser/render_frame_host.h" | 28 #include "content/public/browser/render_frame_host.h" |
29 #include "content/public/browser/web_contents.h" | 29 #include "content/public/browser/web_contents.h" |
30 #include "printing/print_job_constants.h" | 30 #include "printing/print_job_constants.h" |
31 #include "printing/printed_document.h" | 31 #include "printing/printed_document.h" |
32 #include "printing/printed_page.h" | 32 #include "printing/printed_page.h" |
33 #include "printing/printing_utils.h" | 33 #include "printing/printing_utils.h" |
34 #include "ui/base/l10n/l10n_util.h" | 34 #include "ui/base/l10n/l10n_util.h" |
35 | 35 |
36 #if BUILDFLAG(ANDROID_JAVA_UI) | 36 #if defined(OS_ANDROID) |
37 #include "chrome/browser/android/tab_android.h" | 37 #include "chrome/browser/android/tab_android.h" |
38 #endif | 38 #endif |
39 | 39 |
40 using content::BrowserThread; | 40 using content::BrowserThread; |
41 | 41 |
42 namespace printing { | 42 namespace printing { |
43 | 43 |
44 namespace { | 44 namespace { |
45 | 45 |
46 // Helper function to ensure |owner| is valid until at least |callback| returns. | 46 // Helper function to ensure |owner| is valid until at least |callback| returns. |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 printing_context_->settings(), | 212 printing_context_->settings(), |
213 result)); | 213 result)); |
214 } | 214 } |
215 | 215 |
216 void PrintJobWorker::GetSettingsWithUI( | 216 void PrintJobWorker::GetSettingsWithUI( |
217 int document_page_count, | 217 int document_page_count, |
218 bool has_selection, | 218 bool has_selection, |
219 bool is_scripted) { | 219 bool is_scripted) { |
220 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 220 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
221 | 221 |
222 #if BUILDFLAG(ANDROID_JAVA_UI) | 222 #if defined(OS_ANDROID) |
223 if (is_scripted) { | 223 if (is_scripted) { |
224 PrintingContextDelegate* printing_context_delegate = | 224 PrintingContextDelegate* printing_context_delegate = |
225 static_cast<PrintingContextDelegate*>(printing_context_delegate_.get()); | 225 static_cast<PrintingContextDelegate*>(printing_context_delegate_.get()); |
226 content::WebContents* web_contents = | 226 content::WebContents* web_contents = |
227 printing_context_delegate->GetWebContents(); | 227 printing_context_delegate->GetWebContents(); |
228 TabAndroid* tab = | 228 TabAndroid* tab = |
229 web_contents ? TabAndroid::FromWebContents(web_contents) : nullptr; | 229 web_contents ? TabAndroid::FromWebContents(web_contents) : nullptr; |
230 | 230 |
231 // Regardless of whether the following call fails or not, the javascript | 231 // Regardless of whether the following call fails or not, the javascript |
232 // call will return since startPendingPrint will make it return immediately | 232 // call will return since startPendingPrint will make it return immediately |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
434 JobEventDetails::FAILED, | 434 JobEventDetails::FAILED, |
435 base::RetainedRef(document_), nullptr)); | 435 base::RetainedRef(document_), nullptr)); |
436 Cancel(); | 436 Cancel(); |
437 | 437 |
438 // Makes sure the variables are reinitialized. | 438 // Makes sure the variables are reinitialized. |
439 document_ = NULL; | 439 document_ = NULL; |
440 page_number_ = PageNumber::npos(); | 440 page_number_ = PageNumber::npos(); |
441 } | 441 } |
442 | 442 |
443 } // namespace printing | 443 } // namespace printing |
OLD | NEW |