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 16 matching lines...) Expand all Loading... |
27 #include "ui/gfx/font.h" | 27 #include "ui/gfx/font.h" |
28 | 28 |
29 namespace { | 29 namespace { |
30 | 30 |
31 struct PrintDebugDumpPath { | 31 struct PrintDebugDumpPath { |
32 PrintDebugDumpPath() | 32 PrintDebugDumpPath() |
33 : enabled(false) { | 33 : enabled(false) { |
34 } | 34 } |
35 | 35 |
36 bool enabled; | 36 bool enabled; |
37 FilePath debug_dump_path; | 37 base::FilePath debug_dump_path; |
38 }; | 38 }; |
39 | 39 |
40 base::LazyInstance<PrintDebugDumpPath> g_debug_dump_info = | 40 base::LazyInstance<PrintDebugDumpPath> g_debug_dump_info = |
41 LAZY_INSTANCE_INITIALIZER; | 41 LAZY_INSTANCE_INITIALIZER; |
42 | 42 |
43 } // namespace | 43 } // namespace |
44 | 44 |
45 namespace printing { | 45 namespace printing { |
46 | 46 |
47 PrintedDocument::PrintedDocument(const PrintSettings& settings, | 47 PrintedDocument::PrintedDocument(const PrintSettings& settings, |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 filename += ASCIIToUTF16("_.emf"); | 184 filename += ASCIIToUTF16("_.emf"); |
185 page.metafile()->SaveTo( | 185 page.metafile()->SaveTo( |
186 g_debug_dump_info.Get().debug_dump_path.Append(filename)); | 186 g_debug_dump_info.Get().debug_dump_path.Append(filename)); |
187 #else // OS_WIN | 187 #else // OS_WIN |
188 filename += ASCIIToUTF16("_.pdf"); | 188 filename += ASCIIToUTF16("_.pdf"); |
189 page.metafile()->SaveTo( | 189 page.metafile()->SaveTo( |
190 g_debug_dump_info.Get().debug_dump_path.Append(UTF16ToUTF8(filename))); | 190 g_debug_dump_info.Get().debug_dump_path.Append(UTF16ToUTF8(filename))); |
191 #endif // OS_WIN | 191 #endif // OS_WIN |
192 } | 192 } |
193 | 193 |
194 void PrintedDocument::set_debug_dump_path(const FilePath& debug_dump_path) { | 194 void PrintedDocument::set_debug_dump_path( |
| 195 const base::FilePath& debug_dump_path) { |
195 g_debug_dump_info.Get().enabled = !debug_dump_path.empty(); | 196 g_debug_dump_info.Get().enabled = !debug_dump_path.empty(); |
196 g_debug_dump_info.Get().debug_dump_path = debug_dump_path; | 197 g_debug_dump_info.Get().debug_dump_path = debug_dump_path; |
197 } | 198 } |
198 | 199 |
199 const FilePath& PrintedDocument::debug_dump_path() { | 200 const base::FilePath& PrintedDocument::debug_dump_path() { |
200 return g_debug_dump_info.Get().debug_dump_path; | 201 return g_debug_dump_info.Get().debug_dump_path; |
201 } | 202 } |
202 | 203 |
203 PrintedDocument::Mutable::Mutable(PrintedPagesSource* source) | 204 PrintedDocument::Mutable::Mutable(PrintedPagesSource* source) |
204 : source_(source), | 205 : source_(source), |
205 expected_page_count_(0), | 206 expected_page_count_(0), |
206 page_count_(0) { | 207 page_count_(0) { |
207 #if defined(OS_POSIX) && !defined(OS_MACOSX) | 208 #if defined(OS_POSIX) && !defined(OS_MACOSX) |
208 first_page = INT_MAX; | 209 first_page = INT_MAX; |
209 #endif | 210 #endif |
(...skipping 15 matching lines...) Expand all Loading... |
225 } | 226 } |
226 | 227 |
227 #if defined(OS_POSIX) && defined(USE_AURA) | 228 #if defined(OS_POSIX) && defined(USE_AURA) |
228 // This function is not used on aura linux/chromeos. | 229 // This function is not used on aura linux/chromeos. |
229 void PrintedDocument::RenderPrintedPage(const PrintedPage& page, | 230 void PrintedDocument::RenderPrintedPage(const PrintedPage& page, |
230 PrintingContext* context) const { | 231 PrintingContext* context) const { |
231 } | 232 } |
232 #endif | 233 #endif |
233 | 234 |
234 } // namespace printing | 235 } // namespace printing |
OLD | NEW |