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 <memory> | 7 #include <memory> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 } | 58 } |
59 | 59 |
60 const PrintSettings& PrinterQuery::settings() const { | 60 const PrintSettings& PrinterQuery::settings() const { |
61 return settings_; | 61 return settings_; |
62 } | 62 } |
63 | 63 |
64 int PrinterQuery::cookie() const { | 64 int PrinterQuery::cookie() const { |
65 return cookie_; | 65 return cookie_; |
66 } | 66 } |
67 | 67 |
68 void PrinterQuery::GetSettings( | 68 void PrinterQuery::GetSettings(GetSettingsAskParam ask_user_for_settings, |
69 GetSettingsAskParam ask_user_for_settings, | 69 int expected_page_count, |
70 int expected_page_count, | 70 bool has_selection, |
71 bool has_selection, | 71 MarginType margin_type, |
72 MarginType margin_type, | 72 bool is_scripted, |
73 bool is_scripted, | 73 bool is_modifiable, |
74 const base::Closure& callback) { | 74 const base::Closure& callback) { |
75 DCHECK(RunsTasksOnCurrentThread()); | 75 DCHECK(RunsTasksOnCurrentThread()); |
76 DCHECK(!is_print_dialog_box_shown_ || !is_scripted); | 76 DCHECK(!is_print_dialog_box_shown_ || !is_scripted); |
77 | 77 |
78 StartWorker(callback); | 78 StartWorker(callback); |
79 | 79 |
80 // Real work is done in PrintJobWorker::GetSettings(). | 80 // Real work is done in PrintJobWorker::GetSettings(). |
81 is_print_dialog_box_shown_ = | 81 is_print_dialog_box_shown_ = |
82 ask_user_for_settings == GetSettingsAskParam::ASK_USER; | 82 ask_user_for_settings == GetSettingsAskParam::ASK_USER; |
83 worker_->PostTask(FROM_HERE, | 83 worker_->PostTask( |
84 base::Bind(&PrintJobWorker::GetSettings, | 84 FROM_HERE, |
85 base::Unretained(worker_.get()), | 85 base::Bind(&PrintJobWorker::GetSettings, base::Unretained(worker_.get()), |
86 is_print_dialog_box_shown_, | 86 is_print_dialog_box_shown_, expected_page_count, has_selection, |
87 expected_page_count, | 87 margin_type, is_scripted, is_modifiable)); |
88 has_selection, | |
89 margin_type, | |
90 is_scripted)); | |
91 } | 88 } |
92 | 89 |
93 void PrinterQuery::SetSettings( | 90 void PrinterQuery::SetSettings( |
94 std::unique_ptr<base::DictionaryValue> new_settings, | 91 std::unique_ptr<base::DictionaryValue> new_settings, |
95 const base::Closure& callback) { | 92 const base::Closure& callback) { |
96 StartWorker(callback); | 93 StartWorker(callback); |
97 | 94 |
98 worker_->PostTask(FROM_HERE, | 95 worker_->PostTask(FROM_HERE, |
99 base::Bind(&PrintJobWorker::SetSettings, | 96 base::Bind(&PrintJobWorker::SetSettings, |
100 base::Unretained(worker_.get()), | 97 base::Unretained(worker_.get()), |
(...skipping 24 matching lines...) Expand all Loading... |
125 | 122 |
126 bool PrinterQuery::is_callback_pending() const { | 123 bool PrinterQuery::is_callback_pending() const { |
127 return !callback_.is_null(); | 124 return !callback_.is_null(); |
128 } | 125 } |
129 | 126 |
130 bool PrinterQuery::is_valid() const { | 127 bool PrinterQuery::is_valid() const { |
131 return worker_.get() != NULL; | 128 return worker_.get() != NULL; |
132 } | 129 } |
133 | 130 |
134 } // namespace printing | 131 } // namespace printing |
OLD | NEW |