OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 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 CHROME_RENDERER_MOCK_PRINTER_H_ | 5 #ifndef CHROME_RENDERER_MOCK_PRINTER_H_ |
6 #define CHROME_RENDERER_MOCK_PRINTER_H_ | 6 #define CHROME_RENDERER_MOCK_PRINTER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
15 #include "base/string16.h" | 15 #include "base/string16.h" |
16 #include "printing/image.h" | 16 #include "printing/image.h" |
| 17 #include "ui/gfx/rect.h" |
17 #include "ui/gfx/size.h" | 18 #include "ui/gfx/size.h" |
18 | 19 |
19 struct PrintMsg_Print_Params; | 20 struct PrintMsg_Print_Params; |
20 struct PrintMsg_PrintPages_Params; | 21 struct PrintMsg_PrintPages_Params; |
21 struct PrintHostMsg_DidPrintPage_Params; | 22 struct PrintHostMsg_DidPrintPage_Params; |
22 | 23 |
23 // A class which represents an output page used in the MockPrinter class. | 24 // A class which represents an output page used in the MockPrinter class. |
24 // The MockPrinter class stores output pages in a vector, so, this class | 25 // The MockPrinter class stores output pages in a vector, so, this class |
25 // inherits the base::RefCounted<> class so that the MockPrinter class can use | 26 // inherits the base::RefCounted<> class so that the MockPrinter class can use |
26 // a smart pointer of this object (i.e. scoped_refptr<>). | 27 // a smart pointer of this object (i.e. scoped_refptr<>). |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 | 104 |
104 private: | 105 private: |
105 // Helper function to fill the fields in |params|. | 106 // Helper function to fill the fields in |params|. |
106 void SetPrintParams(PrintMsg_Print_Params* params); | 107 void SetPrintParams(PrintMsg_Print_Params* params); |
107 | 108 |
108 // In pixels according to dpi_x and dpi_y. | 109 // In pixels according to dpi_x and dpi_y. |
109 gfx::Size page_size_; | 110 gfx::Size page_size_; |
110 gfx::Size content_size_; | 111 gfx::Size content_size_; |
111 int margin_left_; | 112 int margin_left_; |
112 int margin_top_; | 113 int margin_top_; |
| 114 gfx::Rect printable_area_; |
113 | 115 |
114 // Specifies dots per inch. | 116 // Specifies dots per inch. |
115 double dpi_; | 117 double dpi_; |
116 double max_shrink_; | 118 double max_shrink_; |
117 double min_shrink_; | 119 double min_shrink_; |
118 | 120 |
119 // Desired apparent dpi on paper. | 121 // Desired apparent dpi on paper. |
120 int desired_dpi_; | 122 int desired_dpi_; |
121 | 123 |
122 // Print selection. | 124 // Print selection. |
123 bool selection_only_; | 125 bool selection_only_; |
124 | 126 |
125 // Cookie for the document to ensure correctness. | 127 // Cookie for the document to ensure correctness. |
126 int document_cookie_; | 128 int document_cookie_; |
127 int current_document_cookie_; | 129 int current_document_cookie_; |
128 | 130 |
129 // The current status of this printer. | 131 // The current status of this printer. |
130 Status printer_status_; | 132 Status printer_status_; |
131 | 133 |
132 // The output of a printing job. | 134 // The output of a printing job. |
133 int number_pages_; | 135 int number_pages_; |
134 int page_number_; | 136 int page_number_; |
135 | 137 |
136 // Used only in the preview sequence. | 138 // Used only in the preview sequence. |
137 bool is_first_request_; | 139 bool is_first_request_; |
| 140 bool print_to_pdf_; |
138 int preview_request_id_; | 141 int preview_request_id_; |
139 | 142 |
140 // Used for displaying headers and footers. | 143 // Used for displaying headers and footers. |
141 bool display_header_footer_; | 144 bool display_header_footer_; |
142 string16 date_; | 145 string16 date_; |
143 string16 title_; | 146 string16 title_; |
144 string16 url_; | 147 string16 url_; |
145 | 148 |
146 // Used for generating invalid settings. | 149 // Used for generating invalid settings. |
147 bool use_invalid_settings_; | 150 bool use_invalid_settings_; |
148 | 151 |
149 std::vector<scoped_refptr<MockPrinterPage> > pages_; | 152 std::vector<scoped_refptr<MockPrinterPage> > pages_; |
150 | 153 |
151 DISALLOW_COPY_AND_ASSIGN(MockPrinter); | 154 DISALLOW_COPY_AND_ASSIGN(MockPrinter); |
152 }; | 155 }; |
153 | 156 |
154 #endif // CHROME_RENDERER_MOCK_PRINTER_H_ | 157 #endif // CHROME_RENDERER_MOCK_PRINTER_H_ |
OLD | NEW |