summaryrefslogtreecommitdiffstats
path: root/ash
diff options
context:
space:
mode:
authorxiyuan@chromium.org <xiyuan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-06-07 05:16:02 +0000
committerxiyuan@chromium.org <xiyuan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-06-07 05:16:02 +0000
commitf5f3c7576ee8867b562afe4c7e91820eea853730 (patch)
tree1bc99a1790b9ad2d4e66a5683c5f245b495856bb /ash
parent9d9e7fa13a2adb5aa74eeff6e51651ff62205ab8 (diff)
downloadchromium_src-f5f3c7576ee8867b562afe4c7e91820eea853730.zip
chromium_src-f5f3c7576ee8867b562afe4c7e91820eea853730.tar.gz
chromium_src-f5f3c7576ee8867b562afe4c7e91820eea853730.tar.bz2
Reland 140878 - cleanup: Remove applist v1 code.
- Remove obsolete v1 code and test; - Grid rid of selected_ in AppListItemModel and solely use selected_item_index_ in AppsGridView; - Fix a bug that highlighted item might not be visible and add test to cover it; - Update DEPS; - Fix broken ExtensionInstallUIBrowserTest.AppInstallConfirmation casued by wrong destruction order introduced by r140878 moving app list container on top of launcher container. Fix is to explicitly release app list contoller before launcher container. BUG=125964 TEST=Verify app list always show up as bubble and app_list_unittests should pass. Review URL: https://chromiumcodereview.appspot.com/10533032 TBR=sky@chromium.org Review URL: https://chromiumcodereview.appspot.com/10539038 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@140959 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash')
-rw-r--r--ash/ash_switches.cc3
-rw-r--r--ash/ash_switches.h1
-rw-r--r--ash/shell.cc24
-rw-r--r--ash/wm/app_list_controller.cc130
-rw-r--r--ash/wm/app_list_controller.h18
5 files changed, 20 insertions, 156 deletions
diff --git a/ash/ash_switches.cc b/ash/ash_switches.cc
index 9626f03..e83b02c 100644
--- a/ash/ash_switches.cc
+++ b/ash/ash_switches.cc
@@ -34,8 +34,5 @@ const char kAuraNoShadows[] = "aura-no-shadows";
// Use Aura to manage windows of type WINDOW_TYPE_PANEL.
const char kAuraPanelManager[] = "aura-panels";
-// Enables applist v2.
-const char kEnableAppListV2[] = "enable-applist-v2";
-
} // namespace switches
} // namespace ash
diff --git a/ash/ash_switches.h b/ash/ash_switches.h
index 4edbd0d..14eb279 100644
--- a/ash/ash_switches.h
+++ b/ash/ash_switches.h
@@ -24,7 +24,6 @@ ASH_EXPORT extern const char kAuraGoogleDialogFrames[];
ASH_EXPORT extern const char kAuraLegacyPowerButton[];
ASH_EXPORT extern const char kAuraNoShadows[];
ASH_EXPORT extern const char kAuraPanelManager[];
-ASH_EXPORT extern const char kEnableAppListV2[];
} // namespace switches
} // namespace ash
diff --git a/ash/shell.cc b/ash/shell.cc
index 1da2922..f1f72fd 100644
--- a/ash/shell.cc
+++ b/ash/shell.cc
@@ -173,24 +173,13 @@ void CreateSpecialContainers(aura::RootWindow* root_window) {
"PanelContainer",
non_lock_screen_containers);
- // V1 Applist container is below launcher container.
- bool use_v2_applist = internal::AppListController::UseAppListV2();
- if (!use_v2_applist) {
- CreateContainer(internal::kShellWindowId_AppListContainer,
- "AppListContainer",
- non_lock_screen_containers);
- }
-
CreateContainer(internal::kShellWindowId_LauncherContainer,
"LauncherContainer",
non_lock_screen_containers);
- // V2 Applist container is above launcher container.
- if (use_v2_applist) {
- CreateContainer(internal::kShellWindowId_AppListContainer,
- "AppListContainer",
- non_lock_screen_containers);
- }
+ CreateContainer(internal::kShellWindowId_AppListContainer,
+ "AppListContainer",
+ non_lock_screen_containers);
aura::Window* modal_container = CreateContainer(
internal::kShellWindowId_SystemModalContainer,
@@ -618,6 +607,12 @@ Shell::~Shell() {
system_tray_.reset();
tray_delegate_.reset();
+ // AppList needs to be released before shelf layout manager, which is
+ // destroyed with launcher container in the loop below. However, app list
+ // container is now on top of launcher container and released after it.
+ // TODO(xiyuan): Move it back when app list container is no longer needed.
+ app_list_controller_.reset();
+
// Destroy secondary monitor's widgets before all the windows are destroyed.
monitor_controller_.reset();
@@ -632,7 +627,6 @@ Shell::~Shell() {
// These need a valid Shell instance to clean up properly, so explicitly
// delete them before invalidating the instance.
// Alphabetical.
- app_list_controller_.reset();
drag_drop_controller_.reset();
event_client_.reset();
magnification_controller_.reset();
diff --git a/ash/wm/app_list_controller.cc b/ash/wm/app_list_controller.cc
index a8c227b..6a2888f 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());
}
diff --git a/ash/wm/app_list_controller.h b/ash/wm/app_list_controller.h
index bf6e863..d464841 100644
--- a/ash/wm/app_list_controller.h
+++ b/ash/wm/app_list_controller.h
@@ -37,9 +37,6 @@ class AppListController : public aura::EventFilter,
AppListController();
virtual ~AppListController();
- // Returns true if AppListV2 is enabled.
- static bool UseAppListV2();
-
// Show/hide app list window.
void SetVisible(bool visible);
@@ -61,22 +58,9 @@ class AppListController : public aura::EventFilter,
// Forgets the view.
void ResetView();
- // Starts show/hide animation. ScheduleAnimation is the master who manages
- // when to call sub animations. There are three sub animations: background
- // dimming, browser windows scale/fade and app list scale/fade. The background
- // dimming runs in parallel with the other two and spans the whole animation
- // time. The rest sub animations run in two steps. On showing, the first step
- // is browser windows scale-out and fade-out and the 2nd step is app list
- // scale-in and fade-in. The 2nd step animation is started via a timer and
- // there is is a little overlap between the two animations. Hiding animation
- // is the reverse of the showing animation.
+ // Starts show/hide animation.
void ScheduleAnimation();
- void ScheduleBrowserWindowsAnimationForContainer(aura::Window* container);
- void ScheduleBrowserWindowsAnimation();
- void ScheduleDimmingAnimation();
- void ScheduleAppListAnimation();
-
// aura::EventFilter overrides:
virtual bool PreHandleKeyEvent(aura::Window* target,
aura::KeyEvent* event) OVERRIDE;