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

Side by Side Diff: athena/home/home_card_impl.cc

Issue 503113002: Allows directly entering to VISIBLE_CENTERED state from gesture. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix Created 6 years, 4 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/home/home_card_unittest.cc » ('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/home/public/home_card.h" 5 #include "athena/home/public/home_card.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 588 matching lines...) Expand 10 before | Expand all | Expand 10 after
599 if (state_ == HIDDEN) 599 if (state_ == HIDDEN)
600 return NULL; 600 return NULL;
601 601
602 return home_card_widget_ ? home_card_widget_->GetNativeWindow() : NULL; 602 return home_card_widget_ ? home_card_widget_->GetNativeWindow() : NULL;
603 } 603 }
604 604
605 void HomeCardImpl::OnGestureEnded(State final_state) { 605 void HomeCardImpl::OnGestureEnded(State final_state) {
606 home_card_view_->ClearGesture(); 606 home_card_view_->ClearGesture();
607 if (state_ != final_state && 607 if (state_ != final_state &&
608 (state_ == VISIBLE_MINIMIZED || final_state == VISIBLE_MINIMIZED)) { 608 (state_ == VISIBLE_MINIMIZED || final_state == VISIBLE_MINIMIZED)) {
609 SetState(final_state);
609 WindowManager::GetInstance()->ToggleOverview(); 610 WindowManager::GetInstance()->ToggleOverview();
610 } else { 611 } else {
611 HomeCard::State old_state = state_; 612 HomeCard::State old_state = state_;
612 state_ = final_state; 613 state_ = final_state;
613 home_card_view_->SetStateWithAnimation(old_state, final_state); 614 home_card_view_->SetStateWithAnimation(old_state, final_state);
614 layout_manager_->Layout(); 615 layout_manager_->Layout();
615 } 616 }
616 } 617 }
617 618
618 void HomeCardImpl::OnGestureProgressed( 619 void HomeCardImpl::OnGestureProgressed(
619 State from_state, State to_state, float progress) { 620 State from_state, State to_state, float progress) {
620 home_card_view_->SetStateProgress(from_state, to_state, progress); 621 home_card_view_->SetStateProgress(from_state, to_state, progress);
621 622
622 gfx::Rect screen_bounds = 623 gfx::Rect screen_bounds =
623 home_card_widget_->GetNativeWindow()->GetRootWindow()->bounds(); 624 home_card_widget_->GetNativeWindow()->GetRootWindow()->bounds();
624 home_card_widget_->SetBounds(gfx::Tween::RectValueBetween( 625 home_card_widget_->SetBounds(gfx::Tween::RectValueBetween(
625 progress, 626 progress,
626 GetBoundsForState(screen_bounds, from_state), 627 GetBoundsForState(screen_bounds, from_state),
627 GetBoundsForState(screen_bounds, to_state))); 628 GetBoundsForState(screen_bounds, to_state)));
628 629
629 // TODO(mukai): signals the update to the window manager so that it shows the 630 // TODO(mukai): signals the update to the window manager so that it shows the
630 // intermediate visual state of overview mode. 631 // intermediate visual state of overview mode.
631 } 632 }
632 633
633 void HomeCardImpl::OnOverviewModeEnter() { 634 void HomeCardImpl::OnOverviewModeEnter() {
634 SetState(VISIBLE_BOTTOM); 635 if (state_ == VISIBLE_MINIMIZED)
636 SetState(VISIBLE_BOTTOM);
635 } 637 }
636 638
637 void HomeCardImpl::OnOverviewModeExit() { 639 void HomeCardImpl::OnOverviewModeExit() {
638 SetState(VISIBLE_MINIMIZED); 640 SetState(VISIBLE_MINIMIZED);
639 } 641 }
640 642
641 void HomeCardImpl::OnWindowActivated(aura::Window* gained_active, 643 void HomeCardImpl::OnWindowActivated(aura::Window* gained_active,
642 aura::Window* lost_active) { 644 aura::Window* lost_active) {
643 if (state_ != HIDDEN && 645 if (state_ != HIDDEN &&
644 gained_active != home_card_widget_->GetNativeWindow()) { 646 gained_active != home_card_widget_->GetNativeWindow()) {
(...skipping 17 matching lines...) Expand all
662 instance = NULL; 664 instance = NULL;
663 } 665 }
664 666
665 // static 667 // static
666 HomeCard* HomeCard::Get() { 668 HomeCard* HomeCard::Get() {
667 DCHECK(instance); 669 DCHECK(instance);
668 return instance; 670 return instance;
669 } 671 }
670 672
671 } // namespace athena 673 } // namespace athena
OLDNEW
« no previous file with comments | « no previous file | athena/home/home_card_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698