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_PRINTING_PRINT_WEB_VIEW_HELPER_H_ | 5 #ifndef CHROME_RENDERER_PRINTING_PRINT_WEB_VIEW_HELPER_H_ |
6 #define CHROME_RENDERER_PRINTING_PRINT_WEB_VIEW_HELPER_H_ | 6 #define CHROME_RENDERER_PRINTING_PRINT_WEB_VIEW_HELPER_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/gtest_prod_util.h" | 10 #include "base/gtest_prod_util.h" |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 const PageSizeMargins& page_layout_in_points, | 130 const PageSizeMargins& page_layout_in_points, |
131 gfx::Size* page_size, | 131 gfx::Size* page_size, |
132 gfx::Rect* content_area); | 132 gfx::Rect* content_area); |
133 | 133 |
134 // Update |ignore_css_margins_| based on settings. | 134 // Update |ignore_css_margins_| based on settings. |
135 void UpdateFrameMarginsCssInfo(const base::DictionaryValue& settings); | 135 void UpdateFrameMarginsCssInfo(const base::DictionaryValue& settings); |
136 | 136 |
137 // Returns true if the current destination printer is PRINT_TO_PDF. | 137 // Returns true if the current destination printer is PRINT_TO_PDF. |
138 bool IsPrintToPdfRequested(const base::DictionaryValue& settings); | 138 bool IsPrintToPdfRequested(const base::DictionaryValue& settings); |
139 | 139 |
140 // Returns the print scaling option to retain/scale/crop the source page size | |
141 // to fit the printable area of the paper. | |
142 // | |
143 // We retain the source page size when the current destination printer is | |
144 // SAVE_AS_PDF. | |
145 // | |
146 // We crop the source page size to fit the printable area or we print only the | |
147 // left top page contents when | |
148 // (1) Source is PDF and the user has requested not to fit to printable area | |
149 // via |job_settings|. | |
150 // (2) Source is PDF. This is the first preview request and print scaling | |
151 // option is disabled for initiator renderer plugin. | |
152 // | |
153 // In all other cases, we scale the source page to fit the printable area. | |
154 blink::WebPrintScalingOption GetPrintScalingOption( | |
155 bool source_is_html, | |
156 const base::DictionaryValue& job_settings, | |
157 const PrintMsg_Print_Params& params); | |
158 | |
159 // Initiate print preview. | 140 // Initiate print preview. |
160 void OnInitiatePrintPreview(bool selection_only); | 141 void OnInitiatePrintPreview(bool selection_only); |
161 | 142 |
162 // Start the process of generating a print preview using |settings|. | 143 // Start the process of generating a print preview using |settings|. |
163 void OnPrintPreview(const base::DictionaryValue& settings); | 144 void OnPrintPreview(const base::DictionaryValue& settings); |
164 | 145 |
165 // Prepare frame for creating preview document. | 146 // Prepare frame for creating preview document. |
166 void PrepareFrameForPreviewDocument(); | 147 void PrepareFrameForPreviewDocument(); |
167 | 148 |
168 // Continue creating preview document. | 149 // Continue creating preview document. |
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
480 PrintPreviewContext print_preview_context_; | 461 PrintPreviewContext print_preview_context_; |
481 bool is_loading_; | 462 bool is_loading_; |
482 bool is_scripted_preview_delayed_; | 463 bool is_scripted_preview_delayed_; |
483 base::WeakPtrFactory<PrintWebViewHelper> weak_ptr_factory_; | 464 base::WeakPtrFactory<PrintWebViewHelper> weak_ptr_factory_; |
484 DISALLOW_COPY_AND_ASSIGN(PrintWebViewHelper); | 465 DISALLOW_COPY_AND_ASSIGN(PrintWebViewHelper); |
485 }; | 466 }; |
486 | 467 |
487 } // namespace printing | 468 } // namespace printing |
488 | 469 |
489 #endif // CHROME_RENDERER_PRINTING_PRINT_WEB_VIEW_HELPER_H_ | 470 #endif // CHROME_RENDERER_PRINTING_PRINT_WEB_VIEW_HELPER_H_ |
OLD | NEW |