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 "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
11 #include "base/location.h" | 11 #include "base/location.h" |
12 #include "base/message_loop/message_loop.h" | 12 #include "base/message_loop/message_loop.h" |
13 #include "base/single_thread_task_runner.h" | 13 #include "base/single_thread_task_runner.h" |
14 #include "base/thread_task_runner_handle.h" | 14 #include "base/thread_task_runner_handle.h" |
15 #include "base/values.h" | 15 #include "base/values.h" |
16 #include "chrome/browser/browser_process.h" | 16 #include "chrome/browser/browser_process.h" |
17 #include "chrome/browser/chrome_notification_types.h" | 17 #include "chrome/browser/chrome_notification_types.h" |
18 #include "chrome/browser/printing/print_job.h" | 18 #include "chrome/browser/printing/print_job.h" |
19 #include "chrome/grit/generated_resources.h" | 19 #include "chrome/grit/generated_resources.h" |
20 #include "content/public/browser/browser_thread.h" | 20 #include "content/public/browser/browser_thread.h" |
21 #include "content/public/browser/notification_service.h" | 21 #include "content/public/browser/notification_service.h" |
22 #include "content/public/browser/render_view_host.h" | 22 #include "content/public/browser/render_view_host.h" |
23 #include "content/public/browser/web_contents.h" | 23 #include "content/public/browser/web_contents.h" |
24 #include "printing/print_job_constants.h" | 24 #include "printing/print_job_constants.h" |
25 #include "printing/printed_document.h" | 25 #include "printing/printed_document.h" |
26 #include "printing/printed_page.h" | 26 #include "printing/printed_page.h" |
27 #include "printing/printing_utils.h" | 27 #include "printing/printing_utils.h" |
28 #include "ui/base/l10n/l10n_util.h" | 28 #include "ui/base/l10n/l10n_util.h" |
29 | 29 |
30 #if defined(OS_ANDROID) | 30 #if defined(ANDROID_JAVA_UI) |
31 #include "chrome/browser/android/tab_android.h" | 31 #include "chrome/browser/android/tab_android.h" |
32 #endif | 32 #endif |
33 | 33 |
34 using content::BrowserThread; | 34 using content::BrowserThread; |
35 | 35 |
36 namespace printing { | 36 namespace printing { |
37 | 37 |
38 namespace { | 38 namespace { |
39 | 39 |
40 // Helper function to ensure |owner| is valid until at least |callback| returns. | 40 // 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... | |
206 printing_context_->settings(), | 206 printing_context_->settings(), |
207 result)); | 207 result)); |
208 } | 208 } |
209 | 209 |
210 void PrintJobWorker::GetSettingsWithUI( | 210 void PrintJobWorker::GetSettingsWithUI( |
211 int document_page_count, | 211 int document_page_count, |
212 bool has_selection, | 212 bool has_selection, |
213 bool is_scripted) { | 213 bool is_scripted) { |
214 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 214 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
215 | 215 |
216 #if defined(OS_ANDROID) | 216 #if defined(ANDROID_JAVA_UI) |
Ted C
2015/11/30 19:39:05
another place where I think you'd probably want so
| |
217 if (is_scripted) { | 217 if (is_scripted) { |
218 PrintingContextDelegate* printing_context_delegate = | 218 PrintingContextDelegate* printing_context_delegate = |
219 static_cast<PrintingContextDelegate*>(printing_context_delegate_.get()); | 219 static_cast<PrintingContextDelegate*>(printing_context_delegate_.get()); |
220 content::WebContents* web_contents = | 220 content::WebContents* web_contents = |
221 printing_context_delegate->GetWebContents(); | 221 printing_context_delegate->GetWebContents(); |
222 TabAndroid* tab = | 222 TabAndroid* tab = |
223 web_contents ? TabAndroid::FromWebContents(web_contents) : nullptr; | 223 web_contents ? TabAndroid::FromWebContents(web_contents) : nullptr; |
224 | 224 |
225 // Regardless of whether the following call fails or not, the javascript | 225 // Regardless of whether the following call fails or not, the javascript |
226 // call will return since startPendingPrint will make it return immediately | 226 // call will return since startPendingPrint will make it return immediately |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
435 document_, | 435 document_, |
436 scoped_refptr<PrintedPage>())); | 436 scoped_refptr<PrintedPage>())); |
437 Cancel(); | 437 Cancel(); |
438 | 438 |
439 // Makes sure the variables are reinitialized. | 439 // Makes sure the variables are reinitialized. |
440 document_ = NULL; | 440 document_ = NULL; |
441 page_number_ = PageNumber::npos(); | 441 page_number_ = PageNumber::npos(); |
442 } | 442 } |
443 | 443 |
444 } // namespace printing | 444 } // namespace printing |
OLD | NEW |