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/printer_query.h" | 5 #include "chrome/browser/printing/printer_query.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/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/threading/thread_restrictions.h" | 10 #include "base/threading/thread_restrictions.h" |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 | 61 |
62 int PrinterQuery::cookie() const { | 62 int PrinterQuery::cookie() const { |
63 return cookie_; | 63 return cookie_; |
64 } | 64 } |
65 | 65 |
66 void PrinterQuery::GetSettings( | 66 void PrinterQuery::GetSettings( |
67 GetSettingsAskParam ask_user_for_settings, | 67 GetSettingsAskParam ask_user_for_settings, |
68 int expected_page_count, | 68 int expected_page_count, |
69 bool has_selection, | 69 bool has_selection, |
70 MarginType margin_type, | 70 MarginType margin_type, |
| 71 bool is_scripted, |
71 const base::Closure& callback) { | 72 const base::Closure& callback) { |
72 DCHECK(RunsTasksOnCurrentThread()); | 73 DCHECK(RunsTasksOnCurrentThread()); |
73 DCHECK(!is_print_dialog_box_shown_); | 74 DCHECK(!is_print_dialog_box_shown_); |
74 | 75 |
75 StartWorker(callback); | 76 StartWorker(callback); |
76 | 77 |
77 // Real work is done in PrintJobWorker::GetSettings(). | 78 // Real work is done in PrintJobWorker::GetSettings(). |
78 is_print_dialog_box_shown_ = ask_user_for_settings == ASK_USER; | |
79 worker_->PostTask(FROM_HERE, | 79 worker_->PostTask(FROM_HERE, |
80 base::Bind(&PrintJobWorker::GetSettings, | 80 base::Bind(&PrintJobWorker::GetSettings, |
81 base::Unretained(worker_.get()), | 81 base::Unretained(worker_.get()), |
82 is_print_dialog_box_shown_, | 82 ask_user_for_settings, |
83 expected_page_count, | 83 expected_page_count, |
84 has_selection, | 84 has_selection, |
85 margin_type)); | 85 margin_type, |
| 86 is_scripted)); |
86 } | 87 } |
87 | 88 |
88 void PrinterQuery::SetSettings(scoped_ptr<base::DictionaryValue> new_settings, | 89 void PrinterQuery::SetSettings(scoped_ptr<base::DictionaryValue> new_settings, |
89 const base::Closure& callback) { | 90 const base::Closure& callback) { |
90 StartWorker(callback); | 91 StartWorker(callback); |
91 | 92 |
92 worker_->PostTask(FROM_HERE, | 93 worker_->PostTask(FROM_HERE, |
93 base::Bind(&PrintJobWorker::SetSettings, | 94 base::Bind(&PrintJobWorker::SetSettings, |
94 base::Unretained(worker_.get()), | 95 base::Unretained(worker_.get()), |
95 base::Passed(&new_settings))); | 96 base::Passed(&new_settings))); |
(...skipping 23 matching lines...) Expand all Loading... |
119 | 120 |
120 bool PrinterQuery::is_callback_pending() const { | 121 bool PrinterQuery::is_callback_pending() const { |
121 return !callback_.is_null(); | 122 return !callback_.is_null(); |
122 } | 123 } |
123 | 124 |
124 bool PrinterQuery::is_valid() const { | 125 bool PrinterQuery::is_valid() const { |
125 return worker_.get() != NULL; | 126 return worker_.get() != NULL; |
126 } | 127 } |
127 | 128 |
128 } // namespace printing | 129 } // namespace printing |
OLD | NEW |