OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/message_loop.h" | 7 #include "base/message_loop.h" |
| 8 #include "chrome/browser/browser_process.h" |
8 #include "chrome/browser/browser_thread.h" | 9 #include "chrome/browser/browser_thread.h" |
9 #include "chrome/browser/printing/print_job.h" | 10 #include "chrome/browser/printing/print_job.h" |
10 #include "chrome/common/notification_service.h" | 11 #include "chrome/common/notification_service.h" |
11 #include "printing/printed_document.h" | 12 #include "printing/printed_document.h" |
12 #include "printing/printed_page.h" | 13 #include "printing/printed_page.h" |
13 | 14 |
14 namespace printing { | 15 namespace printing { |
15 | 16 |
16 class PrintJobWorker::NotificationTask : public Task { | 17 class PrintJobWorker::NotificationTask : public Task { |
17 public: | 18 public: |
(...skipping 28 matching lines...) Expand all Loading... |
46 scoped_refptr<JobEventDetails> details_; | 47 scoped_refptr<JobEventDetails> details_; |
47 }; | 48 }; |
48 | 49 |
49 | 50 |
50 PrintJobWorker::PrintJobWorker(PrintJobWorkerOwner* owner) | 51 PrintJobWorker::PrintJobWorker(PrintJobWorkerOwner* owner) |
51 : Thread("Printing_Worker"), | 52 : Thread("Printing_Worker"), |
52 owner_(owner) { | 53 owner_(owner) { |
53 // The object is created in the IO thread. | 54 // The object is created in the IO thread. |
54 DCHECK_EQ(owner_->message_loop(), MessageLoop::current()); | 55 DCHECK_EQ(owner_->message_loop(), MessageLoop::current()); |
55 | 56 |
56 printing_context_.reset(PrintingContext::Create()); | 57 printing_context_.reset(PrintingContext::Create( |
| 58 g_browser_process->GetApplicationLocale())); |
57 } | 59 } |
58 | 60 |
59 PrintJobWorker::~PrintJobWorker() { | 61 PrintJobWorker::~PrintJobWorker() { |
60 // The object is normally deleted in the UI thread, but when the user | 62 // The object is normally deleted in the UI thread, but when the user |
61 // cancels printing or in the case of print preview, the worker is destroyed | 63 // cancels printing or in the case of print preview, the worker is destroyed |
62 // on the I/O thread. | 64 // on the I/O thread. |
63 DCHECK_EQ(owner_->message_loop(), MessageLoop::current()); | 65 DCHECK_EQ(owner_->message_loop(), MessageLoop::current()); |
64 } | 66 } |
65 | 67 |
66 void PrintJobWorker::SetNewOwner(PrintJobWorkerOwner* new_owner) { | 68 void PrintJobWorker::SetNewOwner(PrintJobWorkerOwner* new_owner) { |
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
313 printing::PrintJobWorker* obj) { | 315 printing::PrintJobWorker* obj) { |
314 DCHECK(!owner_.get()); | 316 DCHECK(!owner_.get()); |
315 owner_ = obj->owner_; | 317 owner_ = obj->owner_; |
316 } | 318 } |
317 | 319 |
318 void RunnableMethodTraits<printing::PrintJobWorker>::ReleaseCallee( | 320 void RunnableMethodTraits<printing::PrintJobWorker>::ReleaseCallee( |
319 printing::PrintJobWorker* obj) { | 321 printing::PrintJobWorker* obj) { |
320 DCHECK_EQ(owner_, obj->owner_); | 322 DCHECK_EQ(owner_, obj->owner_); |
321 owner_ = NULL; | 323 owner_ = NULL; |
322 } | 324 } |
OLD | NEW |