Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/print_web_view_helper.h" | 5 #include "chrome/renderer/print_web_view_helper.h" |
| 6 | 6 |
| 7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/process_util.h" | 9 #include "base/process_util.h" |
| 10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
| (...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 394 int dpi = printing::kPointsPerInch; | 394 int dpi = printing::kPointsPerInch; |
| 395 #else | 395 #else |
| 396 int dpi = static_cast<int>(params->dpi); | 396 int dpi = static_cast<int>(params->dpi); |
| 397 #endif // defined(OS_MACOSX) | 397 #endif // defined(OS_MACOSX) |
| 398 params->printable_size = gfx::Size( | 398 params->printable_size = gfx::Size( |
| 399 static_cast<int>(ConvertUnitDouble(content_width_in_points, | 399 static_cast<int>(ConvertUnitDouble(content_width_in_points, |
| 400 printing::kPointsPerInch, dpi)), | 400 printing::kPointsPerInch, dpi)), |
| 401 static_cast<int>(ConvertUnitDouble(content_height_in_points, | 401 static_cast<int>(ConvertUnitDouble(content_height_in_points, |
| 402 printing::kPointsPerInch, dpi))); | 402 printing::kPointsPerInch, dpi))); |
| 403 | 403 |
| 404 double page_width = content_width_in_points + margin_left_in_points + | |
|
Lei Zhang
2011/01/19 21:44:03
nit: |page_width| -> |page_width_in_points|
kmadhusu
2011/01/19 23:25:12
Done.
| |
| 405 margin_right_in_points; | |
| 406 double page_height = content_height_in_points + margin_top_in_points + | |
| 407 margin_bottom_in_points; | |
| 408 | |
| 404 params->page_size = gfx::Size( | 409 params->page_size = gfx::Size( |
| 405 static_cast<int>(ConvertUnitDouble(content_width_in_points + | 410 static_cast<int>( |
| 406 margin_left_in_points + margin_right_in_points, | 411 ConvertUnitDouble(page_width, printing::kPointsPerInch, dpi)), |
| 407 printing::kPointsPerInch, dpi)), | 412 static_cast<int>( |
| 408 static_cast<int>(ConvertUnitDouble(content_height_in_points + | 413 ConvertUnitDouble(page_height, printing::kPointsPerInch, dpi))); |
| 409 margin_top_in_points + margin_bottom_in_points, | |
| 410 printing::kPointsPerInch, dpi))); | |
| 411 | 414 |
| 412 params->margin_top = static_cast<int>(ConvertUnitDouble( | 415 params->margin_top = static_cast<int>(ConvertUnitDouble( |
| 413 margin_top_in_points, printing::kPointsPerInch, dpi)); | 416 margin_top_in_points, printing::kPointsPerInch, dpi)); |
| 414 params->margin_left = static_cast<int>(ConvertUnitDouble( | 417 params->margin_left = static_cast<int>(ConvertUnitDouble( |
| 415 margin_left_in_points, printing::kPointsPerInch, dpi)); | 418 margin_left_in_points, printing::kPointsPerInch, dpi)); |
| 416 } | 419 } |
| 417 | 420 |
| 418 bool PrintWebViewHelper::InitPrintSettings(WebFrame* frame, | 421 bool PrintWebViewHelper::InitPrintSettings(WebFrame* frame, |
| 419 WebNode* node) { | 422 WebNode* node) { |
| 420 ViewMsg_PrintPages_Params settings; | 423 ViewMsg_PrintPages_Params settings; |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 529 shared_buf.GiveToProcess(base::GetCurrentProcessHandle(), | 532 shared_buf.GiveToProcess(base::GetCurrentProcessHandle(), |
| 530 shared_mem_handle); | 533 shared_mem_handle); |
| 531 return true; | 534 return true; |
| 532 } | 535 } |
| 533 } | 536 } |
| 534 } | 537 } |
| 535 NOTREACHED(); | 538 NOTREACHED(); |
| 536 return false; | 539 return false; |
| 537 } | 540 } |
| 538 #endif | 541 #endif |
| OLD | NEW |