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