1 // Copyright 2011 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef PRINTING_PRINTED_PAGE_WIN_H_
6 #define PRINTING_PRINTED_PAGE_WIN_H_
10 #include "base/memory/ref_counted.h"
11 #include "printing/metafile.h"
12 #include "ui/gfx/geometry/rect.h"
13 #include "ui/gfx/geometry/size.h"
17 // Contains the data to reproduce a printed page, either on screen or on
18 // paper. Once created, this object is immutable. It has no reference to the
19 // PrintedDocument containing this page.
20 // Note: May be accessed from many threads at the same time. This is an non
21 // issue since this object is immutable. The reason is that a page may be
22 // printed and be displayed at the same time.
23 class COMPONENT_EXPORT(PRINTING) PrintedPage
24 : public base::RefCountedThreadSafe<PrintedPage> {
26 PrintedPage(uint32_t page_number,
27 std::unique_ptr<MetafilePlayer> metafile,
28 const gfx::Size& page_size,
29 const gfx::Rect& page_content_rect);
30 PrintedPage(const PrintedPage&) = delete;
31 PrintedPage& operator=(const PrintedPage&) = delete;
34 uint32_t page_number() const { return page_number_; }
35 const MetafilePlayer* metafile() const;
36 const gfx::Size& page_size() const { return page_size_; }
37 const gfx::Rect& page_content_rect() const { return page_content_rect_; }
38 void set_shrink_factor(float shrink_factor) {
39 shrink_factor_ = shrink_factor;
41 float shrink_factor() const { return shrink_factor_; }
44 friend class base::RefCountedThreadSafe<PrintedPage>;
48 // Page number inside the printed document.
49 const uint32_t page_number_;
52 const std::unique_ptr<MetafilePlayer> metafile_;
54 // Shrink done in comparison to desired_dpi.
57 // The physical page size. To support multiple page formats inside on print
59 const gfx::Size page_size_;
61 // The printable area of the page.
62 const gfx::Rect page_content_rect_;
65 } // namespace printing
67 #endif // PRINTING_PRINTED_PAGE_WIN_H_