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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
71 // Notice the page_number + 1, the reason is that this is the value that will | 71 // Notice the page_number + 1, the reason is that this is the value that will |
72 // be shown. Users dislike 0-based counting. | 72 // be shown. Users dislike 0-based counting. |
73 scoped_refptr<PrintedPage> page( | 73 scoped_refptr<PrintedPage> page( |
74 new PrintedPage(page_number + 1, | 74 new PrintedPage(page_number + 1, |
75 metafile, | 75 metafile, |
76 paper_size, | 76 paper_size, |
77 page_rect)); | 77 page_rect)); |
78 { | 78 { |
79 base::AutoLock lock(lock_); | 79 base::AutoLock lock(lock_); |
80 mutable_.pages_[page_number] = page; | 80 mutable_.pages_[page_number] = page; |
81 mutable_.shrink_factor = shrink; | |
81 | 82 |
82 #if defined(OS_POSIX) && !defined(OS_MACOSX) | 83 #if defined(OS_POSIX) && !defined(OS_MACOSX) |
83 if (page_number < mutable_.first_page) | 84 if (page_number < mutable_.first_page) |
84 mutable_.first_page = page_number; | 85 mutable_.first_page = page_number; |
85 #endif | 86 #endif |
86 | |
87 if (mutable_.shrink_factor == 0) { | |
88 mutable_.shrink_factor = shrink; | |
89 } else { | |
90 DCHECK_EQ(mutable_.shrink_factor, shrink); | |
vandebo (ex-Chrome)
2012/01/03 21:55:12
I think this DCHECK is saying that shrink must be
kmadhusu
2012/01/04 16:55:35
Still working on this.
kmadhusu
2012/01/05 01:15:47
Moved shrink_factor to PrintedPage class.
| |
91 } | |
92 } | 87 } |
93 DebugDump(*page); | 88 DebugDump(*page); |
94 } | 89 } |
95 | 90 |
96 bool PrintedDocument::GetPage(int page_number, | 91 bool PrintedDocument::GetPage(int page_number, |
97 scoped_refptr<PrintedPage>* page) { | 92 scoped_refptr<PrintedPage>* page) { |
98 base::AutoLock lock(lock_); | 93 base::AutoLock lock(lock_); |
99 PrintedPages::const_iterator itr = mutable_.pages_.find(page_number); | 94 PrintedPages::const_iterator itr = mutable_.pages_.find(page_number); |
100 if (itr != mutable_.pages_.end()) { | 95 if (itr != mutable_.pages_.end()) { |
101 if (itr->second.get()) { | 96 if (itr->second.get()) { |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
231 } | 226 } |
232 | 227 |
233 #if defined(OS_POSIX) && defined(USE_AURA) | 228 #if defined(OS_POSIX) && defined(USE_AURA) |
234 // This function is not used on aura linux/chromeos. | 229 // This function is not used on aura linux/chromeos. |
235 void PrintedDocument::RenderPrintedPage(const PrintedPage& page, | 230 void PrintedDocument::RenderPrintedPage(const PrintedPage& page, |
236 PrintingContext* context) const { | 231 PrintingContext* context) const { |
237 } | 232 } |
238 #endif | 233 #endif |
239 | 234 |
240 } // namespace printing | 235 } // namespace printing |
OLD | NEW |