| 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 "printing/printed_document.h" | 5 #include "printing/printed_document.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <set> | 8 #include <set> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 mutable_.expected_page_count_ += range.to - range.from + 1; | 58 mutable_.expected_page_count_ += range.to - range.from + 1; |
| 59 } | 59 } |
| 60 } | 60 } |
| 61 } | 61 } |
| 62 | 62 |
| 63 PrintedDocument::~PrintedDocument() { | 63 PrintedDocument::~PrintedDocument() { |
| 64 } | 64 } |
| 65 | 65 |
| 66 void PrintedDocument::SetPage(int page_number, | 66 void PrintedDocument::SetPage(int page_number, |
| 67 Metafile* metafile, | 67 Metafile* metafile, |
| 68 #if defined(OS_WIN) |
| 68 double shrink, | 69 double shrink, |
| 70 #endif // OS_WIN |
| 69 const gfx::Size& paper_size, | 71 const gfx::Size& paper_size, |
| 70 const gfx::Rect& page_rect) { | 72 const gfx::Rect& page_rect) { |
| 71 // Notice the page_number + 1, the reason is that this is the value that will | 73 // Notice the page_number + 1, the reason is that this is the value that will |
| 72 // be shown. Users dislike 0-based counting. | 74 // be shown. Users dislike 0-based counting. |
| 73 scoped_refptr<PrintedPage> page( | 75 scoped_refptr<PrintedPage> page( |
| 74 new PrintedPage(page_number + 1, | 76 new PrintedPage(page_number + 1, metafile, paper_size, page_rect)); |
| 75 metafile, | 77 #if defined(OS_WIN) |
| 76 paper_size, | 78 page->set_shrink_factor(shrink); |
| 77 page_rect, | 79 #endif // OS_WIN |
| 78 shrink)); | |
| 79 { | 80 { |
| 80 base::AutoLock lock(lock_); | 81 base::AutoLock lock(lock_); |
| 81 mutable_.pages_[page_number] = page; | 82 mutable_.pages_[page_number] = page; |
| 82 | 83 |
| 83 #if defined(OS_POSIX) && !defined(OS_MACOSX) | 84 #if defined(OS_POSIX) && !defined(OS_MACOSX) |
| 84 if (page_number < mutable_.first_page) | 85 if (page_number < mutable_.first_page) |
| 85 mutable_.first_page = page_number; | 86 mutable_.first_page = page_number; |
| 86 #endif | 87 #endif |
| 87 } | 88 } |
| 88 DebugDump(*page.get()); | 89 DebugDump(*page.get()); |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 228 } | 229 } |
| 229 | 230 |
| 230 #if defined(OS_CHROMEOS) || defined(OS_ANDROID) | 231 #if defined(OS_CHROMEOS) || defined(OS_ANDROID) |
| 231 // This function is not used on aura linux/chromeos or android. | 232 // This function is not used on aura linux/chromeos or android. |
| 232 void PrintedDocument::RenderPrintedPage(const PrintedPage& page, | 233 void PrintedDocument::RenderPrintedPage(const PrintedPage& page, |
| 233 PrintingContext* context) const { | 234 PrintingContext* context) const { |
| 234 } | 235 } |
| 235 #endif | 236 #endif |
| 236 | 237 |
| 237 } // namespace printing | 238 } // namespace printing |
| OLD | NEW |