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

Side by Side Diff: athena/home/home_card_impl.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 unified diff | Download patch
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/home/home_card_impl.h" 5 #include "athena/home/home_card_impl.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 #include <limits> 8 #include <limits>
9 9
10 #include "athena/common/container_priorities.h" 10 #include "athena/common/container_priorities.h"
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 // the home card. 150 // the home card.
151 // TODO(mukai): make it so after the detailed UI has been fixed. 151 // TODO(mukai): make it so after the detailed UI has been fixed.
152 main_view_ = new AthenaStartPageView(view_delegate); 152 main_view_ = new AthenaStartPageView(view_delegate);
153 AddChildView(main_view_); 153 AddChildView(main_view_);
154 } 154 }
155 155
156 void SetStateProgress(HomeCard::State from_state, 156 void SetStateProgress(HomeCard::State from_state,
157 HomeCard::State to_state, 157 HomeCard::State to_state,
158 float progress) { 158 float progress) {
159 // TODO(mukai): not clear the focus, but simply close the virtual keyboard. 159 // TODO(mukai): not clear the focus, but simply close the virtual keyboard.
160 if (from_state != HomeCard::VISIBLE_CENTERED || 160 GetFocusManager()->ClearFocus();
Jun Mukai 2014/09/02 03:51:42 Not sure why how this change is related to the bug
pkotwicz 2014/09/02 04:41:32 This change is related to this CL given that if |f
Jun Mukai 2014/09/02 08:22:42 Hmm, that sounds a bug then. In case the user drag
161 to_state != HomeCard::VISIBLE_CENTERED) { 161
162 GetFocusManager()->ClearFocus();
163 }
164 if (from_state == HomeCard::VISIBLE_CENTERED) 162 if (from_state == HomeCard::VISIBLE_CENTERED)
165 main_view_->SetLayoutState(1.0f - progress); 163 main_view_->SetLayoutState(1.0f - progress);
166 else if (to_state == HomeCard::VISIBLE_CENTERED) 164 else if (to_state == HomeCard::VISIBLE_CENTERED)
167 main_view_->SetLayoutState(progress); 165 main_view_->SetLayoutState(progress);
168 else 166 else
169 SetState(to_state); 167 SetState(to_state);
170 } 168 }
171 169
172 void SetState(HomeCard::State state) { 170 void SetState(HomeCard::State state) {
173 if (state == HomeCard::VISIBLE_CENTERED) 171 if (state == HomeCard::VISIBLE_CENTERED)
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
395 state_ = final_state; 393 state_ = final_state;
396 home_card_view_->SetStateWithAnimation(state_); 394 home_card_view_->SetStateWithAnimation(state_);
397 layout_manager_->Layout(true); 395 layout_manager_->Layout(true);
398 } 396 }
399 } 397 }
400 398
401 void HomeCardImpl::OnGestureProgressed( 399 void HomeCardImpl::OnGestureProgressed(
402 State from_state, State to_state, float progress) { 400 State from_state, State to_state, float progress) {
403 if (from_state == VISIBLE_MINIMIZED || to_state == VISIBLE_MINIMIZED) { 401 if (from_state == VISIBLE_MINIMIZED || to_state == VISIBLE_MINIMIZED) {
404 minimized_home_->layer()->SetVisible(true); 402 minimized_home_->layer()->SetVisible(true);
405 float opacity = 403 float opacity = 1.0f;
406 (from_state == VISIBLE_MINIMIZED) ? 1.0f - progress : progress; 404 if (from_state != to_state)
405 opacity = (from_state == VISIBLE_MINIMIZED) ? 1.0f - progress : progress;
Jun Mukai 2014/09/02 03:51:42 Can you fix home_card_gesture_manager side in this
pkotwicz 2014/09/02 04:41:32 I have now fixed this in home_card_gesture_manager
407 minimized_home_->layer()->SetOpacity(opacity); 406 minimized_home_->layer()->SetOpacity(opacity);
408 } 407 }
409 gfx::Rect screen_bounds = 408 gfx::Rect screen_bounds =
410 home_card_widget_->GetNativeWindow()->GetRootWindow()->bounds(); 409 home_card_widget_->GetNativeWindow()->GetRootWindow()->bounds();
411 home_card_widget_->SetBounds(gfx::Tween::RectValueBetween( 410 home_card_widget_->SetBounds(gfx::Tween::RectValueBetween(
412 progress, 411 progress,
413 GetBoundsForState(screen_bounds, from_state), 412 GetBoundsForState(screen_bounds, from_state),
414 GetBoundsForState(screen_bounds, to_state))); 413 GetBoundsForState(screen_bounds, to_state)));
415 414
416 home_card_view_->SetStateProgress(from_state, to_state, progress); 415 home_card_view_->SetStateProgress(from_state, to_state, progress);
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
453 instance = NULL; 452 instance = NULL;
454 } 453 }
455 454
456 // static 455 // static
457 HomeCard* HomeCard::Get() { 456 HomeCard* HomeCard::Get() {
458 DCHECK(instance); 457 DCHECK(instance);
459 return instance; 458 return instance;
460 } 459 }
461 460
462 } // namespace athena 461 } // namespace athena
OLDNEW
« athena/home/home_card_gesture_manager.h ('K') | « athena/home/home_card_gesture_manager.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698