Upload upstream chromium 73.0.3683.0
[platform/framework/web/chromium-efl.git] / printing / printed_page_win.h
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.
4
5 #ifndef PRINTING_PRINTED_PAGE_WIN_H_
6 #define PRINTING_PRINTED_PAGE_WIN_H_
7
8 #include <memory>
9
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"
15
16 namespace printing {
17
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> {
26  public:
27   PrintedPage(int page_number,
28               std::unique_ptr<MetafilePlayer> metafile,
29               const gfx::Size& page_size,
30               const gfx::Rect& page_content_rect);
31
32   // Getters
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;
39   }
40   float shrink_factor() const { return shrink_factor_; }
41
42  private:
43   friend class base::RefCountedThreadSafe<PrintedPage>;
44
45   ~PrintedPage();
46
47   // Page number inside the printed document.
48   const int page_number_;
49
50   // Actual paint data.
51   const std::unique_ptr<MetafilePlayer> metafile_;
52
53   // Shrink done in comparison to desired_dpi.
54   float shrink_factor_;
55
56   // The physical page size. To support multiple page formats inside on print
57   // job.
58   const gfx::Size page_size_;
59
60   // The printable area of the page.
61   const gfx::Rect page_content_rect_;
62
63   DISALLOW_COPY_AND_ASSIGN(PrintedPage);
64 };
65
66 }  // namespace printing
67
68 #endif  // PRINTING_PRINTED_PAGE_WIN_H_