Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(15)

Side by Side Diff: printing/printed_document.h

Issue 268036: Implement the basic OS-level printing mechanics on Mac (Closed)
Patch Set: Address review comments Created 11 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 PRINTING_PRINTED_DOCUMENT_H_ 5 #ifndef PRINTING_PRINTED_DOCUMENT_H_
6 #define PRINTING_PRINTED_DOCUMENT_H_ 6 #define PRINTING_PRINTED_DOCUMENT_H_
7 7
8 #include <map> 8 #include <map>
9 9
10 #include "app/gfx/native_widget_types.h"
10 #include "base/lock.h" 11 #include "base/lock.h"
11 #include "base/ref_counted.h" 12 #include "base/ref_counted.h"
12 #include "base/scoped_ptr.h" 13 #include "base/scoped_ptr.h"
13 #include "googleurl/src/gurl.h" 14 #include "googleurl/src/gurl.h"
14 #include "printing/print_settings.h" 15 #include "printing/print_settings.h"
15 #include "printing/native_metafile.h" 16 #include "printing/native_metafile.h"
16 17
17 class MessageLoop; 18 class MessageLoop;
18 19
19 namespace gfx { 20 namespace gfx {
(...skipping 24 matching lines...) Expand all
44 // Note: locks for a short amount of time. 45 // Note: locks for a short amount of time.
45 void SetPage(int page_number, NativeMetafile* metafile, double shrink); 46 void SetPage(int page_number, NativeMetafile* metafile, double shrink);
46 47
47 // Retrieves a page. If the page is not available right now, it 48 // Retrieves a page. If the page is not available right now, it
48 // requests to have this page be rendered and returns false. 49 // requests to have this page be rendered and returns false.
49 // Note: locks for a short amount of time. 50 // Note: locks for a short amount of time.
50 bool GetPage(int page_number, scoped_refptr<PrintedPage>* page); 51 bool GetPage(int page_number, scoped_refptr<PrintedPage>* page);
51 52
52 // Draws the page in the context. 53 // Draws the page in the context.
53 // Note: locks for a short amount of time in debug only. 54 // Note: locks for a short amount of time in debug only.
54 void RenderPrintedPage(const PrintedPage& page, HDC context) const; 55 void RenderPrintedPage(const PrintedPage& page,
56 gfx::NativeDrawingContext context) const;
55 57
56 // Draws the page in the context. If the page is not available right now, it 58 // Draws the page in the context. If the page is not available right now, it
57 // requests to have this page be rendered and returns false. 59 // requests to have this page be rendered and returns false.
58 // Note: locks for a short amount of time. 60 // Note: locks for a short amount of time.
59 bool RenderPrintedPageNumber(int page_number, HDC context); 61 bool RenderPrintedPageNumber(int page_number,
62 gfx::NativeDrawingContext context);
60 63
61 // Returns true if all the necessary pages for the settings are already 64 // Returns true if all the necessary pages for the settings are already
62 // rendered. 65 // rendered.
63 // Note: locks while parsing the whole tree. 66 // Note: locks while parsing the whole tree.
64 bool IsComplete() const; 67 bool IsComplete() const;
65 68
66 // Disconnects the PrintedPage source (PrintedPagesSource). It is done when 69 // Disconnects the PrintedPage source (PrintedPagesSource). It is done when
67 // the source is being destroyed. 70 // the source is being destroyed.
68 void DisconnectSource(); 71 void DisconnectSource();
69 72
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 // PrintedPage is correctly belonging to the PrintedDocument. Since 162 // PrintedPage is correctly belonging to the PrintedDocument. Since
160 // PrintedPage generation is completely asynchronous, it could be easy to 163 // PrintedPage generation is completely asynchronous, it could be easy to
161 // mess up and send the page to the wrong document. It can be viewed as a 164 // mess up and send the page to the wrong document. It can be viewed as a
162 // simpler hash of PrintSettings since a new document is made each time the 165 // simpler hash of PrintSettings since a new document is made each time the
163 // print settings change. 166 // print settings change.
164 int cookie_; 167 int cookie_;
165 }; 168 };
166 169
167 // Prints the headers and footers for one page in the specified context 170 // Prints the headers and footers for one page in the specified context
168 // according to the current settings. 171 // according to the current settings.
169 void PrintHeaderFooter(HDC context, 172 void PrintHeaderFooter(gfx::NativeDrawingContext context,
170 const PrintedPage& page, 173 const PrintedPage& page,
171 PageOverlays::HorizontalPosition x, 174 PageOverlays::HorizontalPosition x,
172 PageOverlays::VerticalPosition y, 175 PageOverlays::VerticalPosition y,
173 const gfx::Font& font) const; 176 const gfx::Font& font) const;
174 177
175 void DebugDump(const PrintedPage& page); 178 void DebugDump(const PrintedPage& page);
176 179
177 // All writable data member access must be guarded by this lock. Needs to be 180 // All writable data member access must be guarded by this lock. Needs to be
178 // mutable since it can be acquired from const member functions. 181 // mutable since it can be acquired from const member functions.
179 mutable Lock lock_; 182 mutable Lock lock_;
180 183
181 // All the mutable members. 184 // All the mutable members.
182 Mutable mutable_; 185 Mutable mutable_;
183 186
184 // All the immutable members. 187 // All the immutable members.
185 const Immutable immutable_; 188 const Immutable immutable_;
186 189
187 DISALLOW_EVIL_CONSTRUCTORS(PrintedDocument); 190 DISALLOW_EVIL_CONSTRUCTORS(PrintedDocument);
188 }; 191 };
189 192
190 } // namespace printing 193 } // namespace printing
191 194
192 #endif // PRINTING_PRINTED_DOCUMENT_H_ 195 #endif // PRINTING_PRINTED_DOCUMENT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698