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.h" | 5 #include "chrome/browser/printing/print_job.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/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "base/threading/thread_restrictions.h" | 10 #include "base/threading/thread_restrictions.h" |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 scoped_refptr<JobEventDetails> details( | 190 scoped_refptr<JobEventDetails> details( |
191 new JobEventDetails(JobEventDetails::FAILED, NULL, NULL)); | 191 new JobEventDetails(JobEventDetails::FAILED, NULL, NULL)); |
192 content::NotificationService::current()->Notify( | 192 content::NotificationService::current()->Notify( |
193 chrome::NOTIFICATION_PRINT_JOB_EVENT, | 193 chrome::NOTIFICATION_PRINT_JOB_EVENT, |
194 content::Source<PrintJob>(this), | 194 content::Source<PrintJob>(this), |
195 content::Details<JobEventDetails>(details.get())); | 195 content::Details<JobEventDetails>(details.get())); |
196 Stop(); | 196 Stop(); |
197 is_canceling_ = false; | 197 is_canceling_ = false; |
198 } | 198 } |
199 | 199 |
200 bool PrintJob::FlushJob(int timeout_ms) { | 200 bool PrintJob::FlushJob(base::TimeDelta timeout) { |
201 // Make sure the object outlive this message loop. | 201 // Make sure the object outlive this message loop. |
202 scoped_refptr<PrintJob> handle(this); | 202 scoped_refptr<PrintJob> handle(this); |
203 | 203 |
204 MessageLoop::current()->PostDelayedTask(FROM_HERE, | 204 MessageLoop::current()->PostDelayedTask(FROM_HERE, |
205 base::Bind(&PrintJob::Quit, quit_factory_.GetWeakPtr()), timeout_ms); | 205 base::Bind(&PrintJob::Quit, quit_factory_.GetWeakPtr()), timeout); |
206 | 206 |
207 MessageLoop::ScopedNestableTaskAllower allow(MessageLoop::current()); | 207 MessageLoop::ScopedNestableTaskAllower allow(MessageLoop::current()); |
208 MessageLoop::current()->Run(); | 208 MessageLoop::current()->Run(); |
209 | 209 |
210 return true; | 210 return true; |
211 } | 211 } |
212 | 212 |
213 void PrintJob::DisconnectSource() { | 213 void PrintJob::DisconnectSource() { |
214 source_ = NULL; | 214 source_ = NULL; |
215 if (document_.get()) | 215 if (document_.get()) |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
368 | 368 |
369 PrintedDocument* JobEventDetails::document() const { | 369 PrintedDocument* JobEventDetails::document() const { |
370 return document_; | 370 return document_; |
371 } | 371 } |
372 | 372 |
373 PrintedPage* JobEventDetails::page() const { | 373 PrintedPage* JobEventDetails::page() const { |
374 return page_; | 374 return page_; |
375 } | 375 } |
376 | 376 |
377 } // namespace printing | 377 } // namespace printing |
OLD | NEW |