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

Unified Diff: content/renderer/render_widget.cc

Issue 62443007: Replace old with new synthetic gesture framework. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Forward declare SyntheticGestureController. Created 7 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 side-by-side diff with in-line comments
Download patch
Index: content/renderer/render_widget.cc
diff --git a/content/renderer/render_widget.cc b/content/renderer/render_widget.cc
index 7cd7c33f25e6cdde639dd4d063878ba529acddc5..df344d32090f2d474f6498637c4edadafe696dc8 100644
--- a/content/renderer/render_widget.cc
+++ b/content/renderer/render_widget.cc
@@ -23,6 +23,7 @@
#include "content/common/gpu/client/context_provider_command_buffer.h"
#include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h"
#include "content/common/gpu/gpu_process_launch_causes.h"
+#include "content/common/input/synthetic_gesture_packet.h"
#include "content/common/input/web_input_event_traits.h"
#include "content/common/input_messages.h"
#include "content/common/swapped_out_messages.h"
@@ -595,6 +596,8 @@ bool RenderWidget::OnMessageReceived(const IPC::Message& message) {
OnCursorVisibilityChange)
IPC_MESSAGE_HANDLER(InputMsg_MouseCaptureLost, OnMouseCaptureLost)
IPC_MESSAGE_HANDLER(InputMsg_SetFocus, OnSetFocus)
+ IPC_MESSAGE_HANDLER(InputMsg_SyntheticGestureCompleted,
+ OnSyntheticGestureCompleted)
IPC_MESSAGE_HANDLER(ViewMsg_Close, OnClose)
IPC_MESSAGE_HANDLER(ViewMsg_CreatingNew_ACK, OnCreatingNewAck)
IPC_MESSAGE_HANDLER(ViewMsg_Resize, OnResize)
@@ -609,8 +612,6 @@ bool RenderWidget::OnMessageReceived(const IPC::Message& message) {
IPC_MESSAGE_HANDLER(ViewMsg_ImeConfirmComposition, OnImeConfirmComposition)
IPC_MESSAGE_HANDLER(ViewMsg_PaintAtSize, OnPaintAtSize)
IPC_MESSAGE_HANDLER(ViewMsg_Repaint, OnRepaint)
- IPC_MESSAGE_HANDLER(ViewMsg_SyntheticGestureCompleted,
- OnSyntheticGestureCompleted)
IPC_MESSAGE_HANDLER(ViewMsg_SetTextDirection, OnSetTextDirection)
IPC_MESSAGE_HANDLER(ViewMsg_Move_ACK, OnRequestMoveAck)
IPC_MESSAGE_HANDLER(ViewMsg_UpdateScreenRects, OnUpdateScreenRects)
@@ -2002,6 +2003,19 @@ void RenderWidget::closeWidgetSoon() {
FROM_HERE, base::Bind(&RenderWidget::DoDeferredClose, this));
}
+void RenderWidget::QueueSyntheticGesture(
+ scoped_ptr<SyntheticGestureParams> gesture_params,
+ const SyntheticGestureCompletionCallback& callback) {
+ DCHECK(!callback.is_null());
+
+ pending_synthetic_gesture_callbacks_.push(callback);
+
+ SyntheticGesturePacket gesture_packet;
+ gesture_packet.set_gesture_params(gesture_params.Pass());
+
+ Send(new InputHostMsg_QueueSyntheticGesture(routing_id_, gesture_packet));
+}
+
void RenderWidget::Close() {
if (webwidget_) {
webwidget_->willCloseLayerTreeView();
@@ -2258,7 +2272,10 @@ void RenderWidget::OnRepaint(gfx::Size size_to_paint) {
}
void RenderWidget::OnSyntheticGestureCompleted() {
- pending_synthetic_gesture_.Run();
+ DCHECK(!pending_synthetic_gesture_callbacks_.empty());
+
+ pending_synthetic_gesture_callbacks_.front().Run();
+ pending_synthetic_gesture_callbacks_.pop();
}
void RenderWidget::OnSetTextDirection(WebTextDirection direction) {
@@ -2730,42 +2747,6 @@ void RenderWidget::GetBrowserRenderingStats(BrowserRenderingStats* stats) {
*stats = browser_rendering_stats_;
}
-void RenderWidget::BeginSmoothScroll(
- bool down,
- const SyntheticGestureCompletionCallback& callback,
- int pixels_to_scroll,
- int mouse_event_x,
- int mouse_event_y) {
- DCHECK(!callback.is_null());
-
- ViewHostMsg_BeginSmoothScroll_Params params;
- params.scroll_down = down;
- params.pixels_to_scroll = pixels_to_scroll;
- params.mouse_event_x = mouse_event_x;
- params.mouse_event_y = mouse_event_y;
-
- Send(new ViewHostMsg_BeginSmoothScroll(routing_id_, params));
- pending_synthetic_gesture_ = callback;
-}
-
-void RenderWidget::BeginPinch(
- bool zoom_in,
- int pixels_to_move,
- int anchor_x,
- int anchor_y,
- const SyntheticGestureCompletionCallback& callback) {
- DCHECK(!callback.is_null());
-
- ViewHostMsg_BeginPinch_Params params;
- params.zoom_in = zoom_in;
- params.pixels_to_move = pixels_to_move;
- params.anchor_x = anchor_x;
- params.anchor_y = anchor_y;
-
- Send(new ViewHostMsg_BeginPinch(routing_id_, params));
- pending_synthetic_gesture_ = callback;
-}
-
bool RenderWidget::WillHandleMouseEvent(const blink::WebMouseEvent& event) {
return false;
}

Powered by Google App Engine
This is Rietveld 408576698