| 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/printer_query.h" | 5 #include "chrome/browser/printing/printer_query.h" |
| 6 | 6 |
| 7 #include "base/message_loop.h" | 7 #include "base/message_loop.h" |
| 8 #include "base/threading/thread_restrictions.h" | 8 #include "base/threading/thread_restrictions.h" |
| 9 #include "base/values.h" | 9 #include "base/values.h" |
| 10 #include "chrome/browser/printing/print_job_worker.h" | 10 #include "chrome/browser/printing/print_job_worker.h" |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 } | 68 } |
| 69 | 69 |
| 70 int PrinterQuery::cookie() const { | 70 int PrinterQuery::cookie() const { |
| 71 return cookie_; | 71 return cookie_; |
| 72 } | 72 } |
| 73 | 73 |
| 74 void PrinterQuery::GetSettings(GetSettingsAskParam ask_user_for_settings, | 74 void PrinterQuery::GetSettings(GetSettingsAskParam ask_user_for_settings, |
| 75 gfx::NativeView parent_view, | 75 gfx::NativeView parent_view, |
| 76 int expected_page_count, | 76 int expected_page_count, |
| 77 bool has_selection, | 77 bool has_selection, |
| 78 bool use_overlays, | 78 MarginType margin_type, |
| 79 CancelableTask* callback) { | 79 CancelableTask* callback) { |
| 80 DCHECK_EQ(io_message_loop_, MessageLoop::current()); | 80 DCHECK_EQ(io_message_loop_, MessageLoop::current()); |
| 81 DCHECK(!is_print_dialog_box_shown_); | 81 DCHECK(!is_print_dialog_box_shown_); |
| 82 if (!StartWorker(callback)) | 82 if (!StartWorker(callback)) |
| 83 return; | 83 return; |
| 84 | 84 |
| 85 // Real work is done in PrintJobWorker::Init(). | 85 // Real work is done in PrintJobWorker::Init(). |
| 86 is_print_dialog_box_shown_ = ask_user_for_settings == ASK_USER; | 86 is_print_dialog_box_shown_ = ask_user_for_settings == ASK_USER; |
| 87 worker_->message_loop()->PostTask(FROM_HERE, NewRunnableMethod( | 87 worker_->message_loop()->PostTask(FROM_HERE, NewRunnableMethod( |
| 88 worker_.get(), | 88 worker_.get(), |
| 89 &PrintJobWorker::GetSettings, | 89 &PrintJobWorker::GetSettings, |
| 90 is_print_dialog_box_shown_, | 90 is_print_dialog_box_shown_, |
| 91 parent_view, | 91 parent_view, |
| 92 expected_page_count, | 92 expected_page_count, |
| 93 has_selection, | 93 has_selection, |
| 94 use_overlays)); | 94 margin_type)); |
| 95 } | 95 } |
| 96 | 96 |
| 97 void PrinterQuery::SetSettings(const DictionaryValue& new_settings, | 97 void PrinterQuery::SetSettings(const DictionaryValue& new_settings, |
| 98 CancelableTask* callback) { | 98 CancelableTask* callback) { |
| 99 if (!StartWorker(callback)) | 99 if (!StartWorker(callback)) |
| 100 return; | 100 return; |
| 101 | 101 |
| 102 worker_->message_loop()->PostTask(FROM_HERE, NewRunnableMethod( | 102 worker_->message_loop()->PostTask(FROM_HERE, NewRunnableMethod( |
| 103 worker_.get(), | 103 worker_.get(), |
| 104 &PrintJobWorker::SetSettings, | 104 &PrintJobWorker::SetSettings, |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 | 139 |
| 140 bool PrinterQuery::is_callback_pending() const { | 140 bool PrinterQuery::is_callback_pending() const { |
| 141 return callback_.get() != NULL; | 141 return callback_.get() != NULL; |
| 142 } | 142 } |
| 143 | 143 |
| 144 bool PrinterQuery::is_valid() const { | 144 bool PrinterQuery::is_valid() const { |
| 145 return worker_.get() != NULL; | 145 return worker_.get() != NULL; |
| 146 } | 146 } |
| 147 | 147 |
| 148 } // namespace printing | 148 } // namespace printing |
| OLD | NEW |