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/public/window_list_provider.h » ('j') | no next file with comments »
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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 DCHECK_NE(state, BEZEL_SCROLLING_TWO_FINGERS); 76 DCHECK_NE(state, BEZEL_SCROLLING_TWO_FINGERS);
77 DCHECK_NE(state, BEZEL_SCROLLING_ONE_FINGER); 77 DCHECK_NE(state, BEZEL_SCROLLING_ONE_FINGER);
78 SetState(state, kScrollDeltaNone); 78 SetState(state, kScrollDeltaNone);
79 } 79 }
80 80
81 void BezelController::SetState(BezelController::State state, 81 void BezelController::SetState(BezelController::State state,
82 float scroll_delta) { 82 float scroll_delta) {
83 if (!left_right_delegate_ || state == state_) 83 if (!left_right_delegate_ || state == state_)
84 return; 84 return;
85 85
86 if (state == BEZEL_SCROLLING_TWO_FINGERS) 86 State old_state = state_;
87 left_right_delegate_->BezelScrollBegin(scroll_bezel_, scroll_delta);
88 else if (state_ == BEZEL_SCROLLING_TWO_FINGERS)
89 left_right_delegate_->BezelScrollEnd();
90 state_ = state; 87 state_ = state;
88
91 if (state == NONE) { 89 if (state == NONE) {
92 scroll_bezel_ = BEZEL_NONE; 90 scroll_bezel_ = BEZEL_NONE;
93 scroll_target_ = NULL; 91 scroll_target_ = NULL;
94 } 92 }
93
94 if (state == BEZEL_SCROLLING_TWO_FINGERS) {
95 left_right_delegate_->BezelScrollBegin(scroll_bezel_, scroll_delta);
96 } else if (old_state == BEZEL_SCROLLING_TWO_FINGERS) {
97 // If BezelScrollEnd() hides |scroll_target_|, ET_GESTURE_END is dispatched
98 // and we get a reentrant call to SetState().
99 left_right_delegate_->BezelScrollEnd();
100 }
95 } 101 }
96 102
97 void BezelController::OnGestureEvent(ui::GestureEvent* event) { 103 void BezelController::OnGestureEvent(ui::GestureEvent* event) {
98 // TODO(mfomitchev): Currently we aren't retargetting or consuming any of the 104 // TODO(mfomitchev): Currently we aren't retargetting or consuming any of the
99 // touch events. This means that content can prevent the generation of gesture 105 // touch events. This means that content can prevent the generation of gesture
100 // events and two-finger scroll won't work. Possible solution to this problem 106 // events and two-finger scroll won't work. Possible solution to this problem
101 // is hosting our own gesture recognizer or retargetting touch events at the 107 // is hosting our own gesture recognizer or retargetting touch events at the
102 // bezel. 108 // bezel.
103 109
104 if (!left_right_delegate_) 110 if (!left_right_delegate_)
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 if (state_ != BEZEL_SCROLLING_TWO_FINGERS) 200 if (state_ != BEZEL_SCROLLING_TWO_FINGERS)
195 return; 201 return;
196 202
197 left_right_delegate_->BezelScrollUpdate(scroll_delta); 203 left_right_delegate_->BezelScrollUpdate(scroll_delta);
198 if (left_right_delegate_->BezelCanScroll()) 204 if (left_right_delegate_->BezelCanScroll())
199 event->SetHandled(); 205 event->SetHandled();
200 } 206 }
201 } 207 }
202 208
203 } // namespace athena 209 } // namespace athena
OLDNEW
« no previous file with comments | « no previous file | athena/wm/public/window_list_provider.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698