| 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" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 #include "ppapi/c/pp_resource.h" | 27 #include "ppapi/c/pp_resource.h" |
| 28 #include "ppapi/c/pp_var.h" | 28 #include "ppapi/c/pp_var.h" |
| 29 #include "ppapi/c/ppb_core.h" | 29 #include "ppapi/c/ppb_core.h" |
| 30 #include "ppapi/c/ppb_instance.h" | 30 #include "ppapi/c/ppb_instance.h" |
| 31 #include "ppapi/c/ppp_input_event.h" | 31 #include "ppapi/c/ppp_input_event.h" |
| 32 #include "ppapi/c/ppp_instance.h" | 32 #include "ppapi/c/ppp_instance.h" |
| 33 #include "ppapi/c/ppp_messaging.h" | 33 #include "ppapi/c/ppp_messaging.h" |
| 34 #include "ppapi/c/ppp_mouse_lock.h" | 34 #include "ppapi/c/ppp_mouse_lock.h" |
| 35 #include "ppapi/c/private/ppb_instance_private.h" | 35 #include "ppapi/c/private/ppb_instance_private.h" |
| 36 #include "ppapi/c/private/ppp_instance_private.h" | 36 #include "ppapi/c/private/ppp_instance_private.h" |
| 37 #include "ppapi/shared_impl/ppb_input_event_shared.h" | 37 #include "ppapi/shared_impl/input_event_impl.h" |
| 38 #include "ppapi/shared_impl/ppb_url_util_shared.h" | |
| 39 #include "ppapi/shared_impl/resource.h" | 38 #include "ppapi/shared_impl/resource.h" |
| 40 #include "ppapi/shared_impl/time_conversion.h" | 39 #include "ppapi/shared_impl/time_conversion.h" |
| 40 #include "ppapi/shared_impl/url_util_impl.h" |
| 41 #include "ppapi/shared_impl/var.h" | 41 #include "ppapi/shared_impl/var.h" |
| 42 #include "ppapi/thunk/enter.h" | 42 #include "ppapi/thunk/enter.h" |
| 43 #include "ppapi/thunk/ppb_buffer_api.h" | 43 #include "ppapi/thunk/ppb_buffer_api.h" |
| 44 #include "printing/units.h" | 44 #include "printing/units.h" |
| 45 #include "skia/ext/platform_canvas.h" | 45 #include "skia/ext/platform_canvas.h" |
| 46 #include "third_party/WebKit/Source/WebKit/chromium/public/WebBindings.h" | 46 #include "third_party/WebKit/Source/WebKit/chromium/public/WebBindings.h" |
| 47 #include "third_party/WebKit/Source/WebKit/chromium/public/WebConsoleMessage.h" | 47 #include "third_party/WebKit/Source/WebKit/chromium/public/WebConsoleMessage.h" |
| 48 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCursorInfo.h" | 48 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCursorInfo.h" |
| 49 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" | 49 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" |
| 50 #include "third_party/WebKit/Source/WebKit/chromium/public/WebElement.h" | 50 #include "third_party/WebKit/Source/WebKit/chromium/public/WebElement.h" |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 #include "ui/gfx/codec/jpeg_codec.h" | 94 #include "ui/gfx/codec/jpeg_codec.h" |
| 95 #include "ui/gfx/gdi_util.h" | 95 #include "ui/gfx/gdi_util.h" |
| 96 #endif | 96 #endif |
| 97 | 97 |
| 98 #if defined(OS_MACOSX) && defined(USE_SKIA) | 98 #if defined(OS_MACOSX) && defined(USE_SKIA) |
| 99 #include "skia/ext/skia_utils_mac.h" | 99 #include "skia/ext/skia_utils_mac.h" |
| 100 #endif | 100 #endif |
| 101 | 101 |
| 102 using base::StringPrintf; | 102 using base::StringPrintf; |
| 103 using ppapi::InputEventData; | 103 using ppapi::InputEventData; |
| 104 using ppapi::PPB_InputEvent_Shared; | 104 using ppapi::InputEventImpl; |
| 105 using ppapi::PpapiGlobals; | 105 using ppapi::PpapiGlobals; |
| 106 using ppapi::StringVar; | 106 using ppapi::StringVar; |
| 107 using ppapi::thunk::EnterResourceNoLock; | 107 using ppapi::thunk::EnterResourceNoLock; |
| 108 using ppapi::thunk::PPB_Buffer_API; | 108 using ppapi::thunk::PPB_Buffer_API; |
| 109 using ppapi::thunk::PPB_Graphics2D_API; | 109 using ppapi::thunk::PPB_Graphics2D_API; |
| 110 using ppapi::thunk::PPB_Graphics3D_API; | 110 using ppapi::thunk::PPB_Graphics3D_API; |
| 111 using ppapi::thunk::PPB_ImageData_API; | 111 using ppapi::thunk::PPB_ImageData_API; |
| 112 using ppapi::thunk::PPB_Instance_FunctionAPI; | 112 using ppapi::thunk::PPB_Instance_FunctionAPI; |
| 113 using ppapi::Var; | 113 using ppapi::Var; |
| 114 using WebKit::WebBindings; | 114 using WebKit::WebBindings; |
| (...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 581 } | 581 } |
| 582 } | 582 } |
| 583 } | 583 } |
| 584 | 584 |
| 585 // Send the event. | 585 // Send the event. |
| 586 bool handled = false; | 586 bool handled = false; |
| 587 if (filtered_input_event_mask_ & event_class) | 587 if (filtered_input_event_mask_ & event_class) |
| 588 event.is_filtered = true; | 588 event.is_filtered = true; |
| 589 else | 589 else |
| 590 handled = true; // Unfiltered events are assumed to be handled. | 590 handled = true; // Unfiltered events are assumed to be handled. |
| 591 scoped_refptr<PPB_InputEvent_Shared> event_resource( | 591 scoped_refptr<InputEventImpl> event_resource( |
| 592 new PPB_InputEvent_Shared(PPB_InputEvent_Shared::InitAsImpl(), | 592 new InputEventImpl(InputEventImpl::InitAsImpl(), |
| 593 pp_instance(), event)); | 593 pp_instance(), event)); |
| 594 handled |= PP_ToBool(plugin_input_event_interface_->HandleInputEvent( | 594 handled |= PP_ToBool(plugin_input_event_interface_->HandleInputEvent( |
| 595 pp_instance(), event_resource->pp_resource())); | 595 pp_instance(), event_resource->pp_resource())); |
| 596 return handled; | 596 return handled; |
| 597 } | 597 } |
| 598 | 598 |
| 599 bool PluginInstance::HandleCompositionStart(const string16& text) { | 599 bool PluginInstance::HandleCompositionStart(const string16& text) { |
| 600 return SendCompositionEventToPlugin(PP_INPUTEVENT_TYPE_IME_COMPOSITION_START, | 600 return SendCompositionEventToPlugin(PP_INPUTEVENT_TYPE_IME_COMPOSITION_START, |
| 601 text); | 601 text); |
| 602 } | 602 } |
| 603 | 603 |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 680 // Actually send the event. | 680 // Actually send the event. |
| 681 std::vector< ::ppapi::InputEventData > events; | 681 std::vector< ::ppapi::InputEventData > events; |
| 682 CreateInputEventData(event, &events); | 682 CreateInputEventData(event, &events); |
| 683 | 683 |
| 684 // Each input event may generate more than one PP_InputEvent. | 684 // Each input event may generate more than one PP_InputEvent. |
| 685 for (size_t i = 0; i < events.size(); i++) { | 685 for (size_t i = 0; i < events.size(); i++) { |
| 686 if (filtered_input_event_mask_ & event_class) | 686 if (filtered_input_event_mask_ & event_class) |
| 687 events[i].is_filtered = true; | 687 events[i].is_filtered = true; |
| 688 else | 688 else |
| 689 rv = true; // Unfiltered events are assumed to be handled. | 689 rv = true; // Unfiltered events are assumed to be handled. |
| 690 scoped_refptr<PPB_InputEvent_Shared> event_resource( | 690 scoped_refptr<InputEventImpl> event_resource( |
| 691 new PPB_InputEvent_Shared(PPB_InputEvent_Shared::InitAsImpl(), | 691 new InputEventImpl(InputEventImpl::InitAsImpl(), |
| 692 pp_instance(), events[i])); | 692 pp_instance(), events[i])); |
| 693 | 693 |
| 694 rv |= PP_ToBool(plugin_input_event_interface_->HandleInputEvent( | 694 rv |= PP_ToBool(plugin_input_event_interface_->HandleInputEvent( |
| 695 pp_instance(), event_resource->pp_resource())); | 695 pp_instance(), event_resource->pp_resource())); |
| 696 } | 696 } |
| 697 } | 697 } |
| 698 } | 698 } |
| 699 | 699 |
| 700 if (cursor_.get()) | 700 if (cursor_.get()) |
| 701 *cursor_info = *cursor_; | 701 *cursor_info = *cursor_; |
| 702 return rv; | 702 return rv; |
| (...skipping 1185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1888 PP_Var PluginInstance::ResolveRelativeToDocument( | 1888 PP_Var PluginInstance::ResolveRelativeToDocument( |
| 1889 PP_Instance instance, | 1889 PP_Instance instance, |
| 1890 PP_Var relative, | 1890 PP_Var relative, |
| 1891 PP_URLComponents_Dev* components) { | 1891 PP_URLComponents_Dev* components) { |
| 1892 StringVar* relative_string = StringVar::FromPPVar(relative); | 1892 StringVar* relative_string = StringVar::FromPPVar(relative); |
| 1893 if (!relative_string) | 1893 if (!relative_string) |
| 1894 return PP_MakeNull(); | 1894 return PP_MakeNull(); |
| 1895 | 1895 |
| 1896 WebElement plugin_element = container()->element(); | 1896 WebElement plugin_element = container()->element(); |
| 1897 GURL document_url = plugin_element.document().baseURL(); | 1897 GURL document_url = plugin_element.document().baseURL(); |
| 1898 return ::ppapi::PPB_URLUtil_Shared::GenerateURLReturn( | 1898 return ::ppapi::URLUtilImpl::GenerateURLReturn( |
| 1899 module()->pp_module(), | 1899 module()->pp_module(), |
| 1900 document_url.Resolve(relative_string->value()), | 1900 document_url.Resolve(relative_string->value()), |
| 1901 components); | 1901 components); |
| 1902 } | 1902 } |
| 1903 | 1903 |
| 1904 PP_Bool PluginInstance::DocumentCanRequest(PP_Instance instance, PP_Var url) { | 1904 PP_Bool PluginInstance::DocumentCanRequest(PP_Instance instance, PP_Var url) { |
| 1905 StringVar* url_string = StringVar::FromPPVar(url); | 1905 StringVar* url_string = StringVar::FromPPVar(url); |
| 1906 if (!url_string) | 1906 if (!url_string) |
| 1907 return PP_FALSE; | 1907 return PP_FALSE; |
| 1908 | 1908 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 1926 WebKit::WebSecurityOrigin target_origin; | 1926 WebKit::WebSecurityOrigin target_origin; |
| 1927 if (!SecurityOriginForInstance(instance, &target_origin)) | 1927 if (!SecurityOriginForInstance(instance, &target_origin)) |
| 1928 return PP_FALSE; | 1928 return PP_FALSE; |
| 1929 | 1929 |
| 1930 return BoolToPPBool(our_origin.canAccess(target_origin)); | 1930 return BoolToPPBool(our_origin.canAccess(target_origin)); |
| 1931 } | 1931 } |
| 1932 | 1932 |
| 1933 PP_Var PluginInstance::GetDocumentURL(PP_Instance instance, | 1933 PP_Var PluginInstance::GetDocumentURL(PP_Instance instance, |
| 1934 PP_URLComponents_Dev* components) { | 1934 PP_URLComponents_Dev* components) { |
| 1935 WebKit::WebDocument document = container()->element().document(); | 1935 WebKit::WebDocument document = container()->element().document(); |
| 1936 return ::ppapi::PPB_URLUtil_Shared::GenerateURLReturn( | 1936 return ::ppapi::URLUtilImpl::GenerateURLReturn(module()->pp_module(), |
| 1937 module()->pp_module(), document.url(), components); | 1937 document.url(), components); |
| 1938 } | 1938 } |
| 1939 | 1939 |
| 1940 PP_Var PluginInstance::GetPluginInstanceURL( | 1940 PP_Var PluginInstance::GetPluginInstanceURL( |
| 1941 PP_Instance instance, | 1941 PP_Instance instance, |
| 1942 PP_URLComponents_Dev* components) { | 1942 PP_URLComponents_Dev* components) { |
| 1943 return ::ppapi::PPB_URLUtil_Shared::GenerateURLReturn(module()->pp_module(), | 1943 return ::ppapi::URLUtilImpl::GenerateURLReturn(module()->pp_module(), |
| 1944 plugin_url_, | 1944 plugin_url_, components); |
| 1945 components); | |
| 1946 } | 1945 } |
| 1947 | 1946 |
| 1948 void PluginInstance::DoSetCursor(WebCursorInfo* cursor) { | 1947 void PluginInstance::DoSetCursor(WebCursorInfo* cursor) { |
| 1949 cursor_.reset(cursor); | 1948 cursor_.reset(cursor); |
| 1950 if (fullscreen_container_) { | 1949 if (fullscreen_container_) { |
| 1951 fullscreen_container_->DidChangeCursor(*cursor); | 1950 fullscreen_container_->DidChangeCursor(*cursor); |
| 1952 } else { | 1951 } else { |
| 1953 delegate()->DidChangeCursor(this, *cursor); | 1952 delegate()->DidChangeCursor(this, *cursor); |
| 1954 } | 1953 } |
| 1955 } | 1954 } |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2015 screen_size_for_fullscreen_ = gfx::Size(); | 2014 screen_size_for_fullscreen_ = gfx::Size(); |
| 2016 WebElement element = container_->element(); | 2015 WebElement element = container_->element(); |
| 2017 element.setAttribute(WebString::fromUTF8(kWidth), width_before_fullscreen_); | 2016 element.setAttribute(WebString::fromUTF8(kWidth), width_before_fullscreen_); |
| 2018 element.setAttribute(WebString::fromUTF8(kHeight), height_before_fullscreen_); | 2017 element.setAttribute(WebString::fromUTF8(kHeight), height_before_fullscreen_); |
| 2019 element.setAttribute(WebString::fromUTF8(kBorder), border_before_fullscreen_); | 2018 element.setAttribute(WebString::fromUTF8(kBorder), border_before_fullscreen_); |
| 2020 element.setAttribute(WebString::fromUTF8(kStyle), style_before_fullscreen_); | 2019 element.setAttribute(WebString::fromUTF8(kStyle), style_before_fullscreen_); |
| 2021 } | 2020 } |
| 2022 | 2021 |
| 2023 } // namespace ppapi | 2022 } // namespace ppapi |
| 2024 } // namespace webkit | 2023 } // namespace webkit |
| OLD | NEW |