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 <utility> | 10 #include <utility> |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 | 104 |
105 if (!g_debug_dump_info.Get().empty()) | 105 if (!g_debug_dump_info.Get().empty()) |
106 DebugDumpSettings(name(), settings, blocking_runner); | 106 DebugDumpSettings(name(), settings, blocking_runner); |
107 } | 107 } |
108 | 108 |
109 PrintedDocument::~PrintedDocument() { | 109 PrintedDocument::~PrintedDocument() { |
110 } | 110 } |
111 | 111 |
112 void PrintedDocument::SetPage(int page_number, | 112 void PrintedDocument::SetPage(int page_number, |
113 std::unique_ptr<MetafilePlayer> metafile, | 113 std::unique_ptr<MetafilePlayer> metafile, |
114 #if defined(OS_WIN) | |
115 float shrink, | 114 float shrink, |
116 #endif // OS_WIN | |
117 const gfx::Size& paper_size, | 115 const gfx::Size& paper_size, |
118 const gfx::Rect& page_rect) { | 116 const gfx::Rect& page_rect) { |
119 // Notice the page_number + 1, the reason is that this is the value that will | 117 // Notice the page_number + 1, the reason is that this is the value that will |
120 // be shown. Users dislike 0-based counting. | 118 // be shown. Users dislike 0-based counting. |
121 scoped_refptr<PrintedPage> page(new PrintedPage( | 119 scoped_refptr<PrintedPage> page(new PrintedPage( |
122 page_number + 1, std::move(metafile), paper_size, page_rect)); | 120 page_number + 1, std::move(metafile), paper_size, page_rect)); |
123 #if defined(OS_WIN) | 121 #if defined(OS_WIN) |
124 page->set_shrink_factor(shrink); | 122 page->set_shrink_factor(shrink); |
125 #endif // OS_WIN | 123 #endif |
126 { | 124 { |
127 base::AutoLock lock(lock_); | 125 base::AutoLock lock(lock_); |
128 mutable_.pages_[page_number] = page; | 126 mutable_.pages_[page_number] = page; |
129 | 127 |
130 #if defined(OS_POSIX) && !defined(OS_MACOSX) | 128 #if defined(OS_POSIX) && !defined(OS_MACOSX) |
131 if (page_number < mutable_.first_page) | 129 if (page_number < mutable_.first_page) |
132 mutable_.first_page = page_number; | 130 mutable_.first_page = page_number; |
133 #endif | 131 #endif |
134 } | 132 } |
135 | 133 |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
265 | 263 |
266 #if defined(OS_ANDROID) | 264 #if defined(OS_ANDROID) |
267 // This function is not used on android. | 265 // This function is not used on android. |
268 void PrintedDocument::RenderPrintedPage(const PrintedPage& page, | 266 void PrintedDocument::RenderPrintedPage(const PrintedPage& page, |
269 PrintingContext* context) const { | 267 PrintingContext* context) const { |
270 NOTREACHED(); | 268 NOTREACHED(); |
271 } | 269 } |
272 #endif | 270 #endif |
273 | 271 |
274 } // namespace printing | 272 } // namespace printing |
OLD | NEW |