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" |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 if (ask_user_for_settings && destination_.get() == NULL) { | 98 if (ask_user_for_settings && destination_.get() == NULL) { |
99 BrowserThread::PostTask( | 99 BrowserThread::PostTask( |
100 BrowserThread::UI, FROM_HERE, | 100 BrowserThread::UI, FROM_HERE, |
101 base::Bind(&HoldRefCallback, make_scoped_refptr(owner_), | 101 base::Bind(&HoldRefCallback, make_scoped_refptr(owner_), |
102 base::Bind(&PrintJobWorker::GetSettingsWithUI, | 102 base::Bind(&PrintJobWorker::GetSettingsWithUI, |
103 base::Unretained(this), | 103 base::Unretained(this), |
104 base::Passed(&web_contents_observer), | 104 base::Passed(&web_contents_observer), |
105 document_page_count, | 105 document_page_count, |
106 has_selection))); | 106 has_selection))); |
107 } else { | 107 } else { |
| 108 BrowserThread::DeleteSoon( |
| 109 BrowserThread::UI, FROM_HERE, web_contents_observer.release()); |
108 BrowserThread::PostTask( | 110 BrowserThread::PostTask( |
109 BrowserThread::UI, FROM_HERE, | 111 BrowserThread::UI, FROM_HERE, |
110 base::Bind(&HoldRefCallback, make_scoped_refptr(owner_), | 112 base::Bind(&HoldRefCallback, make_scoped_refptr(owner_), |
111 base::Bind(&PrintJobWorker::UseDefaultSettings, | 113 base::Bind(&PrintJobWorker::UseDefaultSettings, |
112 base::Unretained(this)))); | 114 base::Unretained(this)))); |
113 } | 115 } |
114 } | 116 } |
115 | 117 |
116 void PrintJobWorker::SetSettings( | 118 void PrintJobWorker::SetSettings( |
117 const base::DictionaryValue* const new_settings) { | 119 const base::DictionaryValue* const new_settings) { |
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
389 document_, | 391 document_, |
390 scoped_refptr<PrintedPage>())); | 392 scoped_refptr<PrintedPage>())); |
391 Cancel(); | 393 Cancel(); |
392 | 394 |
393 // Makes sure the variables are reinitialized. | 395 // Makes sure the variables are reinitialized. |
394 document_ = NULL; | 396 document_ = NULL; |
395 page_number_ = PageNumber::npos(); | 397 page_number_ = PageNumber::npos(); |
396 } | 398 } |
397 | 399 |
398 } // namespace printing | 400 } // namespace printing |
OLD | NEW |