| 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/utility/chrome_content_utility_client.h" | 5 #include "chrome/utility/chrome_content_utility_client.h" |
| 6 | 6 |
| 7 #include "base/base64.h" | 7 #include "base/base64.h" |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
| (...skipping 702 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 713 | 713 |
| 714 cloud_print::BitmapImage image(settings.area().size(), | 714 cloud_print::BitmapImage image(settings.area().size(), |
| 715 cloud_print::BitmapImage::BGRA); | 715 cloud_print::BitmapImage::BGRA); |
| 716 for (int i = 0; i < total_page_count; ++i) { | 716 for (int i = 0; i < total_page_count; ++i) { |
| 717 int page_number = i; | 717 int page_number = i; |
| 718 | 718 |
| 719 if (bitmap_settings.reverse_page_order) { | 719 if (bitmap_settings.reverse_page_order) { |
| 720 page_number = total_page_count - 1 - page_number; | 720 page_number = total_page_count - 1 - page_number; |
| 721 } | 721 } |
| 722 | 722 |
| 723 bool rotate = false; |
| 724 |
| 725 // Transform odd pages. |
| 726 if (page_number % 2) { |
| 727 rotate = |
| 728 (bitmap_settings.odd_page_transform != printing::TRANSFORM_NORMAL); |
| 729 } |
| 730 |
| 723 if (!g_pdf_lib.Get().RenderPDFPageToBitmap(data.data(), | 731 if (!g_pdf_lib.Get().RenderPDFPageToBitmap(data.data(), |
| 724 data.size(), | 732 data.size(), |
| 725 page_number, | 733 page_number, |
| 726 image.pixel_data(), | 734 image.pixel_data(), |
| 727 image.size().width(), | 735 image.size().width(), |
| 728 image.size().height(), | 736 image.size().height(), |
| 729 settings.dpi(), | 737 settings.dpi(), |
| 730 settings.dpi(), | 738 settings.dpi(), |
| 731 autoupdate)) { | 739 autoupdate)) { |
| 732 return false; | 740 return false; |
| 733 } | 741 } |
| 734 std::string pwg_page; | 742 std::string pwg_page; |
| 735 if (!encoder.EncodePage(image, settings.dpi(), total_page_count, &pwg_page)) | 743 if (!encoder.EncodePage( |
| 744 image, settings.dpi(), total_page_count, &pwg_page, rotate)) |
| 736 return false; | 745 return false; |
| 737 bytes_written = base::WritePlatformFileAtCurrentPos(bitmap_file, | 746 bytes_written = base::WritePlatformFileAtCurrentPos(bitmap_file, |
| 738 pwg_page.data(), | 747 pwg_page.data(), |
| 739 pwg_page.size()); | 748 pwg_page.size()); |
| 740 if (bytes_written != static_cast<int>(pwg_page.size())) | 749 if (bytes_written != static_cast<int>(pwg_page.size())) |
| 741 return false; | 750 return false; |
| 742 } | 751 } |
| 743 return true; | 752 return true; |
| 744 } | 753 } |
| 745 | 754 |
| (...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 986 NetworkingPrivateCrypto crypto; | 995 NetworkingPrivateCrypto crypto; |
| 987 success = crypto.EncryptByteString(public_key, key_data, &ciphertext); | 996 success = crypto.EncryptByteString(public_key, key_data, &ciphertext); |
| 988 } | 997 } |
| 989 | 998 |
| 990 Send(new ChromeUtilityHostMsg_GotEncryptedWiFiCredentials(ciphertext, | 999 Send(new ChromeUtilityHostMsg_GotEncryptedWiFiCredentials(ciphertext, |
| 991 success)); | 1000 success)); |
| 992 } | 1001 } |
| 993 #endif // defined(OS_WIN) | 1002 #endif // defined(OS_WIN) |
| 994 | 1003 |
| 995 } // namespace chrome | 1004 } // namespace chrome |
| OLD | NEW |