OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 #ifndef CHROME_BROWSER_PRINTING_PRINTED_DOCUMENT_H__ | 5 #ifndef CHROME_BROWSER_PRINTING_PRINTED_DOCUMENT_H__ |
6 #define CHROME_BROWSER_PRINTING_PRINTED_DOCUMENT_H__ | 6 #define CHROME_BROWSER_PRINTING_PRINTED_DOCUMENT_H__ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 | 9 |
10 #include "base/lock.h" | 10 #include "base/lock.h" |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 // Getters. All these items are immutable hence thread-safe. | 89 // Getters. All these items are immutable hence thread-safe. |
90 const PrintSettings& settings() const { return immutable_.settings_; } | 90 const PrintSettings& settings() const { return immutable_.settings_; } |
91 const std::wstring& name() const { | 91 const std::wstring& name() const { |
92 return immutable_.name_; | 92 return immutable_.name_; |
93 } | 93 } |
94 const GURL& url() const { return immutable_.url_; } | 94 const GURL& url() const { return immutable_.url_; } |
95 const std::wstring& date() const { return immutable_.date_; } | 95 const std::wstring& date() const { return immutable_.date_; } |
96 const std::wstring& time() const { return immutable_.time_; } | 96 const std::wstring& time() const { return immutable_.time_; } |
97 const int cookie() const { return immutable_.cookie_; } | 97 const int cookie() const { return immutable_.cookie_; } |
98 | 98 |
| 99 // Sets a path where to dump printing output files for debugging. If never set |
| 100 // no files are generated. |
| 101 static void set_debug_dump_path(const std::wstring& debug_dump_path); |
| 102 |
| 103 static const std::wstring& debug_dump_path(); |
| 104 |
99 private: | 105 private: |
100 // Array of EMF data for each print previewed page. | 106 // Array of EMF data for each print previewed page. |
101 typedef std::map<int, scoped_refptr<PrintedPage>> PrintedPages; | 107 typedef std::map<int, scoped_refptr<PrintedPage>> PrintedPages; |
102 | 108 |
103 // Contains all the mutable stuff. All this stuff MUST be accessed with the | 109 // Contains all the mutable stuff. All this stuff MUST be accessed with the |
104 // lock held. | 110 // lock held. |
105 struct Mutable { | 111 struct Mutable { |
106 Mutable(PrintedPagesSource* source); | 112 Mutable(PrintedPagesSource* source); |
107 | 113 |
108 // Source that generates the PrintedPage's (i.e. a TabContents). It will be | 114 // Source that generates the PrintedPage's (i.e. a TabContents). It will be |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 }; | 165 }; |
160 | 166 |
161 // Prints the headers and footers for one page in the specified context | 167 // Prints the headers and footers for one page in the specified context |
162 // according to the current settings. | 168 // according to the current settings. |
163 void PrintHeaderFooter(HDC context, | 169 void PrintHeaderFooter(HDC context, |
164 const PrintedPage& page, | 170 const PrintedPage& page, |
165 PageOverlays::HorizontalPosition x, | 171 PageOverlays::HorizontalPosition x, |
166 PageOverlays::VerticalPosition y, | 172 PageOverlays::VerticalPosition y, |
167 const gfx::Font& font) const; | 173 const gfx::Font& font) const; |
168 | 174 |
| 175 void DebugDump(const PrintedPage& page); |
| 176 |
169 // All writable data member access must be guarded by this lock. Needs to be | 177 // All writable data member access must be guarded by this lock. Needs to be |
170 // mutable since it can be acquired from const member functions. | 178 // mutable since it can be acquired from const member functions. |
171 mutable Lock lock_; | 179 mutable Lock lock_; |
172 | 180 |
173 // All the mutable members. | 181 // All the mutable members. |
174 Mutable mutable_; | 182 Mutable mutable_; |
175 | 183 |
176 // All the immutable members. | 184 // All the immutable members. |
177 const Immutable immutable_; | 185 const Immutable immutable_; |
178 | 186 |
179 DISALLOW_EVIL_CONSTRUCTORS(PrintedDocument); | 187 DISALLOW_EVIL_CONSTRUCTORS(PrintedDocument); |
180 }; | 188 }; |
181 | 189 |
182 } // namespace printing | 190 } // namespace printing |
183 | 191 |
184 #endif // CHROME_BROWSER_PRINTING_PRINTED_DOCUMENT_H__ | 192 #endif // CHROME_BROWSER_PRINTING_PRINTED_DOCUMENT_H__ |
OLD | NEW |