| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "base/values.h" | 8 #include "base/values.h" |
| 9 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
| 10 #include "chrome/browser/printing/print_job.h" | 10 #include "chrome/browser/printing/print_job.h" |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 | 61 |
| 62 printing_context_.reset(PrintingContext::Create( | 62 printing_context_.reset(PrintingContext::Create( |
| 63 g_browser_process->GetApplicationLocale())); | 63 g_browser_process->GetApplicationLocale())); |
| 64 } | 64 } |
| 65 | 65 |
| 66 PrintJobWorker::~PrintJobWorker() { | 66 PrintJobWorker::~PrintJobWorker() { |
| 67 // The object is normally deleted in the UI thread, but when the user | 67 // The object is normally deleted in the UI thread, but when the user |
| 68 // cancels printing or in the case of print preview, the worker is destroyed | 68 // cancels printing or in the case of print preview, the worker is destroyed |
| 69 // on the I/O thread. | 69 // on the I/O thread. |
| 70 DCHECK_EQ(owner_->message_loop(), MessageLoop::current()); | 70 DCHECK_EQ(owner_->message_loop(), MessageLoop::current()); |
| 71 Stop(); |
| 71 } | 72 } |
| 72 | 73 |
| 73 void PrintJobWorker::SetNewOwner(PrintJobWorkerOwner* new_owner) { | 74 void PrintJobWorker::SetNewOwner(PrintJobWorkerOwner* new_owner) { |
| 74 DCHECK(page_number_ == PageNumber::npos()); | 75 DCHECK(page_number_ == PageNumber::npos()); |
| 75 owner_ = new_owner; | 76 owner_ = new_owner; |
| 76 } | 77 } |
| 77 | 78 |
| 78 void PrintJobWorker::GetSettings(bool ask_user_for_settings, | 79 void PrintJobWorker::GetSettings(bool ask_user_for_settings, |
| 79 gfx::NativeView parent_view, | 80 gfx::NativeView parent_view, |
| 80 int document_page_count, | 81 int document_page_count, |
| (...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 359 printing::PrintJobWorker* obj) { | 360 printing::PrintJobWorker* obj) { |
| 360 DCHECK(!owner_.get()); | 361 DCHECK(!owner_.get()); |
| 361 owner_ = obj->owner_; | 362 owner_ = obj->owner_; |
| 362 } | 363 } |
| 363 | 364 |
| 364 void RunnableMethodTraits<printing::PrintJobWorker>::ReleaseCallee( | 365 void RunnableMethodTraits<printing::PrintJobWorker>::ReleaseCallee( |
| 365 printing::PrintJobWorker* obj) { | 366 printing::PrintJobWorker* obj) { |
| 366 DCHECK_EQ(owner_, obj->owner_); | 367 DCHECK_EQ(owner_, obj->owner_); |
| 367 owner_ = NULL; | 368 owner_ = NULL; |
| 368 } | 369 } |
| OLD | NEW |