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

Unified Diff: content/browser/renderer_host/synthetic_gesture_controller.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/synthetic_gesture_controller.cc
diff --git a/content/browser/renderer_host/synthetic_gesture_controller.cc b/content/browser/renderer_host/synthetic_gesture_controller.cc
deleted file mode 100644
index 46c4329da6b6121d3a1b57689a5646843081e77b..0000000000000000000000000000000000000000
--- a/content/browser/renderer_host/synthetic_gesture_controller.cc
+++ /dev/null
@@ -1,84 +0,0 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "content/browser/renderer_host/synthetic_gesture_controller.h"
-
-#include "base/debug/trace_event.h"
-#include "base/message_loop/message_loop.h"
-#include "content/common/view_messages.h"
-#include "content/port/browser/render_widget_host_view_port.h"
-#include "content/port/browser/synthetic_gesture.h"
-#include "content/public/browser/render_widget_host.h"
-
-namespace content {
-
-namespace {
-
-// How many milliseconds apart synthetic scroll messages should be sent.
-const int kSyntheticGestureMessageIntervalMs = 7;
-
-} // namespace
-
-SyntheticGestureController::SyntheticGestureController()
- : rwh_(NULL) {
-}
-
-SyntheticGestureController::~SyntheticGestureController() {
-}
-
-void SyntheticGestureController::BeginSmoothScroll(
- RenderWidgetHostViewPort* view,
- const ViewHostMsg_BeginSmoothScroll_Params& params) {
- if (pending_synthetic_gesture_.get())
- return;
-
- rwh_ = view->GetRenderWidgetHost();
- pending_synthetic_gesture_ = view->CreateSmoothScrollGesture(
- params.scroll_down,
- params.pixels_to_scroll,
- params.mouse_event_x,
- params.mouse_event_y);
-
- TRACE_EVENT_ASYNC_BEGIN0("benchmark", "SyntheticGestureController::running",
- pending_synthetic_gesture_);
- timer_.Start(FROM_HERE, GetSyntheticGestureMessageInterval(), this,
- &SyntheticGestureController::OnTimer);
-}
-
-void SyntheticGestureController::BeginPinch(
- RenderWidgetHostViewPort* view,
- const ViewHostMsg_BeginPinch_Params& params) {
- if (pending_synthetic_gesture_.get())
- return;
-
- rwh_ = view->GetRenderWidgetHost();
- pending_synthetic_gesture_ = view->CreatePinchGesture(
- params.zoom_in,
- params.pixels_to_move,
- params.anchor_x,
- params.anchor_y);
-
- TRACE_EVENT_ASYNC_BEGIN0("benchmark", "SyntheticGestureController::running",
- pending_synthetic_gesture_);
- timer_.Start(FROM_HERE, GetSyntheticGestureMessageInterval(), this,
- &SyntheticGestureController::OnTimer);
-}
-
-base::TimeDelta
- SyntheticGestureController::GetSyntheticGestureMessageInterval() const {
- return base::TimeDelta::FromMilliseconds(kSyntheticGestureMessageIntervalMs);
-}
-
-void SyntheticGestureController::OnTimer() {
- base::TimeTicks now = base::TimeTicks::Now();
- if (!pending_synthetic_gesture_->ForwardInputEvents(now, rwh_)) {
- timer_.Stop();
- TRACE_EVENT_ASYNC_END0("benchmark", "SyntheticGestureController::running",
- pending_synthetic_gesture_);
- pending_synthetic_gesture_ = NULL;
- rwh_->Send(new ViewMsg_SyntheticGestureCompleted(rwh_->GetRoutingID()));
- }
-}
-
-} // namespace content

Powered by Google App Engine
This is Rietveld 408576698