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 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 } | 226 } |
227 | 227 |
228 void MockRenderThread::OnCheckForCancel(const std::string& preview_ui_addr, | 228 void MockRenderThread::OnCheckForCancel(const std::string& preview_ui_addr, |
229 int preview_request_id, | 229 int preview_request_id, |
230 bool* cancel) { | 230 bool* cancel) { |
231 *cancel = | 231 *cancel = |
232 (print_preview_pages_remaining_ == print_preview_cancel_page_number_); | 232 (print_preview_pages_remaining_ == print_preview_cancel_page_number_); |
233 } | 233 } |
234 | 234 |
235 void MockRenderThread::OnUpdatePrintSettings( | 235 void MockRenderThread::OnUpdatePrintSettings( |
236 int document_cookie, | |
237 const DictionaryValue& job_settings, | 236 const DictionaryValue& job_settings, |
238 PrintMsg_PrintPages_Params* params) { | 237 PrintMsg_PrintPages_Params* params) { |
239 // Check and make sure the required settings are all there. | 238 // Check and make sure the required settings are all there. |
240 // We don't actually care about the values. | 239 // We don't actually care about the values. |
241 std::string dummy_string; | 240 std::string dummy_string; |
242 if (!job_settings.GetBoolean(printing::kSettingLandscape, NULL) || | 241 if (!job_settings.GetBoolean(printing::kSettingLandscape, NULL) || |
243 !job_settings.GetBoolean(printing::kSettingCollate, NULL) || | 242 !job_settings.GetBoolean(printing::kSettingCollate, NULL) || |
244 !job_settings.GetInteger(printing::kSettingColor, NULL) || | 243 !job_settings.GetInteger(printing::kSettingColor, NULL) || |
245 !job_settings.GetBoolean(printing::kSettingPrintToPDF, NULL) || | 244 !job_settings.GetBoolean(printing::kSettingPrintToPDF, NULL) || |
246 !job_settings.GetBoolean(printing::kIsFirstRequest, NULL) || | 245 !job_settings.GetBoolean(printing::kIsFirstRequest, NULL) || |
(...skipping 20 matching lines...) Expand all Loading... |
267 continue; | 266 continue; |
268 } | 267 } |
269 // Page numbers are 1-based in the dictionary. | 268 // Page numbers are 1-based in the dictionary. |
270 // Page numbers are 0-based for the printing context. | 269 // Page numbers are 0-based for the printing context. |
271 range.from--; | 270 range.from--; |
272 range.to--; | 271 range.to--; |
273 new_ranges.push_back(range); | 272 new_ranges.push_back(range); |
274 } | 273 } |
275 } | 274 } |
276 std::vector<int> pages(printing::PageRange::GetPages(new_ranges)); | 275 std::vector<int> pages(printing::PageRange::GetPages(new_ranges)); |
277 printer_->UpdateSettings(document_cookie, params, pages); | 276 printer_->UpdateSettings(params, pages); |
278 } | 277 } |
279 } | 278 } |
280 | 279 |
281 void MockRenderThread::set_print_dialog_user_response(bool response) { | 280 void MockRenderThread::set_print_dialog_user_response(bool response) { |
282 print_dialog_user_response_ = response; | 281 print_dialog_user_response_ = response; |
283 } | 282 } |
284 | 283 |
285 void MockRenderThread::set_print_preview_cancel_page_number(int page) { | 284 void MockRenderThread::set_print_preview_cancel_page_number(int page) { |
286 print_preview_cancel_page_number_ = page; | 285 print_preview_cancel_page_number_ = page; |
287 } | 286 } |
288 | 287 |
289 int MockRenderThread::print_preview_pages_remaining() { | 288 int MockRenderThread::print_preview_pages_remaining() { |
290 return print_preview_pages_remaining_; | 289 return print_preview_pages_remaining_; |
291 } | 290 } |
OLD | NEW |