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

Side by Side Diff: components/plugins/renderer/webview_plugin.cc

Issue 2479123003: WIP Add getCoalescedEvents API using vector of WebInputEvents (Closed)
Patch Set: Created 4 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "components/plugins/renderer/webview_plugin.h" 5 #include "components/plugins/renderer/webview_plugin.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/auto_reset.h" 9 #include "base/auto_reset.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 base::Bind(&WebViewPlugin::UpdatePluginForNewGeometry, 182 base::Bind(&WebViewPlugin::UpdatePluginForNewGeometry,
183 weak_factory_.GetWeakPtr(), window_rect, unobscured_rect)); 183 weak_factory_.GetWeakPtr(), window_rect, unobscured_rect));
184 } 184 }
185 185
186 void WebViewPlugin::updateFocus(bool focused, blink::WebFocusType focus_type) { 186 void WebViewPlugin::updateFocus(bool focused, blink::WebFocusType focus_type) {
187 focused_ = focused; 187 focused_ = focused;
188 } 188 }
189 189
190 blink::WebInputEventResult WebViewPlugin::handleInputEvent( 190 blink::WebInputEventResult WebViewPlugin::handleInputEvent(
191 const WebInputEvent& event, 191 const WebInputEvent& event,
192 const std::vector<const WebInputEvent*>& coalescedEvents,
192 WebCursorInfo& cursor) { 193 WebCursorInfo& cursor) {
193 // For tap events, don't handle them. They will be converted to 194 // For tap events, don't handle them. They will be converted to
194 // mouse events later and passed to here. 195 // mouse events later and passed to here.
195 if (event.type == WebInputEvent::GestureTap) 196 if (event.type == WebInputEvent::GestureTap)
196 return blink::WebInputEventResult::NotHandled; 197 return blink::WebInputEventResult::NotHandled;
197 198
198 // For LongPress events we return false, since otherwise the context menu will 199 // For LongPress events we return false, since otherwise the context menu will
199 // be suppressed. https://crbug.com/482842 200 // be suppressed. https://crbug.com/482842
200 if (event.type == WebInputEvent::GestureLongPress) 201 if (event.type == WebInputEvent::GestureLongPress)
201 return blink::WebInputEventResult::NotHandled; 202 return blink::WebInputEventResult::NotHandled;
202 203
203 if (event.type == WebInputEvent::ContextMenu) { 204 if (event.type == WebInputEvent::ContextMenu) {
204 if (delegate_) { 205 if (delegate_) {
205 const WebMouseEvent& mouse_event = 206 const WebMouseEvent& mouse_event =
206 reinterpret_cast<const WebMouseEvent&>(event); 207 reinterpret_cast<const WebMouseEvent&>(event);
207 delegate_->ShowContextMenu(mouse_event); 208 delegate_->ShowContextMenu(mouse_event);
208 } 209 }
209 return blink::WebInputEventResult::HandledSuppressed; 210 return blink::WebInputEventResult::HandledSuppressed;
210 } 211 }
211 current_cursor_ = cursor; 212 current_cursor_ = cursor;
212 blink::WebInputEventResult handled = web_view_->handleInputEvent(event); 213 blink::WebInputEventResult handled =
214 web_view_->handleInputEvent(event, coalescedEvents);
213 cursor = current_cursor_; 215 cursor = current_cursor_;
214 216
215 return handled; 217 return handled;
216 } 218 }
217 219
218 void WebViewPlugin::didReceiveResponse(const WebURLResponse& response) { 220 void WebViewPlugin::didReceiveResponse(const WebURLResponse& response) {
219 NOTREACHED(); 221 NOTREACHED();
220 } 222 }
221 223
222 void WebViewPlugin::didReceiveData(const char* data, int data_length) { 224 void WebViewPlugin::didReceiveData(const char* data, int data_length) {
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
310 if (!delegate_) 312 if (!delegate_)
311 return; 313 return;
312 314
313 // The delegate may instantiate a new plugin. 315 // The delegate may instantiate a new plugin.
314 delegate_->OnUnobscuredRectUpdate(gfx::Rect(unobscured_rect)); 316 delegate_->OnUnobscuredRectUpdate(gfx::Rect(unobscured_rect));
315 // The delegate may have dirtied style and layout of the WebView. 317 // The delegate may have dirtied style and layout of the WebView.
316 // See for example the resizePoster function in plugin_poster.html. 318 // See for example the resizePoster function in plugin_poster.html.
317 // Run the lifecycle now so that it is clean. 319 // Run the lifecycle now so that it is clean.
318 web_view_->updateAllLifecyclePhases(); 320 web_view_->updateAllLifecyclePhases();
319 } 321 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698