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/renderer/mock_render_thread.h" | 5 #include "chrome/renderer/mock_render_thread.h" |
6 | 6 |
7 #include <fcntl.h> | 7 #include <fcntl.h> |
8 | 8 |
9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
10 #include "base/process_util.h" | 10 #include "base/process_util.h" |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
206 } | 206 } |
207 | 207 |
208 void MockRenderThread::OnDidPrintPage( | 208 void MockRenderThread::OnDidPrintPage( |
209 const PrintHostMsg_DidPrintPage_Params& params) { | 209 const PrintHostMsg_DidPrintPage_Params& params) { |
210 if (printer_.get()) | 210 if (printer_.get()) |
211 printer_->PrintPage(params); | 211 printer_->PrintPage(params); |
212 } | 212 } |
213 | 213 |
214 void MockRenderThread::OnDidGetPreviewPageCount(int document_cookie, | 214 void MockRenderThread::OnDidGetPreviewPageCount(int document_cookie, |
215 int number_pages, | 215 int number_pages, |
216 bool is_modifiable) { | 216 bool is_modifiable, |
217 int preview_request_id) { | |
217 print_preview_pages_remaining_ = number_pages; | 218 print_preview_pages_remaining_ = number_pages; |
218 } | 219 } |
219 | 220 |
220 void MockRenderThread::OnDidPreviewPage( | 221 void MockRenderThread::OnDidPreviewPage( |
221 const PrintHostMsg_DidPreviewPage_Params& params) { | 222 const PrintHostMsg_DidPreviewPage_Params& params) { |
222 if (params.page_number < printing::FIRST_PAGE_INDEX) | 223 if (params.page_number < printing::FIRST_PAGE_INDEX) |
223 return; | 224 return; |
224 print_preview_pages_remaining_--; | 225 print_preview_pages_remaining_--; |
225 } | 226 } |
226 | 227 |
227 void MockRenderThread::OnUpdatePrintSettings( | 228 void MockRenderThread::OnUpdatePrintSettings( |
228 int document_cookie, | 229 int document_cookie, |
229 const DictionaryValue& job_settings, | 230 const DictionaryValue& job_settings, |
230 PrintMsg_PrintPages_Params* params) { | 231 PrintMsg_PrintPages_Params* params) { |
231 // Check and make sure the required settings are all there. | 232 // Check and make sure the required settings are all there. |
232 // We don't actually care about the values. | 233 // We don't actually care about the values. |
233 std::string dummy_string; | 234 std::string dummy_string; |
234 if (!job_settings.GetBoolean(printing::kSettingLandscape, NULL) || | 235 if (!job_settings.GetBoolean(printing::kSettingLandscape, NULL) || |
235 !job_settings.GetBoolean(printing::kSettingCollate, NULL) || | 236 !job_settings.GetBoolean(printing::kSettingCollate, NULL) || |
236 !job_settings.GetBoolean(printing::kSettingColor, NULL) || | 237 !job_settings.GetBoolean(printing::kSettingColor, NULL) || |
237 !job_settings.GetBoolean(printing::kSettingPrintToPDF, NULL) || | 238 !job_settings.GetBoolean(printing::kSettingPrintToPDF, NULL) || |
238 !job_settings.GetString(printing::kSettingDeviceName, &dummy_string) || | 239 !job_settings.GetString(printing::kSettingDeviceName, &dummy_string) || |
239 !job_settings.GetInteger(printing::kSettingDuplexMode, NULL) || | 240 !job_settings.GetInteger(printing::kSettingDuplexMode, NULL) || |
240 !job_settings.GetInteger(printing::kSettingCopies, NULL)) { | 241 !job_settings.GetInteger(printing::kSettingCopies, NULL)) { |
kmadhusu
2011/08/08 22:20:45
Make sure job_settings has "IsFirstRequest" and "r
dpapad
2011/08/08 23:41:43
Done.
| |
241 return; | 242 return; |
242 } | 243 } |
243 | 244 |
244 // Just return the default settings. | 245 // Just return the default settings. |
245 if (printer_.get()) | 246 if (printer_.get()) |
246 printer_->UpdateSettings(document_cookie, params); | 247 printer_->UpdateSettings(document_cookie, params); |
247 } | 248 } |
248 | 249 |
249 void MockRenderThread::set_print_dialog_user_response(bool response) { | 250 void MockRenderThread::set_print_dialog_user_response(bool response) { |
250 print_dialog_user_response_ = response; | 251 print_dialog_user_response_ = response; |
251 } | 252 } |
252 | 253 |
253 int MockRenderThread::print_preview_pages_remaining() { | 254 int MockRenderThread::print_preview_pages_remaining() { |
254 return print_preview_pages_remaining_; | 255 return print_preview_pages_remaining_; |
255 } | 256 } |
OLD | NEW |