Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Side by Side Diff: webkit/plugins/ppapi/ppapi_plugin_instance.cc

Issue 11312195: webkit/ppapi: Notify the container when a plugin is accepting wheel events just like r143871. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « webkit/plugins/ppapi/ppapi_plugin_instance.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 545 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 container_->setIsAcceptingTouchEvents(IsAcceptingTouchEvents());
566 container_->setWantsWheelEvents(IsAcceptingWheelEvents());
566 567
567 SetGPUHistogram(delegate_->GetPreferences(), arg_names, arg_values); 568 SetGPUHistogram(delegate_->GetPreferences(), arg_names, arg_values);
568 569
569 argn_ = arg_names; 570 argn_ = arg_names;
570 argv_ = arg_values; 571 argv_ = arg_values;
571 scoped_array<const char*> argn_array(StringVectorToArgArray(argn_)); 572 scoped_array<const char*> argn_array(StringVectorToArgArray(argn_));
572 scoped_array<const char*> argv_array(StringVectorToArgArray(argv_)); 573 scoped_array<const char*> argv_array(StringVectorToArgArray(argv_));
573 return PP_ToBool(instance_interface_->DidCreate(pp_instance(), 574 return PP_ToBool(instance_interface_->DidCreate(pp_instance(),
574 argn_.size(), 575 argn_.size(),
575 argn_array.get(), 576 argn_array.get(),
(...skipping 593 matching lines...) Expand 10 before | Expand all | Expand 10 after
1169 bool has_focus = PluginHasFocus(); 1170 bool has_focus = PluginHasFocus();
1170 delegate()->PluginFocusChanged(this, has_focus); 1171 delegate()->PluginFocusChanged(this, has_focus);
1171 instance_interface_->DidChangeFocus(pp_instance(), PP_FromBool(has_focus)); 1172 instance_interface_->DidChangeFocus(pp_instance(), PP_FromBool(has_focus));
1172 } 1173 }
1173 1174
1174 bool PluginInstance::IsAcceptingTouchEvents() const { 1175 bool PluginInstance::IsAcceptingTouchEvents() const {
1175 return (filtered_input_event_mask_ & PP_INPUTEVENT_CLASS_TOUCH) || 1176 return (filtered_input_event_mask_ & PP_INPUTEVENT_CLASS_TOUCH) ||
1176 (input_event_mask_ & PP_INPUTEVENT_CLASS_TOUCH); 1177 (input_event_mask_ & PP_INPUTEVENT_CLASS_TOUCH);
1177 } 1178 }
1178 1179
1180 bool PluginInstance::IsAcceptingWheelEvents() const {
1181 return (filtered_input_event_mask_ & PP_INPUTEVENT_CLASS_WHEEL) ||
1182 (input_event_mask_ & PP_INPUTEVENT_CLASS_WHEEL);
1183 }
1184
1179 void PluginInstance::ScheduleAsyncDidChangeView() { 1185 void PluginInstance::ScheduleAsyncDidChangeView() {
1180 if (view_change_weak_ptr_factory_.HasWeakPtrs()) 1186 if (view_change_weak_ptr_factory_.HasWeakPtrs())
1181 return; // Already scheduled. 1187 return; // Already scheduled.
1182 MessageLoop::current()->PostTask( 1188 MessageLoop::current()->PostTask(
1183 FROM_HERE, base::Bind(&PluginInstance::SendAsyncDidChangeView, 1189 FROM_HERE, base::Bind(&PluginInstance::SendAsyncDidChangeView,
1184 view_change_weak_ptr_factory_.GetWeakPtr())); 1190 view_change_weak_ptr_factory_.GetWeakPtr()));
1185 } 1191 }
1186 1192
1187 void PluginInstance::SendAsyncDidChangeView() { 1193 void PluginInstance::SendAsyncDidChangeView() {
1188 // The bound callback that owns the weak pointer is still valid until after 1194 // The bound callback that owns the weak pointer is still valid until after
(...skipping 944 matching lines...) Expand 10 before | Expand all | Expand 10 after
2133 PP_Instance /* instance */) { 2139 PP_Instance /* instance */) {
2134 return &gamepad_impl_; 2140 return &gamepad_impl_;
2135 } 2141 }
2136 2142
2137 int32_t PluginInstance::RequestInputEvents(PP_Instance instance, 2143 int32_t PluginInstance::RequestInputEvents(PP_Instance instance,
2138 uint32_t event_classes) { 2144 uint32_t event_classes) {
2139 input_event_mask_ |= event_classes; 2145 input_event_mask_ |= event_classes;
2140 filtered_input_event_mask_ &= ~(event_classes); 2146 filtered_input_event_mask_ &= ~(event_classes);
2141 if (event_classes & PP_INPUTEVENT_CLASS_TOUCH) 2147 if (event_classes & PP_INPUTEVENT_CLASS_TOUCH)
2142 container_->setIsAcceptingTouchEvents(IsAcceptingTouchEvents()); 2148 container_->setIsAcceptingTouchEvents(IsAcceptingTouchEvents());
2149 if (event_classes & PP_INPUTEVENT_CLASS_WHEEL)
2150 container_->setWantsWheelEvents(IsAcceptingWheelEvents());
jamesr 2012/11/26 06:23:07 this little 4-line block of checking for PP_INPUTE
Yusuke Sato 2012/11/26 23:22:18 Done.
2143 return ValidateRequestInputEvents(false, event_classes); 2151 return ValidateRequestInputEvents(false, event_classes);
2144 } 2152 }
2145 2153
2146 int32_t PluginInstance::RequestFilteringInputEvents(PP_Instance instance, 2154 int32_t PluginInstance::RequestFilteringInputEvents(PP_Instance instance,
2147 uint32_t event_classes) { 2155 uint32_t event_classes) {
2148 filtered_input_event_mask_ |= event_classes; 2156 filtered_input_event_mask_ |= event_classes;
2149 input_event_mask_ &= ~(event_classes); 2157 input_event_mask_ &= ~(event_classes);
2150 if (event_classes & PP_INPUTEVENT_CLASS_TOUCH) 2158 if (event_classes & PP_INPUTEVENT_CLASS_TOUCH)
2151 container_->setIsAcceptingTouchEvents(IsAcceptingTouchEvents()); 2159 container_->setIsAcceptingTouchEvents(IsAcceptingTouchEvents());
2160 if (event_classes & PP_INPUTEVENT_CLASS_WHEEL)
2161 container_->setWantsWheelEvents(IsAcceptingWheelEvents());
2152 return ValidateRequestInputEvents(true, event_classes); 2162 return ValidateRequestInputEvents(true, event_classes);
2153 } 2163 }
2154 2164
2155 void PluginInstance::ClearInputEventRequest(PP_Instance instance, 2165 void PluginInstance::ClearInputEventRequest(PP_Instance instance,
2156 uint32_t event_classes) { 2166 uint32_t event_classes) {
2157 input_event_mask_ &= ~(event_classes); 2167 input_event_mask_ &= ~(event_classes);
2158 filtered_input_event_mask_ &= ~(event_classes); 2168 filtered_input_event_mask_ &= ~(event_classes);
2159 if (event_classes & PP_INPUTEVENT_CLASS_TOUCH) 2169 if (event_classes & PP_INPUTEVENT_CLASS_TOUCH)
2160 container_->setIsAcceptingTouchEvents(IsAcceptingTouchEvents()); 2170 container_->setIsAcceptingTouchEvents(IsAcceptingTouchEvents());
2171 if (event_classes & PP_INPUTEVENT_CLASS_WHEEL)
2172 container_->setWantsWheelEvents(IsAcceptingWheelEvents());
2161 } 2173 }
2162 2174
2163 void PluginInstance::ZoomChanged(PP_Instance instance, double factor) { 2175 void PluginInstance::ZoomChanged(PP_Instance instance, double factor) {
2164 // We only want to tell the page to change its zoom if the whole page is the 2176 // We only want to tell the page to change its zoom if the whole page is the
2165 // plugin. If we're in an iframe, then don't do anything. 2177 // plugin. If we're in an iframe, then don't do anything.
2166 if (!IsFullPagePlugin()) 2178 if (!IsFullPagePlugin())
2167 return; 2179 return;
2168 container()->zoomLevelChanged(WebView::zoomFactorToZoomLevel(factor)); 2180 container()->zoomLevelChanged(WebView::zoomFactorToZoomLevel(factor));
2169 } 2181 }
2170 2182
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after
2470 screen_size_for_fullscreen_ = gfx::Size(); 2482 screen_size_for_fullscreen_ = gfx::Size();
2471 WebElement element = container_->element(); 2483 WebElement element = container_->element();
2472 element.setAttribute(WebString::fromUTF8(kWidth), width_before_fullscreen_); 2484 element.setAttribute(WebString::fromUTF8(kWidth), width_before_fullscreen_);
2473 element.setAttribute(WebString::fromUTF8(kHeight), height_before_fullscreen_); 2485 element.setAttribute(WebString::fromUTF8(kHeight), height_before_fullscreen_);
2474 element.setAttribute(WebString::fromUTF8(kBorder), border_before_fullscreen_); 2486 element.setAttribute(WebString::fromUTF8(kBorder), border_before_fullscreen_);
2475 element.setAttribute(WebString::fromUTF8(kStyle), style_before_fullscreen_); 2487 element.setAttribute(WebString::fromUTF8(kStyle), style_before_fullscreen_);
2476 } 2488 }
2477 2489
2478 } // namespace ppapi 2490 } // namespace ppapi
2479 } // namespace webkit 2491 } // namespace webkit
OLDNEW
« no previous file with comments | « webkit/plugins/ppapi/ppapi_plugin_instance.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698