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 #include "components/printing/renderer/print_web_view_helper.h" | 5 #include "components/printing/renderer/print_web_view_helper.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 #include <string> | 9 #include <string> |
10 #include <utility> | 10 #include <utility> |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 // on dpi. | 104 // on dpi. |
105 return kPointsPerInch; | 105 return kPointsPerInch; |
106 #else | 106 #else |
107 return static_cast<int>(print_params->dpi); | 107 return static_cast<int>(print_params->dpi); |
108 #endif // defined(OS_MACOSX) | 108 #endif // defined(OS_MACOSX) |
109 } | 109 } |
110 | 110 |
111 bool PrintMsg_Print_Params_IsValid(const PrintMsg_Print_Params& params) { | 111 bool PrintMsg_Print_Params_IsValid(const PrintMsg_Print_Params& params) { |
112 return !params.content_size.IsEmpty() && !params.page_size.IsEmpty() && | 112 return !params.content_size.IsEmpty() && !params.page_size.IsEmpty() && |
113 !params.printable_area.IsEmpty() && params.document_cookie && | 113 !params.printable_area.IsEmpty() && params.document_cookie && |
114 params.desired_dpi && params.dpi && params.margin_top >= 0 && | 114 params.desired_dpi && params.max_shrink && params.min_shrink && |
115 params.margin_left >= 0 && params.dpi > kMinDpi && | 115 params.dpi && (params.margin_top >= 0) && (params.margin_left >= 0) && |
116 params.document_cookie != 0; | 116 params.dpi > kMinDpi && params.document_cookie != 0; |
117 } | 117 } |
118 | 118 |
119 PrintMsg_Print_Params GetCssPrintParams( | 119 PrintMsg_Print_Params GetCssPrintParams( |
120 blink::WebFrame* frame, | 120 blink::WebFrame* frame, |
121 int page_index, | 121 int page_index, |
122 const PrintMsg_Print_Params& page_params) { | 122 const PrintMsg_Print_Params& page_params) { |
123 PrintMsg_Print_Params page_css_params = page_params; | 123 PrintMsg_Print_Params page_css_params = page_params; |
124 int dpi = GetDPI(&page_params); | 124 int dpi = GetDPI(&page_params); |
125 | 125 |
126 blink::WebSize page_size_in_pixels( | 126 blink::WebSize page_size_in_pixels( |
(...skipping 2121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2248 blink::WebConsoleMessage::LevelWarning, message)); | 2248 blink::WebConsoleMessage::LevelWarning, message)); |
2249 return false; | 2249 return false; |
2250 } | 2250 } |
2251 | 2251 |
2252 void PrintWebViewHelper::ScriptingThrottler::Reset() { | 2252 void PrintWebViewHelper::ScriptingThrottler::Reset() { |
2253 // Reset counter on successful print. | 2253 // Reset counter on successful print. |
2254 count_ = 0; | 2254 count_ = 0; |
2255 } | 2255 } |
2256 | 2256 |
2257 } // namespace printing | 2257 } // namespace printing |
OLD | NEW |