Commit 22b9ac0a authored by Manu Cornet's avatar Manu Cornet

CrOS Home launcher: Rename animation state enum values

Also rename "animation state" to "transition state" since this also
represents drag state.

Bug: 1012760
Change-Id: Ic890be82ddd4cb713759c07985cc7e4b1210b029
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1910761Reviewed-by: default avatarAlex Newcomer <newcomer@chromium.org>
Cr-Commit-Position: refs/heads/master@{#714384}
parent 1f58991d
......@@ -635,7 +635,7 @@ void AppListControllerImpl::OnOverviewModeEnding(OverviewSession* session) {
return;
const int64_t display_id = last_visible_display_id_;
bool target_visibility = GetTargetVisibility();
if (home_launcher_animation_state_ == HomeLauncherAnimationState::kFinished)
if (home_launcher_transition_state_ == HomeLauncherTransitionState::kFinished)
target_visibility &= !HasVisibleWindows();
OnHomeLauncherTargetPositionChanged(target_visibility, display_id);
OnVisibilityWillChange(target_visibility, display_id);
......@@ -789,7 +789,7 @@ void AppListControllerImpl::OnUiVisibilityChanged(
void AppListControllerImpl::OnHomeLauncherAnimationComplete(
bool shown,
int64_t display_id) {
home_launcher_animation_state_ = HomeLauncherAnimationState::kFinished;
home_launcher_transition_state_ = HomeLauncherTransitionState::kFinished;
CloseAssistantUi(shown ? AssistantExitPoint::kLauncherOpen
: AssistantExitPoint::kLauncherClose);
// Animations can be reversed (e.g. in a drag). Let's ensure the target
......@@ -804,9 +804,11 @@ void AppListControllerImpl::OnHomeLauncherAnimationComplete(
void AppListControllerImpl::OnHomeLauncherTargetPositionChanged(
bool showing,
int64_t display_id) {
home_launcher_animation_state_ = showing
? HomeLauncherAnimationState::kShowing
: HomeLauncherAnimationState::kHiding;
// TODO(manucornet): Make these depend on how far into the animation or drag
// we are.
home_launcher_transition_state_ =
showing ? HomeLauncherTransitionState::kMostlyShown
: HomeLauncherTransitionState::kMostlyHidden;
OnVisibilityWillChange(showing, display_id);
}
......@@ -1339,8 +1341,8 @@ void AppListControllerImpl::OnVisibilityChanged(bool visible,
// HomeLauncher is only visible when no other app windows are visible,
// unless we are in the process of animating to (or dragging) the home
// launcher.
if (IsTabletMode() &&
home_launcher_animation_state_ == HomeLauncherAnimationState::kFinished) {
if (IsTabletMode() && home_launcher_transition_state_ ==
HomeLauncherTransitionState::kFinished) {
real_visibility &= !HasVisibleWindows();
}
......@@ -1380,8 +1382,8 @@ void AppListControllerImpl::OnVisibilityWillChange(bool visible,
// HomeLauncher is only visible when no other app windows are visible,
// unless we are in the process of animating to (or dragging) the home
// launcher.
if (IsTabletMode() &&
home_launcher_animation_state_ == HomeLauncherAnimationState::kFinished) {
if (IsTabletMode() && home_launcher_transition_state_ ==
HomeLauncherTransitionState::kFinished) {
real_target_visibility &= !HasVisibleWindows();
}
......
......@@ -68,10 +68,10 @@ class ASH_EXPORT AppListControllerImpl
AppListControllerImpl();
~AppListControllerImpl() override;
enum HomeLauncherAnimationState {
kFinished,
kShowing,
kHiding,
enum HomeLauncherTransitionState {
kFinished, // No drag or animation is in progress
kMostlyShown, // The home launcher occupies more than half of the screen
kMostlyHidden, // The home launcher occupies less than half of the screen
};
static void RegisterProfilePrefs(PrefRegistrySimple* registry);
......@@ -293,8 +293,8 @@ class ASH_EXPORT AppListControllerImpl
bool onscreen_keyboard_shown() const { return onscreen_keyboard_shown_; }
HomeLauncherAnimationState home_launcher_animation_state() const {
return home_launcher_animation_state_;
HomeLauncherTransitionState home_launcher_transition_state() const {
return home_launcher_transition_state_;
}
// Performs the 'back' action for the active page.
......@@ -389,7 +389,7 @@ class ASH_EXPORT AppListControllerImpl
// information given by "showing" versus "hiding" is the starting point of
// the drag and the assumed final state (which won't be accurate if the
// gesture is reversed).
HomeLauncherAnimationState home_launcher_animation_state_ = kFinished;
HomeLauncherTransitionState home_launcher_transition_state_ = kFinished;
AppListClient* client_ = nullptr;
......
......@@ -703,8 +703,8 @@ ShelfBackgroundType ShelfLayoutManager::GetShelfBackgroundType() const {
// If the home launcher is shown, being animated, or dragged, show the
// default background.
if (app_list_is_visible ||
Shell::Get()->app_list_controller()->home_launcher_animation_state() !=
AppListControllerImpl::HomeLauncherAnimationState::kFinished)
Shell::Get()->app_list_controller()->home_launcher_transition_state() !=
AppListControllerImpl::HomeLauncherTransitionState::kFinished)
return SHELF_BACKGROUND_DEFAULT;
} else if (app_list_is_visible) {
return maximized ? SHELF_BACKGROUND_MAXIMIZED_WITH_APP_LIST
......@@ -1102,12 +1102,12 @@ HotseatState ShelfLayoutManager::CalculateHotseatState(
switch (drag_status_) {
case kDragNone:
case kDragHomeToOverviewInProgress: {
switch (app_list_controller->home_launcher_animation_state()) {
case AppListControllerImpl::HomeLauncherAnimationState::kShowing:
switch (app_list_controller->home_launcher_transition_state()) {
case AppListControllerImpl::HomeLauncherTransitionState::kMostlyShown:
return HotseatState::kShown;
case AppListControllerImpl::HomeLauncherAnimationState::kHiding:
case AppListControllerImpl::HomeLauncherTransitionState::kMostlyHidden:
return in_overview ? HotseatState::kExtended : HotseatState::kHidden;
case AppListControllerImpl::HomeLauncherAnimationState::kFinished:
case AppListControllerImpl::HomeLauncherTransitionState::kFinished:
// Consider the AppList visible if it is beginning to show. Also
// detect the case where the last window is being minimized.
if (app_list_visible)
......@@ -1436,8 +1436,8 @@ void ShelfLayoutManager::CalculateTargetBounds(
if (state.IsShelfAutoHidden()) {
shelf_in_screen_portion =
Shell::Get()->app_list_controller()->home_launcher_animation_state() ==
AppListControllerImpl::HomeLauncherAnimationState::kShowing
Shell::Get()->app_list_controller()->home_launcher_transition_state() ==
AppListControllerImpl::HomeLauncherTransitionState::kMostlyShown
? shelf_size
: ShelfConfig::Get()->hidden_shelf_in_screen_portion();
} else if (state.visibility_state == SHELF_HIDDEN ||
......@@ -1892,8 +1892,8 @@ float ShelfLayoutManager::ComputeTargetOpacity(const State& state) const {
// The shelf should not become transparent during the animation to or from
// HomeLauncher.
if (chromeos::switches::ShouldShowShelfHotseat() && IsTabletModeEnabled() &&
Shell::Get()->app_list_controller()->home_launcher_animation_state() !=
AppListControllerImpl::HomeLauncherAnimationState::kFinished) {
Shell::Get()->app_list_controller()->home_launcher_transition_state() !=
AppListControllerImpl::HomeLauncherTransitionState::kFinished) {
return 1.0f;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment