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

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

Issue 2815823003: Notify OverscrollController of gesture events in plugins. (Closed)
Patch Set: Add test to verify OverscrollController sees consumed scrolls. Created 3 years, 7 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/overscroll_controller.h
diff --git a/content/browser/renderer_host/overscroll_controller.h b/content/browser/renderer_host/overscroll_controller.h
index 4e6134d91f0415908a581a74d95535718a64385e..d23b2a9c75a0ae47404b89a511ba45d0715e5ad6 100644
--- a/content/browser/renderer_host/overscroll_controller.h
+++ b/content/browser/renderer_host/overscroll_controller.h
@@ -7,6 +7,7 @@
#include "base/compiler_specific.h"
#include "base/macros.h"
+#include "content/common/content_export.h"
#include "third_party/WebKit/public/platform/WebGestureEvent.h"
#include "third_party/WebKit/public/platform/WebInputEvent.h"
@@ -38,8 +39,11 @@ enum class OverscrollSource {
// status accordingly.
class OverscrollController {
public:
- OverscrollController();
- virtual ~OverscrollController();
+ // Exported for testing.
+ // TODO(mcnee): Tests needing this are BrowserPlugin specific
+ // (crbug.com/533069).
+ CONTENT_EXPORT OverscrollController();
+ CONTENT_EXPORT virtual ~OverscrollController();
// This must be called when dispatching any event from the
// RenderWidgetHostView so that the state of the overscroll gesture can be
@@ -49,7 +53,12 @@ class OverscrollController {
// This must be called when the ACK for any event comes in. This updates the
// overscroll gesture status as appropriate.
- void ReceivedEventACK(const blink::WebInputEvent& event, bool processed);
+ // Virtual and exported for testing.
+ // TODO(mcnee): Tests needing this are BrowserPlugin specific
+ // (crbug.com/533069).
+ CONTENT_EXPORT virtual void ReceivedEventACK(
+ const blink::WebInputEvent& event,
+ bool processed);
// This must be called when a gesture event is filtered out and not sent to
// the renderer.
@@ -68,10 +77,11 @@ class OverscrollController {
// delegate if necessary), and resets internal states.
void Cancel();
- private:
- friend class RenderWidgetHostViewAuraOverscrollTest;
-
+ protected:
// Different scrolling states.
+ // Protected for testing.
+ // TODO(mcnee): Tests needing this are BrowserPlugin specific
+ // (crbug.com/533069).
enum ScrollState {
STATE_UNKNOWN,
STATE_PENDING,
@@ -79,6 +89,19 @@ class OverscrollController {
STATE_OVERSCROLLING,
};
+ // Used to keep track of the scrolling state.
+ // If scrolling starts, and some scroll events are consumed at the beginning
+ // of the scroll (i.e. some content on the web-page was scrolled), then do not
+ // process any of the subsequent scroll events for generating overscroll
+ // gestures.
+ // Protected for testing.
+ // TODO(mcnee): Tests needing this are BrowserPlugin specific
+ // (crbug.com/533069).
+ ScrollState scroll_state_;
+
+ private:
+ friend class RenderWidgetHostViewAuraOverscrollTest;
+
// Returns true if the event indicates that the in-progress overscroll gesture
// can now be completed.
bool DispatchEventCompletesAction(
@@ -113,13 +136,6 @@ class OverscrollController {
// The current state of overscroll gesture.
OverscrollMode overscroll_mode_;
- // Used to keep track of the scrolling state.
- // If scrolling starts, and some scroll events are consumed at the beginning
- // of the scroll (i.e. some content on the web-page was scrolled), then do not
- // process any of the subsequent scroll events for generating overscroll
- // gestures.
- ScrollState scroll_state_;
-
// The amount of overscroll in progress. These values are invalid when
// |overscroll_mode_| is set to OVERSCROLL_NONE.
float overscroll_delta_x_;

Powered by Google App Engine
This is Rietveld 408576698