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

Unified Diff: content/browser/renderer_host/smooth_scroll_gesture_controller.h

Issue 11858007: Splits SmoothGestureController from RenderWidgetHostImpl (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: comments Created 7 years, 10 months 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/smooth_scroll_gesture_controller.h
diff --git a/content/browser/renderer_host/smooth_scroll_gesture_controller.h b/content/browser/renderer_host/smooth_scroll_gesture_controller.h
new file mode 100644
index 0000000000000000000000000000000000000000..bcadb47cb9b13bad1ec8bf2d23f961ba78ad1ea5
--- /dev/null
+++ b/content/browser/renderer_host/smooth_scroll_gesture_controller.h
@@ -0,0 +1,61 @@
+// Copyright (c) 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.
+
+#ifndef CONTENT_BROWSER_RENDERER_HOST_SMOOTH_GESTURE_CONTROLLER_H_
+#define CONTENT_BROWSER_RENDERER_HOST_SMOOTH_GESTURE_CONTROLLER_H_
+
+#include <map>
+
+#include "base/memory/weak_ptr.h"
+#include "base/time.h"
+#include "content/common/content_export.h"
+
+struct ViewHostMsg_BeginSmoothScroll_Params;
+
+namespace content {
+
+class RenderWidgetHost;
+class RenderWidgetHostViewPort;
+class SmoothScrollGesture;
+
+// Controls SmoothScrollGestures, used to inject synthetic events
+// for performance test harness.
+class CONTENT_EXPORT SmoothScrollGestureController {
+ public:
+ SmoothScrollGestureController();
+ ~SmoothScrollGestureController();
+
+ // Initiates a synthetic event stream.
+ bool OnBeginSmoothScroll(
+ RenderWidgetHostViewPort* view,
+ const ViewHostMsg_BeginSmoothScroll_Params& params);
+
+ // Called when an input event is going to be forwarded to the renderer.
+ void OnForwardInputEvent();
+
+ // Called when the |rwh| received an ACK for an input event.
+ void OnInputEventACK(RenderWidgetHost* rwh);
+
+ int SyntheticScrollMessageInterval() const;
+
+ private:
+ // Called periodically to advance the active scroll gesture after being
+ // initiated by OnBeginSmoothScroll.
+ void TickActiveSmoothScrollGesture(RenderWidgetHost* rwh);
+
+ base::WeakPtrFactory<SmoothScrollGestureController> weak_factory_;
+
+ int pending_input_event_count_;
+
+ scoped_refptr<SmoothScrollGesture> pending_smooth_scroll_gesture_;
+
+ base::TimeTicks last_smooth_scroll_gesture_tick_time_;
+ bool tick_active_smooth_scroll_gesture_task_posted_;
+
+ DISALLOW_COPY_AND_ASSIGN(SmoothScrollGestureController);
+};
+
+} // namespace content
+
+#endif // CONTENT_BROWSER_RENDERER_HOST_SMOOTH_GESTURE_CONTROLLER_H_

Powered by Google App Engine
This is Rietveld 408576698