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

Unified Diff: athena/wm/bezel_controller.cc

Issue 545393002: Adding split view divider widget. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: git cl format Created 6 years, 3 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: athena/wm/bezel_controller.cc
diff --git a/athena/wm/bezel_controller.cc b/athena/wm/bezel_controller.cc
index a4e815602e7b32ecee1667e88caf0962f71199d6..69c9c6e9dd0b336379864dcde99ab1b3c682c583 100644
--- a/athena/wm/bezel_controller.cc
+++ b/athena/wm/bezel_controller.cc
@@ -46,6 +46,22 @@ float GetDistance(const gfx::PointF& location,
: point_in_screen.x() - GetDisplay(window).bounds().width();
}
+// Returns the bezel corresponding to the |location| in |window| or BEZEL_NONE
+// if the location is outside of the bezel area.
+// Only implemented for LEFT and RIGHT bezels ATM.
+BezelController::Bezel GetBezel(const gfx::PointF& location,
+ aura::Window* window) {
+ int screen_width = GetDisplay(window).bounds().width();
+ gfx::Point point_in_screen(gfx::ToRoundedPoint(location));
+ wm::ConvertPointToScreen(window, &point_in_screen);
+ if (point_in_screen.x() < kBezelWidth)
+ return BezelController::BEZEL_LEFT;
+ else if (point_in_screen.x() > screen_width - kBezelWidth)
+ return BezelController::BEZEL_RIGHT;
+ else
+ return BezelController::BEZEL_NONE;
+}
+
} // namespace
BezelController::BezelController(aura::Window* container)
@@ -79,18 +95,6 @@ void BezelController::SetState(BezelController::State state,
}
}
-// Only implemented for LEFT and RIGHT bezels ATM.
-BezelController::Bezel BezelController::GetBezel(const gfx::PointF& location) {
- int screen_width = GetDisplay(container_).bounds().width();
- if (location.x() < kBezelWidth) {
- return BEZEL_LEFT;
- } else if (location.x() > screen_width - kBezelWidth) {
- return BEZEL_RIGHT;
- } else {
- return BEZEL_NONE;
- }
-}
-
void BezelController::OnGestureEvent(ui::GestureEvent* event) {
// TODO(mfomitchev): Currently we aren't retargetting or consuming any of the
// touch events. This means that content can prevent the generation of gesture
@@ -112,8 +116,8 @@ void BezelController::OnGestureEvent(ui::GestureEvent* event) {
const ui::GestureEventDetails& event_details = event->details();
int num_touch_points = event_details.touch_points();
float scroll_delta = kScrollDeltaNone;
+ aura::Window* target_window = static_cast<aura::Window*>(event->target());
if (scroll_bezel_ != BEZEL_NONE) {
- aura::Window* target_window = static_cast<aura::Window*>(event->target());
scroll_delta = GetDistance(event_location, target_window, scroll_bezel_);
}
@@ -122,7 +126,8 @@ void BezelController::OnGestureEvent(ui::GestureEvent* event) {
SetState(IGNORE_CURRENT_SCROLL);
return;
}
- BezelController::Bezel event_bezel = GetBezel(event->location_f());
+ BezelController::Bezel event_bezel =
+ GetBezel(event->location_f(), target_window);
switch (state_) {
case NONE:
scroll_bezel_ = event_bezel;

Powered by Google App Engine
This is Rietveld 408576698