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 "content/renderer/pepper/pepper_plugin_instance_impl.h" | 5 #include "content/renderer/pepper/pepper_plugin_instance_impl.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/callback_helpers.h" | 8 #include "base/callback_helpers.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 #include "third_party/WebKit/public/platform/WebURLRequest.h" | 107 #include "third_party/WebKit/public/platform/WebURLRequest.h" |
108 #include "third_party/WebKit/public/web/WebBindings.h" | 108 #include "third_party/WebKit/public/web/WebBindings.h" |
109 #include "third_party/WebKit/public/web/WebCompositionUnderline.h" | 109 #include "third_party/WebKit/public/web/WebCompositionUnderline.h" |
110 #include "third_party/WebKit/public/web/WebDataSource.h" | 110 #include "third_party/WebKit/public/web/WebDataSource.h" |
111 #include "third_party/WebKit/public/web/WebDocument.h" | 111 #include "third_party/WebKit/public/web/WebDocument.h" |
112 #include "third_party/WebKit/public/web/WebElement.h" | 112 #include "third_party/WebKit/public/web/WebElement.h" |
113 #include "third_party/WebKit/public/web/WebInputEvent.h" | 113 #include "third_party/WebKit/public/web/WebInputEvent.h" |
114 #include "third_party/WebKit/public/web/WebLocalFrame.h" | 114 #include "third_party/WebKit/public/web/WebLocalFrame.h" |
115 #include "third_party/WebKit/public/web/WebPluginContainer.h" | 115 #include "third_party/WebKit/public/web/WebPluginContainer.h" |
116 #include "third_party/WebKit/public/web/WebPrintParams.h" | 116 #include "third_party/WebKit/public/web/WebPrintParams.h" |
| 117 #include "third_party/WebKit/public/web/WebPrintPresetOptions.h" |
117 #include "third_party/WebKit/public/web/WebPrintScalingOption.h" | 118 #include "third_party/WebKit/public/web/WebPrintScalingOption.h" |
118 #include "third_party/WebKit/public/web/WebScopedUserGesture.h" | 119 #include "third_party/WebKit/public/web/WebScopedUserGesture.h" |
119 #include "third_party/WebKit/public/web/WebScriptSource.h" | 120 #include "third_party/WebKit/public/web/WebScriptSource.h" |
120 #include "third_party/WebKit/public/web/WebSecurityOrigin.h" | 121 #include "third_party/WebKit/public/web/WebSecurityOrigin.h" |
121 #include "third_party/WebKit/public/web/WebUserGestureIndicator.h" | 122 #include "third_party/WebKit/public/web/WebUserGestureIndicator.h" |
122 #include "third_party/WebKit/public/web/WebView.h" | 123 #include "third_party/WebKit/public/web/WebView.h" |
123 #include "third_party/khronos/GLES2/gl2.h" | 124 #include "third_party/khronos/GLES2/gl2.h" |
124 #include "ui/gfx/image/image_skia.h" | 125 #include "ui/gfx/image/image_skia.h" |
125 #include "ui/gfx/image/image_skia_rep.h" | 126 #include "ui/gfx/image/image_skia_rep.h" |
126 #include "ui/gfx/range/range.h" | 127 #include "ui/gfx/range/range.h" |
(...skipping 1389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1516 plugin_mouse_lock_interface_ = static_cast<const PPP_MouseLock*>( | 1517 plugin_mouse_lock_interface_ = static_cast<const PPP_MouseLock*>( |
1517 module_->GetPluginInterface(PPP_MOUSELOCK_INTERFACE)); | 1518 module_->GetPluginInterface(PPP_MOUSELOCK_INTERFACE)); |
1518 } | 1519 } |
1519 | 1520 |
1520 return !!plugin_mouse_lock_interface_; | 1521 return !!plugin_mouse_lock_interface_; |
1521 } | 1522 } |
1522 | 1523 |
1523 bool PepperPluginInstanceImpl::LoadPdfInterface() { | 1524 bool PepperPluginInstanceImpl::LoadPdfInterface() { |
1524 if (!checked_for_plugin_pdf_interface_) { | 1525 if (!checked_for_plugin_pdf_interface_) { |
1525 checked_for_plugin_pdf_interface_ = true; | 1526 checked_for_plugin_pdf_interface_ = true; |
1526 plugin_pdf_interface_ = static_cast<const PPP_Pdf_1*>( | 1527 plugin_pdf_interface_ = static_cast<const PPP_Pdf*>( |
1527 module_->GetPluginInterface(PPP_PDF_INTERFACE_1)); | 1528 module_->GetPluginInterface(PPP_PDF_INTERFACE_1)); |
1528 } | 1529 } |
1529 | 1530 |
1530 return !!plugin_pdf_interface_; | 1531 return !!plugin_pdf_interface_; |
1531 } | 1532 } |
1532 | 1533 |
1533 bool PepperPluginInstanceImpl::LoadPrintInterface() { | 1534 bool PepperPluginInstanceImpl::LoadPrintInterface() { |
1534 // Only check for the interface if the plugin has dev permission. | 1535 // Only check for the interface if the plugin has dev permission. |
1535 if (!module_->permissions().HasPermission(ppapi::PERMISSION_DEV)) | 1536 if (!module_->permissions().HasPermission(ppapi::PERMISSION_DEV)) |
1536 return false; | 1537 return false; |
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1825 DCHECK(plugin_print_interface_); | 1826 DCHECK(plugin_print_interface_); |
1826 if (plugin_print_interface_) | 1827 if (plugin_print_interface_) |
1827 plugin_print_interface_->End(pp_instance()); | 1828 plugin_print_interface_->End(pp_instance()); |
1828 | 1829 |
1829 memset(¤t_print_settings_, 0, sizeof(current_print_settings_)); | 1830 memset(¤t_print_settings_, 0, sizeof(current_print_settings_)); |
1830 #if defined(OS_MACOSX) | 1831 #if defined(OS_MACOSX) |
1831 last_printed_page_ = NULL; | 1832 last_printed_page_ = NULL; |
1832 #endif // defined(OS_MACOSX) | 1833 #endif // defined(OS_MACOSX) |
1833 } | 1834 } |
1834 | 1835 |
| 1836 bool PepperPluginInstanceImpl::GetPrintPresetOptionsFromDocument( |
| 1837 blink::WebPrintPresetOptions* preset_options) { |
| 1838 // Keep a reference on the stack. See NOTE above. |
| 1839 scoped_refptr<PepperPluginInstanceImpl> ref(this); |
| 1840 if (!LoadPdfInterface()) |
| 1841 return false; |
| 1842 |
| 1843 PP_PdfPrintPresetOptions_Dev options; |
| 1844 if (!plugin_pdf_interface_->GetPrintPresetOptionsFromDocument(pp_instance(), |
| 1845 &options)) { |
| 1846 return false; |
| 1847 } |
| 1848 |
| 1849 preset_options->isScalingDisabled = options.is_scaling_disabled; |
| 1850 preset_options->copies = options.copies; |
| 1851 |
| 1852 return true; |
| 1853 } |
| 1854 |
1835 bool PepperPluginInstanceImpl::CanRotateView() { | 1855 bool PepperPluginInstanceImpl::CanRotateView() { |
1836 if (!LoadPdfInterface()) | 1856 if (!LoadPdfInterface()) |
1837 return false; | 1857 return false; |
1838 | 1858 |
1839 return true; | 1859 return true; |
1840 } | 1860 } |
1841 | 1861 |
1842 void PepperPluginInstanceImpl::RotateView(WebPlugin::RotationType type) { | 1862 void PepperPluginInstanceImpl::RotateView(WebPlugin::RotationType type) { |
1843 if (!LoadPdfInterface()) | 1863 if (!LoadPdfInterface()) |
1844 return; | 1864 return; |
(...skipping 1455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3300 void PepperPluginInstanceImpl::SetPluginThrottled(bool throttled) { | 3320 void PepperPluginInstanceImpl::SetPluginThrottled(bool throttled) { |
3301 // Do not throttle if we've already disabled power saver. | 3321 // Do not throttle if we've already disabled power saver. |
3302 if (!power_saver_enabled_ && throttled) | 3322 if (!power_saver_enabled_ && throttled) |
3303 return; | 3323 return; |
3304 | 3324 |
3305 plugin_throttled_ = throttled; | 3325 plugin_throttled_ = throttled; |
3306 SendDidChangeView(); | 3326 SendDidChangeView(); |
3307 } | 3327 } |
3308 | 3328 |
3309 } // namespace content | 3329 } // namespace content |
OLD | NEW |