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 <vector> | 11 #include <vector> |
11 | 12 |
12 #include "base/bind.h" | 13 #include "base/bind.h" |
13 #include "base/files/file_path.h" | 14 #include "base/files/file_path.h" |
14 #include "base/files/file_util.h" | 15 #include "base/files/file_util.h" |
15 #include "base/i18n/file_util_icu.h" | 16 #include "base/i18n/file_util_icu.h" |
16 #include "base/i18n/time_formatting.h" | 17 #include "base/i18n/time_formatting.h" |
17 #include "base/json/json_writer.h" | 18 #include "base/json/json_writer.h" |
18 #include "base/lazy_instance.h" | 19 #include "base/lazy_instance.h" |
19 #include "base/memory/ref_counted_memory.h" | 20 #include "base/memory/ref_counted_memory.h" |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 | 112 |
112 void PrintedDocument::SetPage(int page_number, | 113 void PrintedDocument::SetPage(int page_number, |
113 scoped_ptr<MetafilePlayer> metafile, | 114 scoped_ptr<MetafilePlayer> metafile, |
114 #if defined(OS_WIN) | 115 #if defined(OS_WIN) |
115 float shrink, | 116 float shrink, |
116 #endif // OS_WIN | 117 #endif // OS_WIN |
117 const gfx::Size& paper_size, | 118 const gfx::Size& paper_size, |
118 const gfx::Rect& page_rect) { | 119 const gfx::Rect& page_rect) { |
119 // Notice the page_number + 1, the reason is that this is the value that will | 120 // Notice the page_number + 1, the reason is that this is the value that will |
120 // be shown. Users dislike 0-based counting. | 121 // be shown. Users dislike 0-based counting. |
121 scoped_refptr<PrintedPage> page( | 122 scoped_refptr<PrintedPage> page(new PrintedPage( |
122 new PrintedPage(page_number + 1, metafile.Pass(), paper_size, page_rect)); | 123 page_number + 1, std::move(metafile), paper_size, page_rect)); |
123 #if defined(OS_WIN) | 124 #if defined(OS_WIN) |
124 page->set_shrink_factor(shrink); | 125 page->set_shrink_factor(shrink); |
125 #endif // OS_WIN | 126 #endif // OS_WIN |
126 { | 127 { |
127 base::AutoLock lock(lock_); | 128 base::AutoLock lock(lock_); |
128 mutable_.pages_[page_number] = page; | 129 mutable_.pages_[page_number] = page; |
129 | 130 |
130 #if defined(OS_POSIX) && !defined(OS_MACOSX) | 131 #if defined(OS_POSIX) && !defined(OS_MACOSX) |
131 if (page_number < mutable_.first_page) | 132 if (page_number < mutable_.first_page) |
132 mutable_.first_page = page_number; | 133 mutable_.first_page = page_number; |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
263 } | 264 } |
264 | 265 |
265 #if defined(OS_CHROMEOS) || defined(OS_ANDROID) | 266 #if defined(OS_CHROMEOS) || defined(OS_ANDROID) |
266 // This function is not used on aura linux/chromeos or android. | 267 // This function is not used on aura linux/chromeos or android. |
267 void PrintedDocument::RenderPrintedPage(const PrintedPage& page, | 268 void PrintedDocument::RenderPrintedPage(const PrintedPage& page, |
268 PrintingContext* context) const { | 269 PrintingContext* context) const { |
269 } | 270 } |
270 #endif | 271 #endif |
271 | 272 |
272 } // namespace printing | 273 } // namespace printing |
OLD | NEW |