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

Side by Side Diff: athena/wm/bezel_controller.cc

Issue 574113004: [Athena] Fix switching activities by swiping from the right bezel (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@athena_split
Patch Set: 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 unified diff | Download patch
« no previous file with comments | « no previous file | athena/wm/split_view_controller.cc » ('j') | athena/wm/split_view_controller.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "athena/wm/bezel_controller.h" 5 #include "athena/wm/bezel_controller.h"
6 6
7 #include "ui/aura/window.h" 7 #include "ui/aura/window.h"
8 #include "ui/events/event_handler.h" 8 #include "ui/events/event_handler.h"
9 #include "ui/gfx/display.h" 9 #include "ui/gfx/display.h"
10 #include "ui/gfx/geometry/point_conversions.h" 10 #include "ui/gfx/geometry/point_conversions.h"
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 DCHECK_NE(state, BEZEL_SCROLLING_TWO_FINGERS); 61 DCHECK_NE(state, BEZEL_SCROLLING_TWO_FINGERS);
62 DCHECK_NE(state, BEZEL_SCROLLING_ONE_FINGER); 62 DCHECK_NE(state, BEZEL_SCROLLING_ONE_FINGER);
63 SetState(state, kScrollDeltaNone); 63 SetState(state, kScrollDeltaNone);
64 } 64 }
65 65
66 void BezelController::SetState(BezelController::State state, 66 void BezelController::SetState(BezelController::State state,
67 float scroll_delta) { 67 float scroll_delta) {
68 if (!left_right_delegate_ || state == state_) 68 if (!left_right_delegate_ || state == state_)
69 return; 69 return;
70 70
71 if (state == BEZEL_SCROLLING_TWO_FINGERS) 71 State old_state = state_;
72 left_right_delegate_->ScrollBegin(scroll_bezel_, scroll_delta);
73 else if (state_ == BEZEL_SCROLLING_TWO_FINGERS)
74 left_right_delegate_->ScrollEnd();
75 state_ = state; 72 state_ = state;
73
76 if (state == NONE) { 74 if (state == NONE) {
77 scroll_bezel_ = BEZEL_NONE; 75 scroll_bezel_ = BEZEL_NONE;
78 scroll_target_ = NULL; 76 scroll_target_ = NULL;
79 } 77 }
78
79 if (state == BEZEL_SCROLLING_TWO_FINGERS) {
80 left_right_delegate_->ScrollBegin(scroll_bezel_, scroll_delta);
81 } else if (old_state == BEZEL_SCROLLING_TWO_FINGERS) {
82 // If ScrollEnd() hides |scroll_target_|, ET_GESTURE_END is dispatched
83 // and we get a reentrant call to SetState().
84 left_right_delegate_->ScrollEnd();
85 }
80 } 86 }
81 87
82 // Only implemented for LEFT and RIGHT bezels ATM. 88 // Only implemented for LEFT and RIGHT bezels ATM.
83 BezelController::Bezel BezelController::GetBezel(const gfx::PointF& location) { 89 BezelController::Bezel BezelController::GetBezel(const gfx::PointF& location) {
84 int screen_width = GetDisplay(container_).bounds().width(); 90 int screen_width = GetDisplay(container_).bounds().width();
85 if (location.x() < kBezelWidth) { 91 if (location.x() < kBezelWidth) {
86 return BEZEL_LEFT; 92 return BEZEL_LEFT;
87 } else if (location.x() > screen_width - kBezelWidth) { 93 } else if (location.x() > screen_width - kBezelWidth) {
88 return BEZEL_RIGHT; 94 return BEZEL_RIGHT;
89 } else { 95 } else {
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 if (state_ != BEZEL_SCROLLING_TWO_FINGERS) 186 if (state_ != BEZEL_SCROLLING_TWO_FINGERS)
181 return; 187 return;
182 188
183 left_right_delegate_->ScrollUpdate(scroll_delta); 189 left_right_delegate_->ScrollUpdate(scroll_delta);
184 if (left_right_delegate_->CanScroll()) 190 if (left_right_delegate_->CanScroll())
185 event->SetHandled(); 191 event->SetHandled();
186 } 192 }
187 } 193 }
188 194
189 } // namespace athena 195 } // namespace athena
OLDNEW
« no previous file with comments | « no previous file | athena/wm/split_view_controller.cc » ('j') | athena/wm/split_view_controller.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698