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/renderer/mock_printer.h" | 5 #include "chrome/renderer/mock_printer.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
9 #include "base/memory/shared_memory.h" | 9 #include "base/memory/shared_memory.h" |
10 #include "base/strings/string16.h" | 10 #include "base/strings/string16.h" |
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
266 *checksum = pages_[page]->image().checksum(); | 266 *checksum = pages_[page]->image().checksum(); |
267 return true; | 267 return true; |
268 } | 268 } |
269 | 269 |
270 bool MockPrinter::SaveSource( | 270 bool MockPrinter::SaveSource( |
271 unsigned int page, const base::FilePath& filepath) const { | 271 unsigned int page, const base::FilePath& filepath) const { |
272 if (printer_status_ != PRINTER_READY || page >= pages_.size()) | 272 if (printer_status_ != PRINTER_READY || page >= pages_.size()) |
273 return false; | 273 return false; |
274 const uint8* source_data = pages_[page]->source_data(); | 274 const uint8* source_data = pages_[page]->source_data(); |
275 uint32 source_size = pages_[page]->source_size(); | 275 uint32 source_size = pages_[page]->source_size(); |
276 file_util::WriteFile(filepath, reinterpret_cast<const char*>(source_data), | 276 base::WriteFile(filepath, reinterpret_cast<const char*>(source_data), |
277 source_size); | 277 source_size); |
278 return true; | 278 return true; |
279 } | 279 } |
280 | 280 |
281 bool MockPrinter::SaveBitmap( | 281 bool MockPrinter::SaveBitmap( |
282 unsigned int page, const base::FilePath& filepath) const { | 282 unsigned int page, const base::FilePath& filepath) const { |
283 if (printer_status_ != PRINTER_READY || page >= pages_.size()) | 283 if (printer_status_ != PRINTER_READY || page >= pages_.size()) |
284 return false; | 284 return false; |
285 | 285 |
286 pages_[page]->image().SaveToPng(filepath); | 286 pages_[page]->image().SaveToPng(filepath); |
287 return true; | 287 return true; |
(...skipping 17 matching lines...) Expand all Loading... |
305 params->margin_left = margin_left_; | 305 params->margin_left = margin_left_; |
306 params->margin_top = margin_top_; | 306 params->margin_top = margin_top_; |
307 params->is_first_request = is_first_request_; | 307 params->is_first_request = is_first_request_; |
308 params->print_scaling_option = print_scaling_option_; | 308 params->print_scaling_option = print_scaling_option_; |
309 params->print_to_pdf = print_to_pdf_; | 309 params->print_to_pdf = print_to_pdf_; |
310 params->preview_request_id = preview_request_id_; | 310 params->preview_request_id = preview_request_id_; |
311 params->display_header_footer = display_header_footer_; | 311 params->display_header_footer = display_header_footer_; |
312 params->title = title_; | 312 params->title = title_; |
313 params->url = url_; | 313 params->url = url_; |
314 } | 314 } |
OLD | NEW |