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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 #include "third_party/WebKit/public/platform/WebURLRequest.h" | 106 #include "third_party/WebKit/public/platform/WebURLRequest.h" |
107 #include "third_party/WebKit/public/web/WebBindings.h" | 107 #include "third_party/WebKit/public/web/WebBindings.h" |
108 #include "third_party/WebKit/public/web/WebCompositionUnderline.h" | 108 #include "third_party/WebKit/public/web/WebCompositionUnderline.h" |
109 #include "third_party/WebKit/public/web/WebDataSource.h" | 109 #include "third_party/WebKit/public/web/WebDataSource.h" |
110 #include "third_party/WebKit/public/web/WebDocument.h" | 110 #include "third_party/WebKit/public/web/WebDocument.h" |
111 #include "third_party/WebKit/public/web/WebElement.h" | 111 #include "third_party/WebKit/public/web/WebElement.h" |
112 #include "third_party/WebKit/public/web/WebInputEvent.h" | 112 #include "third_party/WebKit/public/web/WebInputEvent.h" |
113 #include "third_party/WebKit/public/web/WebLocalFrame.h" | 113 #include "third_party/WebKit/public/web/WebLocalFrame.h" |
114 #include "third_party/WebKit/public/web/WebPluginContainer.h" | 114 #include "third_party/WebKit/public/web/WebPluginContainer.h" |
115 #include "third_party/WebKit/public/web/WebPrintParams.h" | 115 #include "third_party/WebKit/public/web/WebPrintParams.h" |
| 116 #include "third_party/WebKit/public/web/WebPrintPresetOptions.h" |
116 #include "third_party/WebKit/public/web/WebPrintScalingOption.h" | 117 #include "third_party/WebKit/public/web/WebPrintScalingOption.h" |
117 #include "third_party/WebKit/public/web/WebScopedUserGesture.h" | 118 #include "third_party/WebKit/public/web/WebScopedUserGesture.h" |
118 #include "third_party/WebKit/public/web/WebScriptSource.h" | 119 #include "third_party/WebKit/public/web/WebScriptSource.h" |
119 #include "third_party/WebKit/public/web/WebSecurityOrigin.h" | 120 #include "third_party/WebKit/public/web/WebSecurityOrigin.h" |
120 #include "third_party/WebKit/public/web/WebUserGestureIndicator.h" | 121 #include "third_party/WebKit/public/web/WebUserGestureIndicator.h" |
121 #include "third_party/WebKit/public/web/WebView.h" | 122 #include "third_party/WebKit/public/web/WebView.h" |
122 #include "third_party/khronos/GLES2/gl2.h" | 123 #include "third_party/khronos/GLES2/gl2.h" |
123 #include "third_party/skia/include/core/SkCanvas.h" | 124 #include "third_party/skia/include/core/SkCanvas.h" |
124 #include "third_party/skia/include/core/SkRect.h" | 125 #include "third_party/skia/include/core/SkRect.h" |
125 #include "ui/gfx/image/image_skia.h" | 126 #include "ui/gfx/image/image_skia.h" |
(...skipping 1401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1527 plugin_mouse_lock_interface_ = static_cast<const PPP_MouseLock*>( | 1528 plugin_mouse_lock_interface_ = static_cast<const PPP_MouseLock*>( |
1528 module_->GetPluginInterface(PPP_MOUSELOCK_INTERFACE)); | 1529 module_->GetPluginInterface(PPP_MOUSELOCK_INTERFACE)); |
1529 } | 1530 } |
1530 | 1531 |
1531 return !!plugin_mouse_lock_interface_; | 1532 return !!plugin_mouse_lock_interface_; |
1532 } | 1533 } |
1533 | 1534 |
1534 bool PepperPluginInstanceImpl::LoadPdfInterface() { | 1535 bool PepperPluginInstanceImpl::LoadPdfInterface() { |
1535 if (!checked_for_plugin_pdf_interface_) { | 1536 if (!checked_for_plugin_pdf_interface_) { |
1536 checked_for_plugin_pdf_interface_ = true; | 1537 checked_for_plugin_pdf_interface_ = true; |
1537 plugin_pdf_interface_ = static_cast<const PPP_Pdf_1*>( | 1538 plugin_pdf_interface_ = static_cast<const PPP_Pdf*>( |
1538 module_->GetPluginInterface(PPP_PDF_INTERFACE_1)); | 1539 module_->GetPluginInterface(PPP_PDF_INTERFACE_1_1)); |
1539 } | 1540 } |
1540 | 1541 |
1541 return !!plugin_pdf_interface_; | 1542 return !!plugin_pdf_interface_; |
1542 } | 1543 } |
1543 | 1544 |
1544 bool PepperPluginInstanceImpl::LoadPrintInterface() { | 1545 bool PepperPluginInstanceImpl::LoadPrintInterface() { |
1545 // Only check for the interface if the plugin has dev permission. | 1546 // Only check for the interface if the plugin has dev permission. |
1546 if (!module_->permissions().HasPermission(ppapi::PERMISSION_DEV)) | 1547 if (!module_->permissions().HasPermission(ppapi::PERMISSION_DEV)) |
1547 return false; | 1548 return false; |
1548 if (!plugin_print_interface_) { | 1549 if (!plugin_print_interface_) { |
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1834 DCHECK(plugin_print_interface_); | 1835 DCHECK(plugin_print_interface_); |
1835 if (plugin_print_interface_) | 1836 if (plugin_print_interface_) |
1836 plugin_print_interface_->End(pp_instance()); | 1837 plugin_print_interface_->End(pp_instance()); |
1837 | 1838 |
1838 memset(¤t_print_settings_, 0, sizeof(current_print_settings_)); | 1839 memset(¤t_print_settings_, 0, sizeof(current_print_settings_)); |
1839 #if defined(OS_MACOSX) | 1840 #if defined(OS_MACOSX) |
1840 last_printed_page_ = NULL; | 1841 last_printed_page_ = NULL; |
1841 #endif // defined(OS_MACOSX) | 1842 #endif // defined(OS_MACOSX) |
1842 } | 1843 } |
1843 | 1844 |
| 1845 bool PepperPluginInstanceImpl::GetPrintPresetOptionsFromDocument( |
| 1846 blink::WebPrintPresetOptions* preset_options) { |
| 1847 // Keep a reference on the stack. See NOTE above. |
| 1848 scoped_refptr<PepperPluginInstanceImpl> ref(this); |
| 1849 if (!LoadPdfInterface()) |
| 1850 return false; |
| 1851 |
| 1852 PP_PrintPresetOptions_Dev options; |
| 1853 if (!plugin_pdf_interface_->GetPrintPresetOptionsFromDocument(pp_instance(), |
| 1854 &options)) { |
| 1855 return false; |
| 1856 } |
| 1857 |
| 1858 preset_options->isScalingDisabled = options.is_scaling_disabled; |
| 1859 preset_options->copies = options.copies; |
| 1860 |
| 1861 return true; |
| 1862 } |
| 1863 |
1844 bool PepperPluginInstanceImpl::CanRotateView() { | 1864 bool PepperPluginInstanceImpl::CanRotateView() { |
1845 if (!LoadPdfInterface()) | 1865 if (!LoadPdfInterface()) |
1846 return false; | 1866 return false; |
1847 | 1867 |
1848 return true; | 1868 return true; |
1849 } | 1869 } |
1850 | 1870 |
1851 void PepperPluginInstanceImpl::RotateView(WebPlugin::RotationType type) { | 1871 void PepperPluginInstanceImpl::RotateView(WebPlugin::RotationType type) { |
1852 if (!LoadPdfInterface()) | 1872 if (!LoadPdfInterface()) |
1853 return; | 1873 return; |
(...skipping 1523 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3377 // Running out-of-process. Initiate an IPC call to notify the plugin | 3397 // Running out-of-process. Initiate an IPC call to notify the plugin |
3378 // process. | 3398 // process. |
3379 ppapi::proxy::HostDispatcher* dispatcher = | 3399 ppapi::proxy::HostDispatcher* dispatcher = |
3380 ppapi::proxy::HostDispatcher::GetForInstance(pp_instance()); | 3400 ppapi::proxy::HostDispatcher::GetForInstance(pp_instance()); |
3381 dispatcher->Send(new PpapiMsg_PPPInstance_HandleDocumentLoad( | 3401 dispatcher->Send(new PpapiMsg_PPPInstance_HandleDocumentLoad( |
3382 ppapi::API_ID_PPP_INSTANCE, pp_instance(), pending_host_id, data)); | 3402 ppapi::API_ID_PPP_INSTANCE, pp_instance(), pending_host_id, data)); |
3383 } | 3403 } |
3384 } | 3404 } |
3385 | 3405 |
3386 } // namespace content | 3406 } // namespace content |
OLD | NEW |