| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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" |
| 11 #include "base/memory/scoped_ptr.h" | |
| 12 #include "base/message_loop.h" | 11 #include "base/message_loop.h" |
| 13 #include "base/metrics/histogram.h" | |
| 14 #include "base/stringprintf.h" | 12 #include "base/stringprintf.h" |
| 15 #include "base/utf_offset_string_conversions.h" | 13 #include "base/utf_offset_string_conversions.h" |
| 16 #include "base/utf_string_conversions.h" | 14 #include "base/utf_string_conversions.h" |
| 17 #include "ppapi/c/dev/ppb_console_dev.h" | 15 #include "ppapi/c/dev/ppb_console_dev.h" |
| 18 #include "ppapi/c/dev/ppb_find_dev.h" | 16 #include "ppapi/c/dev/ppb_find_dev.h" |
| 19 #include "ppapi/c/dev/ppb_memory_dev.h" | |
| 20 #include "ppapi/c/dev/ppb_zoom_dev.h" | 17 #include "ppapi/c/dev/ppb_zoom_dev.h" |
| 21 #include "ppapi/c/dev/ppp_find_dev.h" | 18 #include "ppapi/c/dev/ppp_find_dev.h" |
| 22 #include "ppapi/c/dev/ppp_selection_dev.h" | 19 #include "ppapi/c/dev/ppp_selection_dev.h" |
| 23 #include "ppapi/c/dev/ppp_zoom_dev.h" | 20 #include "ppapi/c/dev/ppp_zoom_dev.h" |
| 24 #include "ppapi/c/pp_input_event.h" | |
| 25 #include "ppapi/c/pp_instance.h" | |
| 26 #include "ppapi/c/pp_rect.h" | 21 #include "ppapi/c/pp_rect.h" |
| 27 #include "ppapi/c/pp_resource.h" | |
| 28 #include "ppapi/c/pp_var.h" | |
| 29 #include "ppapi/c/ppb_core.h" | 22 #include "ppapi/c/ppb_core.h" |
| 30 #include "ppapi/c/ppb_instance.h" | |
| 31 #include "ppapi/c/ppp_input_event.h" | 23 #include "ppapi/c/ppp_input_event.h" |
| 32 #include "ppapi/c/ppp_instance.h" | 24 #include "ppapi/c/ppp_instance.h" |
| 33 #include "ppapi/c/ppp_messaging.h" | 25 #include "ppapi/c/ppp_messaging.h" |
| 34 #include "ppapi/c/ppp_mouse_lock.h" | 26 #include "ppapi/c/ppp_mouse_lock.h" |
| 35 #include "ppapi/c/private/ppb_instance_private.h" | |
| 36 #include "ppapi/c/private/ppp_instance_private.h" | 27 #include "ppapi/c/private/ppp_instance_private.h" |
| 37 #include "ppapi/shared_impl/ppb_input_event_shared.h" | 28 #include "ppapi/shared_impl/ppb_input_event_shared.h" |
| 38 #include "ppapi/shared_impl/ppb_url_util_shared.h" | 29 #include "ppapi/shared_impl/ppb_url_util_shared.h" |
| 39 #include "ppapi/shared_impl/resource.h" | 30 #include "ppapi/shared_impl/ppp_instance_combined.h" |
| 40 #include "ppapi/shared_impl/time_conversion.h" | 31 #include "ppapi/shared_impl/time_conversion.h" |
| 41 #include "ppapi/shared_impl/var.h" | 32 #include "ppapi/shared_impl/var.h" |
| 42 #include "ppapi/thunk/enter.h" | 33 #include "ppapi/thunk/enter.h" |
| 43 #include "ppapi/thunk/ppb_buffer_api.h" | 34 #include "ppapi/thunk/ppb_buffer_api.h" |
| 44 #include "printing/units.h" | 35 #include "printing/units.h" |
| 45 #include "skia/ext/platform_canvas.h" | 36 #include "third_party/skia/include/core/SkCanvas.h" |
| 37 #include "third_party/skia/include/core/SkRect.h" |
| 46 #include "third_party/WebKit/Source/WebKit/chromium/public/WebBindings.h" | 38 #include "third_party/WebKit/Source/WebKit/chromium/public/WebBindings.h" |
| 39 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCompositionUnderli
ne.h" |
| 47 #include "third_party/WebKit/Source/WebKit/chromium/public/WebConsoleMessage.h" | 40 #include "third_party/WebKit/Source/WebKit/chromium/public/WebConsoleMessage.h" |
| 48 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCursorInfo.h" | 41 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCursorInfo.h" |
| 49 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" | 42 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" |
| 50 #include "third_party/WebKit/Source/WebKit/chromium/public/WebElement.h" | 43 #include "third_party/WebKit/Source/WebKit/chromium/public/WebElement.h" |
| 51 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" | 44 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" |
| 52 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" | 45 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" |
| 53 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPluginContainer.h" | 46 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPluginContainer.h" |
| 54 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebRect.h" | |
| 55 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSecurityOrigin.h" | 47 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSecurityOrigin.h" |
| 56 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" | 48 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" |
| 57 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURL.h" | 49 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURL.h" |
| 58 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURLReques
t.h" | 50 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURLReques
t.h" |
| 59 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" | 51 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" |
| 60 #include "ui/gfx/rect.h" | |
| 61 #include "ui/gfx/skia_util.h" | |
| 62 #include "webkit/plugins/ppapi/common.h" | 52 #include "webkit/plugins/ppapi/common.h" |
| 63 #include "webkit/plugins/ppapi/event_conversion.h" | 53 #include "webkit/plugins/ppapi/event_conversion.h" |
| 64 #include "webkit/plugins/ppapi/fullscreen_container.h" | 54 #include "webkit/plugins/ppapi/fullscreen_container.h" |
| 65 #include "webkit/plugins/ppapi/host_globals.h" | 55 #include "webkit/plugins/ppapi/host_globals.h" |
| 66 #include "webkit/plugins/ppapi/message_channel.h" | 56 #include "webkit/plugins/ppapi/message_channel.h" |
| 67 #include "webkit/plugins/ppapi/npapi_glue.h" | 57 #include "webkit/plugins/ppapi/npapi_glue.h" |
| 68 #include "webkit/plugins/ppapi/plugin_delegate.h" | |
| 69 #include "webkit/plugins/ppapi/plugin_module.h" | 58 #include "webkit/plugins/ppapi/plugin_module.h" |
| 70 #include "webkit/plugins/ppapi/plugin_object.h" | 59 #include "webkit/plugins/ppapi/plugin_object.h" |
| 71 #include "webkit/plugins/ppapi/ppb_buffer_impl.h" | 60 #include "webkit/plugins/ppapi/ppb_buffer_impl.h" |
| 72 #include "webkit/plugins/ppapi/ppb_graphics_2d_impl.h" | 61 #include "webkit/plugins/ppapi/ppb_graphics_2d_impl.h" |
| 73 #include "webkit/plugins/ppapi/ppb_graphics_3d_impl.h" | 62 #include "webkit/plugins/ppapi/ppb_graphics_3d_impl.h" |
| 74 #include "webkit/plugins/ppapi/ppb_image_data_impl.h" | 63 #include "webkit/plugins/ppapi/ppb_image_data_impl.h" |
| 75 #include "webkit/plugins/ppapi/ppb_url_loader_impl.h" | 64 #include "webkit/plugins/ppapi/ppb_url_loader_impl.h" |
| 76 #include "webkit/plugins/ppapi/ppb_url_request_info_impl.h" | 65 #include "webkit/plugins/ppapi/ppb_url_request_info_impl.h" |
| 77 #include "webkit/plugins/ppapi/ppp_pdf.h" | 66 #include "webkit/plugins/ppapi/ppp_pdf.h" |
| 78 #include "webkit/plugins/ppapi/string.h" | |
| 79 #include "webkit/plugins/sad_plugin.h" | 67 #include "webkit/plugins/sad_plugin.h" |
| 80 | 68 |
| 81 #if defined(OS_MACOSX) | 69 #if defined(OS_MACOSX) |
| 70 #include "printing/metafile_impl.h" |
| 71 #if !defined(USE_SKIA) |
| 82 #include "base/mac/mac_util.h" | 72 #include "base/mac/mac_util.h" |
| 83 #include "base/mac/scoped_cftyperef.h" | 73 #include "base/mac/scoped_cftyperef.h" |
| 84 #include "printing/metafile_impl.h" | 74 #endif // !defined(USE_SKIA) |
| 85 #endif | 75 #endif // defined(OS_MACOSX) |
| 86 | 76 |
| 87 #if defined(USE_SKIA) | 77 #if defined(USE_SKIA) |
| 88 #include "printing/metafile.h" | 78 #include "printing/metafile.h" |
| 89 #include "printing/metafile_skia_wrapper.h" | 79 #include "printing/metafile_skia_wrapper.h" |
| 80 #include "skia/ext/platform_device.h" |
| 90 #endif | 81 #endif |
| 91 | 82 |
| 92 #if defined(OS_WIN) | 83 #if defined(OS_WIN) |
| 93 #include "skia/ext/vector_platform_device_emf_win.h" | 84 #include "base/metrics/histogram.h" |
| 85 #include "skia/ext/platform_canvas.h" |
| 94 #include "ui/gfx/codec/jpeg_codec.h" | 86 #include "ui/gfx/codec/jpeg_codec.h" |
| 95 #include "ui/gfx/gdi_util.h" | 87 #include "ui/gfx/gdi_util.h" |
| 96 #endif | 88 #endif |
| 97 | 89 |
| 98 #if defined(OS_MACOSX) && defined(USE_SKIA) | |
| 99 #include "skia/ext/skia_utils_mac.h" | |
| 100 #endif | |
| 101 | |
| 102 using base::StringPrintf; | 90 using base::StringPrintf; |
| 103 using ppapi::InputEventData; | 91 using ppapi::InputEventData; |
| 104 using ppapi::PPB_InputEvent_Shared; | 92 using ppapi::PPB_InputEvent_Shared; |
| 105 using ppapi::PpapiGlobals; | 93 using ppapi::PpapiGlobals; |
| 106 using ppapi::StringVar; | 94 using ppapi::StringVar; |
| 107 using ppapi::thunk::EnterResourceNoLock; | 95 using ppapi::thunk::EnterResourceNoLock; |
| 108 using ppapi::thunk::PPB_Buffer_API; | 96 using ppapi::thunk::PPB_Buffer_API; |
| 109 using ppapi::thunk::PPB_Graphics2D_API; | 97 using ppapi::thunk::PPB_Graphics2D_API; |
| 110 using ppapi::thunk::PPB_Graphics3D_API; | 98 using ppapi::thunk::PPB_Graphics3D_API; |
| 111 using ppapi::thunk::PPB_ImageData_API; | 99 using ppapi::thunk::PPB_ImageData_API; |
| 112 using ppapi::thunk::PPB_Instance_FunctionAPI; | 100 using ppapi::thunk::PPB_Instance_FunctionAPI; |
| 113 using ppapi::Var; | 101 using ppapi::Var; |
| 114 using WebKit::WebBindings; | 102 using WebKit::WebBindings; |
| 115 using WebKit::WebCanvas; | 103 using WebKit::WebCanvas; |
| 116 using WebKit::WebConsoleMessage; | 104 using WebKit::WebConsoleMessage; |
| 117 using WebKit::WebCursorInfo; | 105 using WebKit::WebCursorInfo; |
| 118 using WebKit::WebDocument; | 106 using WebKit::WebDocument; |
| 107 using WebKit::WebElement; |
| 119 using WebKit::WebFrame; | 108 using WebKit::WebFrame; |
| 120 using WebKit::WebElement; | |
| 121 using WebKit::WebInputEvent; | 109 using WebKit::WebInputEvent; |
| 122 using WebKit::WebPluginContainer; | 110 using WebKit::WebPluginContainer; |
| 123 using WebKit::WebString; | 111 using WebKit::WebString; |
| 124 using WebKit::WebURLRequest; | 112 using WebKit::WebURLRequest; |
| 125 using WebKit::WebView; | 113 using WebKit::WebView; |
| 126 | 114 |
| 127 namespace webkit { | 115 namespace webkit { |
| 128 namespace ppapi { | 116 namespace ppapi { |
| 129 | 117 |
| 130 #if defined(OS_WIN) | 118 #if defined(OS_WIN) |
| (...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 580 break; | 568 break; |
| 581 } | 569 } |
| 582 } | 570 } |
| 583 } | 571 } |
| 584 | 572 |
| 585 // Send the event. | 573 // Send the event. |
| 586 bool handled = false; | 574 bool handled = false; |
| 587 if (filtered_input_event_mask_ & event_class) | 575 if (filtered_input_event_mask_ & event_class) |
| 588 event.is_filtered = true; | 576 event.is_filtered = true; |
| 589 else | 577 else |
| 590 handled = true; // Unfiltered events are assumed to be handled. | 578 handled = true; // Unfiltered events are assumed to be handled. |
| 591 scoped_refptr<PPB_InputEvent_Shared> event_resource( | 579 scoped_refptr<PPB_InputEvent_Shared> event_resource( |
| 592 new PPB_InputEvent_Shared(PPB_InputEvent_Shared::InitAsImpl(), | 580 new PPB_InputEvent_Shared(PPB_InputEvent_Shared::InitAsImpl(), |
| 593 pp_instance(), event)); | 581 pp_instance(), event)); |
| 594 handled |= PP_ToBool(plugin_input_event_interface_->HandleInputEvent( | 582 handled |= PP_ToBool(plugin_input_event_interface_->HandleInputEvent( |
| 595 pp_instance(), event_resource->pp_resource())); | 583 pp_instance(), event_resource->pp_resource())); |
| 596 return handled; | 584 return handled; |
| 597 } | 585 } |
| 598 | 586 |
| 599 bool PluginInstance::HandleCompositionStart(const string16& text) { | 587 bool PluginInstance::HandleCompositionStart(const string16& text) { |
| 600 return SendCompositionEventToPlugin(PP_INPUTEVENT_TYPE_IME_COMPOSITION_START, | 588 return SendCompositionEventToPlugin(PP_INPUTEVENT_TYPE_IME_COMPOSITION_START, |
| (...skipping 1412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2013 screen_size_for_fullscreen_ = gfx::Size(); | 2001 screen_size_for_fullscreen_ = gfx::Size(); |
| 2014 WebElement element = container_->element(); | 2002 WebElement element = container_->element(); |
| 2015 element.setAttribute(WebString::fromUTF8(kWidth), width_before_fullscreen_); | 2003 element.setAttribute(WebString::fromUTF8(kWidth), width_before_fullscreen_); |
| 2016 element.setAttribute(WebString::fromUTF8(kHeight), height_before_fullscreen_); | 2004 element.setAttribute(WebString::fromUTF8(kHeight), height_before_fullscreen_); |
| 2017 element.setAttribute(WebString::fromUTF8(kBorder), border_before_fullscreen_); | 2005 element.setAttribute(WebString::fromUTF8(kBorder), border_before_fullscreen_); |
| 2018 element.setAttribute(WebString::fromUTF8(kStyle), style_before_fullscreen_); | 2006 element.setAttribute(WebString::fromUTF8(kStyle), style_before_fullscreen_); |
| 2019 } | 2007 } |
| 2020 | 2008 |
| 2021 } // namespace ppapi | 2009 } // namespace ppapi |
| 2022 } // namespace webkit | 2010 } // namespace webkit |
| OLD | NEW |