OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_PRINT_WEB_VIEW_HELPER_H_ | 5 #ifndef CHROME_RENDERER_PRINT_WEB_VIEW_HELPER_H_ |
6 #define CHROME_RENDERER_PRINT_WEB_VIEW_HELPER_H_ | 6 #define CHROME_RENDERER_PRINT_WEB_VIEW_HELPER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 const printing::PageSizeMargins& page_layout_in_points, | 153 const printing::PageSizeMargins& page_layout_in_points, |
154 gfx::Size* page_size, | 154 gfx::Size* page_size, |
155 gfx::Rect* content_area); | 155 gfx::Rect* content_area); |
156 | 156 |
157 // Update |ignore_css_margins_| based on settings. | 157 // Update |ignore_css_margins_| based on settings. |
158 void UpdateFrameMarginsCssInfo(const base::DictionaryValue& settings); | 158 void UpdateFrameMarginsCssInfo(const base::DictionaryValue& settings); |
159 | 159 |
160 // Returns true if the current destination printer is PRINT_TO_PDF. | 160 // Returns true if the current destination printer is PRINT_TO_PDF. |
161 bool IsPrintToPdfRequested(const base::DictionaryValue& settings); | 161 bool IsPrintToPdfRequested(const base::DictionaryValue& settings); |
162 | 162 |
| 163 // Returns false if |
| 164 // (1) The current destination printer is SAVE_AS_PDF or |
| 165 // (2) User is printing the preview data or |
| 166 // (3) Source is PDF. This is the first preview request and print scaling |
| 167 // option is disabled for initiator renderer plugin. |
| 168 // In all other cases returns true to fit the print contents in paper size. |
| 169 bool IsFitToPaperSizeRequested(const base::DictionaryValue& job_settings, |
| 170 const PrintMsg_Print_Params& params); |
| 171 |
| 172 // Returns true if the preview source is HTML, false otherwise. |
| 173 bool IsSourceHTML(const WebKit::WebFrame* frame, |
| 174 const WebKit::WebNode& node, |
| 175 const base::DictionaryValue& job_settings); |
| 176 |
163 // Initiate print preview. | 177 // Initiate print preview. |
164 void OnInitiatePrintPreview(); | 178 void OnInitiatePrintPreview(); |
165 | 179 |
166 // Start the process of generating a print preview using |settings|. | 180 // Start the process of generating a print preview using |settings|. |
167 void OnPrintPreview(const base::DictionaryValue& settings); | 181 void OnPrintPreview(const base::DictionaryValue& settings); |
168 | 182 |
169 // Initialize the print preview document. | 183 // Initialize the print preview document. |
170 bool CreatePreviewDocument(); | 184 bool CreatePreviewDocument(); |
171 | 185 |
172 // Renders a print preview page. |page_number| is 0-based. | 186 // Renders a print preview page. |page_number| is 0-based. |
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
467 enum PrintPreviewErrorBuckets error_; | 481 enum PrintPreviewErrorBuckets error_; |
468 | 482 |
469 State state_; | 483 State state_; |
470 }; | 484 }; |
471 | 485 |
472 PrintPreviewContext print_preview_context_; | 486 PrintPreviewContext print_preview_context_; |
473 DISALLOW_COPY_AND_ASSIGN(PrintWebViewHelper); | 487 DISALLOW_COPY_AND_ASSIGN(PrintWebViewHelper); |
474 }; | 488 }; |
475 | 489 |
476 #endif // CHROME_RENDERER_PRINT_WEB_VIEW_HELPER_H_ | 490 #endif // CHROME_RENDERER_PRINT_WEB_VIEW_HELPER_H_ |
OLD | NEW |