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

Unified Diff: athena/home/home_card_gesture_manager.cc

Issue 529813002: Simplify HomeCardGestureManager::UpdateScrollState() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « athena/home/home_card_gesture_manager.h ('k') | athena/home/home_card_gesture_manager_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: athena/home/home_card_gesture_manager.cc
diff --git a/athena/home/home_card_gesture_manager.cc b/athena/home/home_card_gesture_manager.cc
index 5ed7803a07b1a38411aebbf2d573d78adbe2c885..9d53e3500889ac2218329ddd2937af6ed8396023 100644
--- a/athena/home/home_card_gesture_manager.cc
+++ b/athena/home/home_card_gesture_manager.cc
@@ -12,7 +12,6 @@ namespace athena {
HomeCardGestureManager::HomeCardGestureManager(Delegate* delegate,
const gfx::Rect& screen_bounds)
: delegate_(delegate),
- last_state_(HomeCard::Get()->GetState()),
y_offset_(0),
last_estimated_height_(0),
screen_bounds_(screen_bounds) {}
@@ -75,16 +74,15 @@ void HomeCardGestureManager::UpdateScrollState(const ui::GestureEvent& event) {
if (last_estimated_height_ <= kHomeCardMinimizedHeight) {
delegate_->OnGestureProgressed(
- last_state_, HomeCard::VISIBLE_MINIMIZED, 1.0f);
- last_state_ = HomeCard::VISIBLE_MINIMIZED;
+ HomeCard::VISIBLE_BOTTOM, HomeCard::VISIBLE_MINIMIZED, 1.0f);
return;
}
- HomeCard::State state = HomeCard::VISIBLE_BOTTOM;
+ HomeCard::State bigger_state = HomeCard::VISIBLE_BOTTOM;
float smaller_height = kHomeCardMinimizedHeight;
float bigger_height = kHomeCardHeight;
if (last_estimated_height_ > kHomeCardHeight) {
- state = HomeCard::VISIBLE_CENTERED;
+ bigger_state = HomeCard::VISIBLE_CENTERED;
smaller_height = kHomeCardHeight;
bigger_height = screen_bounds_.height();
}
@@ -94,16 +92,10 @@ void HomeCardGestureManager::UpdateScrollState(const ui::GestureEvent& event) {
(bigger_height - smaller_height);
progress = std::min(1.0f, std::max(0.0f, progress));
- if (last_state_ == state) {
- if (event.details().scroll_y() > 0) {
- state = static_cast<HomeCard::State>(state + 1);
- progress = 1.0f - progress;
- } else {
- last_state_ = static_cast<HomeCard::State>(last_state_ + 1);
- }
- }
- delegate_->OnGestureProgressed(last_state_, state, progress);
- last_state_ = state;
+ delegate_->OnGestureProgressed(
+ static_cast<HomeCard::State>(bigger_state + 1),
+ bigger_state,
+ progress);
}
} // namespace athena
« no previous file with comments | « athena/home/home_card_gesture_manager.h ('k') | athena/home/home_card_gesture_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698