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" |
| 11 #include "chrome/common/chrome_notification_types.h" |
11 #include "content/browser/browser_thread.h" | 12 #include "content/browser/browser_thread.h" |
12 #include "content/common/notification_service.h" | 13 #include "content/common/notification_service.h" |
13 #include "printing/print_job_constants.h" | 14 #include "printing/print_job_constants.h" |
14 #include "printing/printed_document.h" | 15 #include "printing/printed_document.h" |
15 #include "printing/printed_page.h" | 16 #include "printing/printed_page.h" |
16 | 17 |
17 namespace printing { | 18 namespace printing { |
18 | 19 |
19 class PrintJobWorker::NotificationTask : public Task { | 20 class PrintJobWorker::NotificationTask : public Task { |
20 public: | 21 public: |
(...skipping 10 matching lines...) Expand all Loading... |
31 PrintedPage* page) { | 32 PrintedPage* page) { |
32 DCHECK(!print_job_); | 33 DCHECK(!print_job_); |
33 DCHECK(!details_); | 34 DCHECK(!details_); |
34 print_job_ = print_job; | 35 print_job_ = print_job; |
35 details_ = new JobEventDetails(detail_type, document, page); | 36 details_ = new JobEventDetails(detail_type, document, page); |
36 } | 37 } |
37 | 38 |
38 virtual void Run() { | 39 virtual void Run() { |
39 // Send the notification in the right thread. | 40 // Send the notification in the right thread. |
40 NotificationService::current()->Notify( | 41 NotificationService::current()->Notify( |
41 NotificationType::PRINT_JOB_EVENT, | 42 chrome::NOTIFICATION_PRINT_JOB_EVENT, |
42 // We know that is is a PrintJob object in this circumstance. | 43 // We know that is is a PrintJob object in this circumstance. |
43 Source<PrintJob>(static_cast<PrintJob*>(print_job_.get())), | 44 Source<PrintJob>(static_cast<PrintJob*>(print_job_.get())), |
44 Details<JobEventDetails>(details_)); | 45 Details<JobEventDetails>(details_)); |
45 } | 46 } |
46 | 47 |
47 // The job which originates this notification. | 48 // The job which originates this notification. |
48 scoped_refptr<PrintJobWorkerOwner> print_job_; | 49 scoped_refptr<PrintJobWorkerOwner> print_job_; |
49 scoped_refptr<JobEventDetails> details_; | 50 scoped_refptr<JobEventDetails> details_; |
50 }; | 51 }; |
51 | 52 |
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
356 printing::PrintJobWorker* obj) { | 357 printing::PrintJobWorker* obj) { |
357 DCHECK(!owner_.get()); | 358 DCHECK(!owner_.get()); |
358 owner_ = obj->owner_; | 359 owner_ = obj->owner_; |
359 } | 360 } |
360 | 361 |
361 void RunnableMethodTraits<printing::PrintJobWorker>::ReleaseCallee( | 362 void RunnableMethodTraits<printing::PrintJobWorker>::ReleaseCallee( |
362 printing::PrintJobWorker* obj) { | 363 printing::PrintJobWorker* obj) { |
363 DCHECK_EQ(owner_, obj->owner_); | 364 DCHECK_EQ(owner_, obj->owner_); |
364 owner_ = NULL; | 365 owner_ = NULL; |
365 } | 366 } |
OLD | NEW |