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/callback_helpers.h" | 8 #include "base/callback_helpers.h" |
9 #include "base/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 544 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
555 | 555 |
556 bool PluginInstance::Initialize(WebPluginContainer* container, | 556 bool PluginInstance::Initialize(WebPluginContainer* container, |
557 const std::vector<std::string>& arg_names, | 557 const std::vector<std::string>& arg_names, |
558 const std::vector<std::string>& arg_values, | 558 const std::vector<std::string>& arg_values, |
559 const GURL& plugin_url, | 559 const GURL& plugin_url, |
560 bool full_frame) { | 560 bool full_frame) { |
561 container_ = container; | 561 container_ = container; |
562 plugin_url_ = plugin_url; | 562 plugin_url_ = plugin_url; |
563 full_frame_ = full_frame; | 563 full_frame_ = full_frame; |
564 | 564 |
565 container_->setIsAcceptingTouchEvents(IsAcceptingTouchEvents()); | 565 UpdateTouchEventRequest(); |
566 container_->setWantsWheelEvents(IsAcceptingWheelEvents()); | 566 container_->setWantsWheelEvents(IsAcceptingWheelEvents()); |
567 | 567 |
568 SetGPUHistogram(delegate_->GetPreferences(), arg_names, arg_values); | 568 SetGPUHistogram(delegate_->GetPreferences(), arg_names, arg_values); |
569 | 569 |
570 argn_ = arg_names; | 570 argn_ = arg_names; |
571 argv_ = arg_values; | 571 argv_ = arg_values; |
572 scoped_array<const char*> argn_array(StringVectorToArgArray(argn_)); | 572 scoped_array<const char*> argn_array(StringVectorToArgArray(argn_)); |
573 scoped_array<const char*> argv_array(StringVectorToArgArray(argv_)); | 573 scoped_array<const char*> argv_array(StringVectorToArgArray(argv_)); |
574 return PP_ToBool(instance_interface_->DidCreate(pp_instance(), | 574 return PP_ToBool(instance_interface_->DidCreate(pp_instance(), |
575 argn_.size(), | 575 argn_.size(), |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
665 handled = true; // Unfiltered events are assumed to be handled. | 665 handled = true; // Unfiltered events are assumed to be handled. |
666 scoped_refptr<PPB_InputEvent_Shared> event_resource( | 666 scoped_refptr<PPB_InputEvent_Shared> event_resource( |
667 new PPB_InputEvent_Shared(::ppapi::OBJECT_IS_IMPL, pp_instance(), event)); | 667 new PPB_InputEvent_Shared(::ppapi::OBJECT_IS_IMPL, pp_instance(), event)); |
668 handled |= PP_ToBool(plugin_input_event_interface_->HandleInputEvent( | 668 handled |= PP_ToBool(plugin_input_event_interface_->HandleInputEvent( |
669 pp_instance(), event_resource->pp_resource())); | 669 pp_instance(), event_resource->pp_resource())); |
670 return handled; | 670 return handled; |
671 } | 671 } |
672 | 672 |
673 void PluginInstance::RequestInputEventsHelper(uint32_t event_classes) { | 673 void PluginInstance::RequestInputEventsHelper(uint32_t event_classes) { |
674 if (event_classes & PP_INPUTEVENT_CLASS_TOUCH) | 674 if (event_classes & PP_INPUTEVENT_CLASS_TOUCH) |
675 container_->setIsAcceptingTouchEvents(IsAcceptingTouchEvents()); | 675 UpdateTouchEventRequest(); |
676 if (event_classes & PP_INPUTEVENT_CLASS_WHEEL) | 676 if (event_classes & PP_INPUTEVENT_CLASS_WHEEL) |
677 container_->setWantsWheelEvents(IsAcceptingWheelEvents()); | 677 container_->setWantsWheelEvents(IsAcceptingWheelEvents()); |
678 } | 678 } |
679 | 679 |
680 bool PluginInstance::HandleCompositionStart(const string16& text) { | 680 bool PluginInstance::HandleCompositionStart(const string16& text) { |
681 return SendCompositionEventToPlugin(PP_INPUTEVENT_TYPE_IME_COMPOSITION_START, | 681 return SendCompositionEventToPlugin(PP_INPUTEVENT_TYPE_IME_COMPOSITION_START, |
682 text); | 682 text); |
683 } | 683 } |
684 | 684 |
685 bool PluginInstance::HandleCompositionUpdate( | 685 bool PluginInstance::HandleCompositionUpdate( |
(...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1166 bool PluginInstance::PluginHasFocus() const { | 1166 bool PluginInstance::PluginHasFocus() const { |
1167 return flash_fullscreen_ || (has_webkit_focus_ && has_content_area_focus_); | 1167 return flash_fullscreen_ || (has_webkit_focus_ && has_content_area_focus_); |
1168 } | 1168 } |
1169 | 1169 |
1170 void PluginInstance::SendFocusChangeNotification() { | 1170 void PluginInstance::SendFocusChangeNotification() { |
1171 bool has_focus = PluginHasFocus(); | 1171 bool has_focus = PluginHasFocus(); |
1172 delegate()->PluginFocusChanged(this, has_focus); | 1172 delegate()->PluginFocusChanged(this, has_focus); |
1173 instance_interface_->DidChangeFocus(pp_instance(), PP_FromBool(has_focus)); | 1173 instance_interface_->DidChangeFocus(pp_instance(), PP_FromBool(has_focus)); |
1174 } | 1174 } |
1175 | 1175 |
1176 bool PluginInstance::IsAcceptingTouchEvents() const { | 1176 void PluginInstance::UpdateTouchEventRequest() { |
1177 return (filtered_input_event_mask_ & PP_INPUTEVENT_CLASS_TOUCH) || | 1177 bool raw_touch = (filtered_input_event_mask_ & PP_INPUTEVENT_CLASS_TOUCH) || |
1178 (input_event_mask_ & PP_INPUTEVENT_CLASS_TOUCH); | 1178 (input_event_mask_ & PP_INPUTEVENT_CLASS_TOUCH); |
| 1179 container_->requestTouchEventType(raw_touch ? |
| 1180 WebKit::WebPluginContainer::TouchEventRequestTypeRaw : |
| 1181 WebKit::WebPluginContainer::TouchEventRequestTypeSynthesizedMouse); |
1179 } | 1182 } |
1180 | 1183 |
1181 bool PluginInstance::IsAcceptingWheelEvents() const { | 1184 bool PluginInstance::IsAcceptingWheelEvents() const { |
1182 return (filtered_input_event_mask_ & PP_INPUTEVENT_CLASS_WHEEL) || | 1185 return (filtered_input_event_mask_ & PP_INPUTEVENT_CLASS_WHEEL) || |
1183 (input_event_mask_ & PP_INPUTEVENT_CLASS_WHEEL); | 1186 (input_event_mask_ & PP_INPUTEVENT_CLASS_WHEEL); |
1184 } | 1187 } |
1185 | 1188 |
1186 void PluginInstance::ScheduleAsyncDidChangeView() { | 1189 void PluginInstance::ScheduleAsyncDidChangeView() { |
1187 if (view_change_weak_ptr_factory_.HasWeakPtrs()) | 1190 if (view_change_weak_ptr_factory_.HasWeakPtrs()) |
1188 return; // Already scheduled. | 1191 return; // Already scheduled. |
(...skipping 1285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2474 screen_size_for_fullscreen_ = gfx::Size(); | 2477 screen_size_for_fullscreen_ = gfx::Size(); |
2475 WebElement element = container_->element(); | 2478 WebElement element = container_->element(); |
2476 element.setAttribute(WebString::fromUTF8(kWidth), width_before_fullscreen_); | 2479 element.setAttribute(WebString::fromUTF8(kWidth), width_before_fullscreen_); |
2477 element.setAttribute(WebString::fromUTF8(kHeight), height_before_fullscreen_); | 2480 element.setAttribute(WebString::fromUTF8(kHeight), height_before_fullscreen_); |
2478 element.setAttribute(WebString::fromUTF8(kBorder), border_before_fullscreen_); | 2481 element.setAttribute(WebString::fromUTF8(kBorder), border_before_fullscreen_); |
2479 element.setAttribute(WebString::fromUTF8(kStyle), style_before_fullscreen_); | 2482 element.setAttribute(WebString::fromUTF8(kStyle), style_before_fullscreen_); |
2480 } | 2483 } |
2481 | 2484 |
2482 } // namespace ppapi | 2485 } // namespace ppapi |
2483 } // namespace webkit | 2486 } // namespace webkit |
OLD | NEW |