Commit 4943b260 authored by Ryan Daum's avatar Ryan Daum Committed by Commit Bot

[chromecast] Separate margin flag for bottom gesture.

Allows the margin allowed for the bottom system gesture to be
specified separately from the top.

Bug: internal b/111304882
Test: manual
Change-Id: Ie549f2b7d48a4533eb5f493ed9255cf6ef6898d1
Reviewed-on: https://chromium-review.googlesource.com/1138395Reviewed-by: default avatarAlex Sakhartchouk <alexst@chromium.org>
Commit-Queue: Alex Sakhartchouk <alexst@chromium.org>
Commit-Queue: Ryan Daum <rdaum@chromium.org>
Cr-Commit-Position: refs/heads/master@{#575289}
parent d03e6005
......@@ -139,13 +139,21 @@ const char kEnableInput[] = "enable-input";
const char kCastAppBackgroundColor[] = "cast-app-background-color";
// The number of pixels from the very left or right of the screen to consider as
// a valid origin for the left or right swipe gesture.
// a valid origin for the left or right swipe gesture. Overrides the default
// value in cast_system_gesture_handler.cc.
const char kSystemGestureStartWidth[] = "system-gesture-start-width";
// The number of pixels from the very top or bottom of the screen to consider as
// a valid origin for the top or bottom swipe gesture.
// a valid origin for the top or bottom swipe gesture. Overrides the default
// value in cast_system_gesture_handler.cc.
const char kSystemGestureStartHeight[] = "system-gesture-start-height";
// The number of pixels up from the bottom of the screen to consider as a valid
// origin for a bottom swipe gesture. If set, overrides the value of both the
// above system-gesture-start-height flag and the default value in
// cast_system_gesture_handler.cc.
const char kBottomSystemGestureStartHeight[] = "bottom-gesture-start-height";
// The number of pixels from the start of a left swipe gesture to consider as a
// 'back' gesture.
const char kBackGestureHorizontalThreshold[] =
......
......@@ -74,6 +74,7 @@ extern const char kForceMediaResolutionWidth[];
extern const char kEnableInput[];
extern const char kSystemGestureStartWidth[];
extern const char kSystemGestureStartHeight[];
extern const char kBottomSystemGestureStartHeight[];
extern const char kBackGestureHorizontalThreshold[];
extern const char kEnableTopDragGesture[];
......
......@@ -25,6 +25,15 @@ constexpr int kDefaultSideGestureStartWidth = 35;
// a valid origin for the top or bottom swipe gesture.
constexpr int kDefaultSideGestureStartHeight = 35;
// Get the correct bottom gesture start height by checking both margin flags in
// order, and then the default value if neither is set.
int BottomGestureStartHeight() {
return GetSwitchValueInt(
switches::kBottomSystemGestureStartHeight,
GetSwitchValueInt(switches::kSystemGestureStartHeight,
kDefaultSideGestureStartHeight));
}
} // namespace
CastSystemGestureEventHandler::CastSystemGestureEventHandler(
......@@ -35,6 +44,7 @@ CastSystemGestureEventHandler::CastSystemGestureEventHandler(
gesture_start_height_(
GetSwitchValueInt(switches::kSystemGestureStartHeight,
kDefaultSideGestureStartHeight)),
bottom_gesture_start_height_(BottomGestureStartHeight()),
root_window_(root_window),
current_swipe_(CastSideSwipeOrigin::NONE) {
DCHECK(root_window);
......@@ -59,8 +69,8 @@ CastSideSwipeOrigin CastSystemGestureEventHandler::GetDragPosition(
(screen_bounds.x() + screen_bounds.width() - gesture_start_width_)) {
return CastSideSwipeOrigin::RIGHT;
}
if (point.y() >
(screen_bounds.y() + screen_bounds.height() - gesture_start_height_)) {
if (point.y() > (screen_bounds.y() + screen_bounds.height() -
bottom_gesture_start_height_)) {
return CastSideSwipeOrigin::BOTTOM;
}
return CastSideSwipeOrigin::NONE;
......
......@@ -48,6 +48,7 @@ class CastSystemGestureEventHandler : public ui::EventHandler {
private:
const int gesture_start_width_;
const int gesture_start_height_;
const int bottom_gesture_start_height_;
aura::Window* root_window_;
CastSideSwipeOrigin current_swipe_;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment