| 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/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 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 result)); | 178 result)); |
| 179 } | 179 } |
| 180 | 180 |
| 181 void PrintJobWorker::GetSettingsWithUI(gfx::NativeView parent_view, | 181 void PrintJobWorker::GetSettingsWithUI(gfx::NativeView parent_view, |
| 182 int document_page_count, | 182 int document_page_count, |
| 183 bool has_selection) { | 183 bool has_selection) { |
| 184 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 184 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 185 | 185 |
| 186 printing_context_->AskUserForSettings( | 186 printing_context_->AskUserForSettings( |
| 187 parent_view, document_page_count, has_selection, | 187 parent_view, document_page_count, has_selection, |
| 188 NewCallback(this, &PrintJobWorker::GetSettingsWithUIDone)); | 188 base::Bind(&PrintJobWorker::GetSettingsWithUIDone, |
| 189 base::Unretained(this))); |
| 189 } | 190 } |
| 190 | 191 |
| 191 void PrintJobWorker::GetSettingsWithUIDone(PrintingContext::Result result) { | 192 void PrintJobWorker::GetSettingsWithUIDone(PrintingContext::Result result) { |
| 192 message_loop()->PostTask( | 193 message_loop()->PostTask( |
| 193 FROM_HERE, | 194 FROM_HERE, |
| 194 base::Bind(&HoldRefCallback, make_scoped_refptr(owner_), | 195 base::Bind(&HoldRefCallback, make_scoped_refptr(owner_), |
| 195 base::Bind(&PrintJobWorker::GetSettingsDone, | 196 base::Bind(&PrintJobWorker::GetSettingsDone, |
| 196 base::Unretained(this), result))); | 197 base::Unretained(this), result))); |
| 197 } | 198 } |
| 198 | 199 |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 366 NULL); | 367 NULL); |
| 367 owner_->message_loop()->PostTask(FROM_HERE, task); | 368 owner_->message_loop()->PostTask(FROM_HERE, task); |
| 368 Cancel(); | 369 Cancel(); |
| 369 | 370 |
| 370 // Makes sure the variables are reinitialized. | 371 // Makes sure the variables are reinitialized. |
| 371 document_ = NULL; | 372 document_ = NULL; |
| 372 page_number_ = PageNumber::npos(); | 373 page_number_ = PageNumber::npos(); |
| 373 } | 374 } |
| 374 | 375 |
| 375 } // namespace printing | 376 } // namespace printing |
| OLD | NEW |