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
3 // found in the LICENSE file.
5 #ifndef PRINTING_PRINTED_PAGE_WIN_H_
6 #define PRINTING_PRINTED_PAGE_WIN_H_
10 #include "base/macros.h"
11 #include "base/memory/ref_counted.h"
12 #include "printing/metafile.h"
13 #include "ui/gfx/geometry/rect.h"
14 #include "ui/gfx/geometry/size.h"
18 // Contains the data to reproduce a printed page, either on screen or on
19 // paper. Once created, this object is immutable. It has no reference to the
20 // PrintedDocument containing this page.
21 // Note: May be accessed from many threads at the same time. This is an non
22 // issue since this object is immutable. The reason is that a page may be
23 // printed and be displayed at the same time.
24 class PRINTING_EXPORT PrintedPage
25 : public base::RefCountedThreadSafe<PrintedPage> {
27 PrintedPage(int page_number,
28 std::unique_ptr<MetafilePlayer> metafile,
29 const gfx::Size& page_size,
30 const gfx::Rect& page_content_rect);
33 int page_number() const { return page_number_; }
34 const MetafilePlayer* metafile() const;
35 const gfx::Size& page_size() const { return page_size_; }
36 const gfx::Rect& page_content_rect() const { return page_content_rect_; }
37 void set_shrink_factor(float shrink_factor) {
38 shrink_factor_ = shrink_factor;
40 float shrink_factor() const { return shrink_factor_; }
43 friend class base::RefCountedThreadSafe<PrintedPage>;
47 // Page number inside the printed document.
48 const int page_number_;
51 const std::unique_ptr<MetafilePlayer> metafile_;
53 // Shrink done in comparison to desired_dpi.
56 // The physical page size. To support multiple page formats inside on print
58 const gfx::Size page_size_;
60 // The printable area of the page.
61 const gfx::Rect page_content_rect_;
63 DISALLOW_COPY_AND_ASSIGN(PrintedPage);
66 } // namespace printing
68 #endif // PRINTING_PRINTED_PAGE_WIN_H_