Chromium Code Reviews| 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 "webkit/plugins/ppapi/ppapi_plugin_instance.h" | 5 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/debug/trace_event.h" | 8 #include "base/debug/trace_event.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/memory/linked_ptr.h" | 10 #include "base/memory/linked_ptr.h" |
| (...skipping 1117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1128 return GetPreferredPrintOutputFormat(&format); | 1128 return GetPreferredPrintOutputFormat(&format); |
| 1129 } | 1129 } |
| 1130 | 1130 |
| 1131 bool PluginInstance::IsPrintScalingDisabled() { | 1131 bool PluginInstance::IsPrintScalingDisabled() { |
| 1132 DCHECK(plugin_print_interface_); | 1132 DCHECK(plugin_print_interface_); |
| 1133 if (!plugin_print_interface_) | 1133 if (!plugin_print_interface_) |
| 1134 return false; | 1134 return false; |
| 1135 return plugin_print_interface_->IsScalingDisabled(pp_instance()) == PP_TRUE; | 1135 return plugin_print_interface_->IsScalingDisabled(pp_instance()) == PP_TRUE; |
| 1136 } | 1136 } |
| 1137 | 1137 |
| 1138 int PluginInstance::PrintBegin(const gfx::Rect& printable_area, | 1138 int PluginInstance::PrintBegin(const gfx::Rect& content_area, |
| 1139 const gfx::Rect& printable_area, | |
| 1140 const gfx::Size& paper_size, | |
| 1141 int print_scaling_option, | |
| 1139 int printer_dpi) { | 1142 int printer_dpi) { |
| 1140 // Keep a reference on the stack. See NOTE above. | 1143 // Keep a reference on the stack. See NOTE above. |
| 1141 scoped_refptr<PluginInstance> ref(this); | 1144 scoped_refptr<PluginInstance> ref(this); |
| 1142 PP_PrintOutputFormat_Dev format; | 1145 PP_PrintOutputFormat_Dev format; |
| 1143 if (!GetPreferredPrintOutputFormat(&format)) { | 1146 if (!GetPreferredPrintOutputFormat(&format)) { |
| 1144 // PrintBegin should not have been called since SupportsPrintInterface | 1147 // PrintBegin should not have been called since SupportsPrintInterface |
| 1145 // would have returned false; | 1148 // would have returned false; |
| 1146 NOTREACHED(); | 1149 NOTREACHED(); |
| 1147 return 0; | 1150 return 0; |
| 1148 } | 1151 } |
| 1149 | 1152 |
| 1150 int num_pages = 0; | 1153 int num_pages = 0; |
| 1151 PP_PrintSettings_Dev print_settings; | 1154 PP_PrintSettings_Dev print_settings; |
| 1152 print_settings.printable_area = PP_FromGfxRect(printable_area); | 1155 print_settings.printable_area = PP_FromGfxRect(printable_area); |
| 1156 print_settings.content_area = PP_FromGfxRect(content_area); | |
| 1157 print_settings.paper_size = PP_FromGfxSize(paper_size); | |
| 1153 print_settings.dpi = printer_dpi; | 1158 print_settings.dpi = printer_dpi; |
| 1154 print_settings.orientation = PP_PRINTORIENTATION_NORMAL; | 1159 print_settings.orientation = PP_PRINTORIENTATION_NORMAL; |
| 1155 print_settings.grayscale = PP_FALSE; | 1160 print_settings.grayscale = PP_FALSE; |
| 1161 print_settings.print_scaling_option = static_cast<PP_PrintScalingOption_Dev>( | |
| 1162 print_scaling_option); | |
|
dmichael (off chromium)
2012/04/20 23:01:45
Please explicitly convert the enum values or add s
kmadhusu
2012/04/23 16:39:30
Assuming, I will land this patch after committing
| |
| 1156 print_settings.format = format; | 1163 print_settings.format = format; |
| 1157 num_pages = plugin_print_interface_->Begin(pp_instance(), | 1164 num_pages = plugin_print_interface_->Begin(pp_instance(), |
| 1158 &print_settings); | 1165 &print_settings); |
| 1159 if (!num_pages) | 1166 if (!num_pages) |
| 1160 return 0; | 1167 return 0; |
| 1161 current_print_settings_ = print_settings; | 1168 current_print_settings_ = print_settings; |
| 1162 #if defined(USE_SKIA) | 1169 #if defined(USE_SKIA) |
| 1163 canvas_ = NULL; | 1170 canvas_ = NULL; |
| 1164 ranges_.clear(); | 1171 ranges_.clear(); |
| 1165 #endif // USE_SKIA | 1172 #endif // USE_SKIA |
| (...skipping 877 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2043 screen_size_for_fullscreen_ = gfx::Size(); | 2050 screen_size_for_fullscreen_ = gfx::Size(); |
| 2044 WebElement element = container_->element(); | 2051 WebElement element = container_->element(); |
| 2045 element.setAttribute(WebString::fromUTF8(kWidth), width_before_fullscreen_); | 2052 element.setAttribute(WebString::fromUTF8(kWidth), width_before_fullscreen_); |
| 2046 element.setAttribute(WebString::fromUTF8(kHeight), height_before_fullscreen_); | 2053 element.setAttribute(WebString::fromUTF8(kHeight), height_before_fullscreen_); |
| 2047 element.setAttribute(WebString::fromUTF8(kBorder), border_before_fullscreen_); | 2054 element.setAttribute(WebString::fromUTF8(kBorder), border_before_fullscreen_); |
| 2048 element.setAttribute(WebString::fromUTF8(kStyle), style_before_fullscreen_); | 2055 element.setAttribute(WebString::fromUTF8(kStyle), style_before_fullscreen_); |
| 2049 } | 2056 } |
| 2050 | 2057 |
| 2051 } // namespace ppapi | 2058 } // namespace ppapi |
| 2052 } // namespace webkit | 2059 } // namespace webkit |
| OLD | NEW |