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

Unified Diff: content/browser/renderer_host/render_widget_host_impl.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/browser/renderer_host/render_widget_host_impl.cc
diff --git a/content/browser/renderer_host/render_widget_host_impl.cc b/content/browser/renderer_host/render_widget_host_impl.cc
index 9e606f4d5ca2f56a1508a717aa31c1493a75988e..a849d831baba154eb38f271450801a818eee2ff0 100644
--- a/content/browser/renderer_host/render_widget_host_impl.cc
+++ b/content/browser/renderer_host/render_widget_host_impl.cc
@@ -31,6 +31,9 @@
#include "content/browser/renderer_host/backing_store_manager.h"
#include "content/browser/renderer_host/dip_util.h"
#include "content/browser/renderer_host/input/immediate_input_router.h"
+#include "content/browser/renderer_host/input/synthetic_gesture.h"
+#include "content/browser/renderer_host/input/synthetic_gesture_controller.h"
+#include "content/browser/renderer_host/input/synthetic_gesture_target.h"
#include "content/browser/renderer_host/overscroll_controller.h"
#include "content/browser/renderer_host/render_process_host_impl.h"
#include "content/browser/renderer_host/render_view_host_impl.h"
@@ -384,11 +387,6 @@ void RenderWidgetHostImpl::SendScreenRects() {
waiting_for_screen_rects_ack_ = true;
}
-base::TimeDelta
- RenderWidgetHostImpl::GetSyntheticGestureMessageInterval() const {
- return synthetic_gesture_controller_.GetSyntheticGestureMessageInterval();
-}
-
void RenderWidgetHostImpl::SetOverscrollControllerEnabled(bool enabled) {
if (!enabled)
overscroll_controller_.reset();
@@ -402,6 +400,8 @@ void RenderWidgetHostImpl::SuppressNextCharEvents() {
void RenderWidgetHostImpl::FlushInput() {
input_router_->Flush();
+ if (synthetic_gesture_controller_)
+ synthetic_gesture_controller_->Flush(base::TimeTicks::Now());
}
void RenderWidgetHostImpl::SetNeedsFlush() {
@@ -448,6 +448,8 @@ bool RenderWidgetHostImpl::OnMessageReceived(const IPC::Message &msg) {
bool handled = true;
bool msg_is_ok = true;
IPC_BEGIN_MESSAGE_MAP_EX(RenderWidgetHostImpl, msg, msg_is_ok)
+ IPC_MESSAGE_HANDLER(InputHostMsg_QueueSyntheticGesture,
+ OnQueueSyntheticGesture)
IPC_MESSAGE_HANDLER(ViewHostMsg_RenderViewReady, OnRenderViewReady)
IPC_MESSAGE_HANDLER(ViewHostMsg_RenderProcessGone, OnRenderProcessGone)
IPC_MESSAGE_HANDLER(ViewHostMsg_Close, OnClose)
@@ -465,8 +467,6 @@ bool RenderWidgetHostImpl::OnMessageReceived(const IPC::Message &msg) {
IPC_MESSAGE_HANDLER(ViewHostMsg_DidOverscroll, OnOverscrolled)
IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateRect, OnUpdateRect)
IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateIsDelayed, OnUpdateIsDelayed)
- IPC_MESSAGE_HANDLER(ViewHostMsg_BeginSmoothScroll, OnBeginSmoothScroll)
- IPC_MESSAGE_HANDLER(ViewHostMsg_BeginPinch, OnBeginPinch)
IPC_MESSAGE_HANDLER(ViewHostMsg_Focus, OnFocus)
IPC_MESSAGE_HANDLER(ViewHostMsg_Blur, OnBlur)
IPC_MESSAGE_HANDLER(ViewHostMsg_SetCursor, OnSetCursor)
@@ -1280,6 +1280,8 @@ void RenderWidgetHostImpl::RendererExited(base::TerminationStatus status,
}
BackingStoreManager::RemoveBackingStore(this);
+
+ synthetic_gesture_controller_.reset();
}
void RenderWidgetHostImpl::UpdateTextDirection(WebTextDirection direction) {
@@ -1712,18 +1714,18 @@ void RenderWidgetHostImpl::DidUpdateBackingStore(
UMA_HISTOGRAM_TIMES("MPArch.RWH_TotalPaintTime", delta);
}
-void RenderWidgetHostImpl::OnBeginSmoothScroll(
- const ViewHostMsg_BeginSmoothScroll_Params& params) {
- if (!view_)
- return;
- synthetic_gesture_controller_.BeginSmoothScroll(view_, params);
-}
+void RenderWidgetHostImpl::OnQueueSyntheticGesture(
+ const SyntheticGesturePacket& gesture_packet) {
+ if (!synthetic_gesture_controller_) {
+ if (!view_)
+ return;
+ synthetic_gesture_controller_.reset(
+ new SyntheticGestureController(
+ view_->CreateSyntheticGestureTarget().Pass()));
+ }
-void RenderWidgetHostImpl::OnBeginPinch(
- const ViewHostMsg_BeginPinch_Params& params) {
- if (!view_)
- return;
- synthetic_gesture_controller_.BeginPinch(view_, params);
+ synthetic_gesture_controller_->QueueSyntheticGesture(
+ SyntheticGesture::Create(*gesture_packet.gesture_params()));
}
void RenderWidgetHostImpl::OnFocus() {

Powered by Google App Engine
This is Rietveld 408576698