| Index: ash/wm/app_list_controller.cc
|
| diff --git a/ash/wm/app_list_controller.cc b/ash/wm/app_list_controller.cc
|
| index a8c227b563ea664e7d12a19edef79e548e7847b9..6a2888f7c012cfa07fed0d84174f4e12f8cdc18a 100644
|
| --- a/ash/wm/app_list_controller.cc
|
| +++ b/ash/wm/app_list_controller.cc
|
| @@ -5,13 +5,10 @@
|
| #include "ash/wm/app_list_controller.h"
|
|
|
| #include "ash/ash_switches.h"
|
| -#include "ash/screen_ash.h"
|
| #include "ash/shell.h"
|
| #include "ash/shell_delegate.h"
|
| #include "ash/shell_window_ids.h"
|
| #include "ash/wm/shelf_layout_manager.h"
|
| -#include "ash/wm/window_util.h"
|
| -#include "base/command_line.h"
|
| #include "ui/app_list/app_list_view.h"
|
| #include "ui/app_list/icon_cache.h"
|
| #include "ui/aura/event.h"
|
| @@ -20,7 +17,6 @@
|
| #include "ui/aura/window.h"
|
| #include "ui/compositor/layer.h"
|
| #include "ui/compositor/scoped_layer_animation_settings.h"
|
| -#include "ui/gfx/screen.h"
|
| #include "ui/gfx/transform_util.h"
|
|
|
| namespace ash {
|
| @@ -30,33 +26,13 @@ namespace {
|
|
|
| const float kContainerAnimationScaleFactor = 1.05f;
|
|
|
| -// Duration for both default container and app list animation in milliseconds.
|
| -const int kAnimationDurationMs = 130;
|
| -
|
| -// Delayed time of 2nd animation in milliseconds.
|
| -const int kSecondAnimationStartDelay = kAnimationDurationMs - 20;
|
| +// Duration for show/hide animation in milliseconds.
|
| +const int kAnimationDurationMs = 150;
|
|
|
| ui::Layer* GetLayer(views::Widget* widget) {
|
| return widget->GetNativeView()->layer();
|
| }
|
|
|
| -// Bounds returned is used for full screen app list. Use full monitor rect
|
| -// so that the app list shade goes behind the launcher.
|
| -gfx::Rect GetFullScreenBoundsForWidget(views::Widget* widget) {
|
| - gfx::NativeView window = widget->GetNativeView();
|
| - return gfx::Screen::GetMonitorNearestWindow(window).bounds();
|
| -}
|
| -
|
| -// Return work area rect for full screen app list layout. This function is
|
| -// needed to get final work area in one shot instead of waiting for shelf
|
| -// animation to finish.
|
| -gfx::Rect GetWorkAreaBoundsForWidget(views::Widget* widget) {
|
| - gfx::NativeView window = widget->GetNativeView();
|
| - return Shell::GetInstance()->shelf()->IsVisible() ?
|
| - ScreenAsh::GetUnmaximizedWorkAreaBounds(window) :
|
| - gfx::Screen::GetMonitorNearestWindow(window).work_area();
|
| -}
|
| -
|
| // Gets arrow location based on shelf alignment.
|
| views::BubbleBorder::ArrowLocation GetBubbleArrowLocation() {
|
| DCHECK(Shell::HasInstance());
|
| @@ -91,12 +67,6 @@ AppListController::~AppListController() {
|
| Shell::GetInstance()->RemoveShellObserver(this);
|
| }
|
|
|
| -// static
|
| -bool AppListController::UseAppListV2() {
|
| - return CommandLine::ForCurrentProcess()->HasSwitch(
|
| - switches::kEnableAppListV2);
|
| -}
|
| -
|
| void AppListController::SetVisible(bool visible) {
|
| if (visible == is_visible_)
|
| return;
|
| @@ -114,19 +84,10 @@ void AppListController::SetVisible(bool visible) {
|
| // will be released with AppListView on close.
|
| app_list::AppListView* view = new app_list::AppListView(
|
| Shell::GetInstance()->delegate()->CreateAppListViewDelegate());
|
| - if (UseAppListV2()) {
|
| - view->InitAsBubble(
|
| - Shell::GetInstance()->GetContainer(kShellWindowId_AppListContainer),
|
| - Shell::GetInstance()->launcher()->GetAppListButtonView(),
|
| - GetBubbleArrowLocation());
|
| - } else {
|
| - views::Widget* launcher_widget =
|
| - Shell::GetInstance()->launcher()->widget();
|
| - view->InitAsFullscreenWidget(Shell::GetInstance()->GetContainer(
|
| - kShellWindowId_AppListContainer),
|
| - GetFullScreenBoundsForWidget(launcher_widget),
|
| - GetWorkAreaBoundsForWidget(launcher_widget));
|
| - }
|
| + view->InitAsBubble(
|
| + Shell::GetInstance()->GetContainer(kShellWindowId_AppListContainer),
|
| + Shell::GetInstance()->launcher()->GetAppListButtonView(),
|
| + GetBubbleArrowLocation());
|
| SetView(view);
|
| }
|
| }
|
| @@ -184,84 +145,17 @@ void AppListController::ScheduleAnimation() {
|
| // Stop observing previous animation.
|
| StopObservingImplicitAnimations();
|
|
|
| - ScheduleDimmingAnimation();
|
| -
|
| - // No browser window fading and app list secondary animation for v2.
|
| - if (UseAppListV2())
|
| - return;
|
| -
|
| - if (is_visible_) {
|
| - ScheduleBrowserWindowsAnimation();
|
| - second_animation_timer_.Start(
|
| - FROM_HERE,
|
| - base::TimeDelta::FromMilliseconds(kSecondAnimationStartDelay),
|
| - this,
|
| - &AppListController::ScheduleAppListAnimation);
|
| - } else {
|
| - ScheduleAppListAnimation();
|
| - second_animation_timer_.Start(
|
| - FROM_HERE,
|
| - base::TimeDelta::FromMilliseconds(kSecondAnimationStartDelay),
|
| - this,
|
| - &AppListController::ScheduleBrowserWindowsAnimation);
|
| - }
|
| -}
|
| -
|
| -void AppListController::ScheduleBrowserWindowsAnimationForContainer(
|
| - aura::Window* container) {
|
| - DCHECK(container);
|
| - ui::Layer* layer = container->layer();
|
| - layer->GetAnimator()->StopAnimating();
|
| -
|
| - ui::ScopedLayerAnimationSettings animation(layer->GetAnimator());
|
| - animation.SetTransitionDuration(
|
| - base::TimeDelta::FromMilliseconds(kAnimationDurationMs));
|
| - animation.SetTweenType(
|
| - is_visible_ ? ui::Tween::EASE_IN : ui::Tween::EASE_OUT);
|
| -
|
| - layer->SetOpacity(is_visible_ ? 0.0 : 1.0);
|
| - layer->SetTransform(is_visible_ ?
|
| - ui::GetScaleTransform(
|
| - gfx::Point(layer->bounds().width() / 2,
|
| - layer->bounds().height() / 2),
|
| - kContainerAnimationScaleFactor) :
|
| - ui::Transform());
|
| -}
|
| -
|
| -void AppListController::ScheduleBrowserWindowsAnimation() {
|
| - // Note: containers could be NULL during Shell shutdown.
|
| - aura::Window* default_container = Shell::GetInstance()->GetContainer(
|
| - kShellWindowId_DefaultContainer);
|
| - if (default_container)
|
| - ScheduleBrowserWindowsAnimationForContainer(default_container);
|
| - aura::Window* always_on_top_container = Shell::GetInstance()->
|
| - GetContainer(kShellWindowId_AlwaysOnTopContainer);
|
| - if (always_on_top_container)
|
| - ScheduleBrowserWindowsAnimationForContainer(always_on_top_container);
|
| -}
|
| -
|
| -void AppListController::ScheduleDimmingAnimation() {
|
| ui::Layer* layer = GetLayer(view_->GetWidget());
|
| layer->GetAnimator()->StopAnimating();
|
|
|
| - int duration = UseAppListV2() ?
|
| - kAnimationDurationMs : 2 * kAnimationDurationMs;
|
| -
|
| ui::ScopedLayerAnimationSettings animation(layer->GetAnimator());
|
| animation.SetTransitionDuration(
|
| - base::TimeDelta::FromMilliseconds(duration));
|
| + base::TimeDelta::FromMilliseconds(kAnimationDurationMs));
|
| animation.AddObserver(this);
|
|
|
| layer->SetOpacity(is_visible_ ? 1.0 : 0.0);
|
| }
|
|
|
| -void AppListController::ScheduleAppListAnimation() {
|
| - if (is_visible_)
|
| - view_->AnimateShow(kAnimationDurationMs);
|
| - else
|
| - view_->AnimateHide(kAnimationDurationMs);
|
| -}
|
| -
|
| ////////////////////////////////////////////////////////////////////////////////
|
| // AppListController, aura::EventFilter implementation:
|
|
|
| @@ -312,12 +206,8 @@ void AppListController::OnWindowFocused(aura::Window* window) {
|
| // AppListController, aura::RootWindowObserver implementation:
|
| void AppListController::OnRootWindowResized(const aura::RootWindow* root,
|
| const gfx::Size& old_size) {
|
| - if (view_ && is_visible_) {
|
| - views::Widget* launcher_widget =
|
| - Shell::GetInstance()->launcher()->widget();
|
| - view_->UpdateBounds(GetFullScreenBoundsForWidget(launcher_widget),
|
| - GetWorkAreaBoundsForWidget(launcher_widget));
|
| - }
|
| + if (view_ && is_visible_)
|
| + view_->UpdateBounds();
|
| }
|
|
|
| ////////////////////////////////////////////////////////////////////////////////
|
| @@ -343,7 +233,7 @@ void AppListController::OnWidgetClosing(views::Widget* widget) {
|
| ////////////////////////////////////////////////////////////////////////////////
|
| // AppListController, ShellObserver implementation:
|
| void AppListController::OnShelfAlignmentChanged() {
|
| - if (view_ && view_->bubble_style())
|
| + if (view_)
|
| view_->SetBubbleArrowLocation(GetBubbleArrowLocation());
|
| }
|
|
|
|
|