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

Unified Diff: ash/app_list/app_list.cc

Issue 10381018: ash: First pass of Applist v2. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ash/app_list/app_list.h ('k') | ash/app_list/app_list_bubble_border.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/app_list/app_list.cc
diff --git a/ash/app_list/app_list.cc b/ash/app_list/app_list.cc
index 7971973b0241bd10ed2d728600b627d2bfe7213c..f5fae714391c864da571a69ff655d0e38790596f 100644
--- a/ash/app_list/app_list.cc
+++ b/ash/app_list/app_list.cc
@@ -6,17 +6,18 @@
#include "ash/app_list/app_list_view.h"
#include "ash/app_list/icon_cache.h"
+#include "ash/ash_switches.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/aura/event.h"
#include "ui/aura/root_window.h"
#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 {
@@ -32,13 +33,6 @@ const int kAnimationDurationMs = 130;
// Delayed time of 2nd animation in milliseconds.
const int kSecondAnimationStartDelay = kAnimationDurationMs - 20;
-// Gets preferred bounds of app list window.
-gfx::Rect GetPreferredBounds() {
- gfx::Point cursor = gfx::Screen::GetCursorScreenPoint();
- // Use full monitor rect so that the app list shade goes behind the launcher.
- return gfx::Screen::GetMonitorNearestPoint(cursor).bounds();
-}
-
ui::Layer* GetLayer(views::Widget* widget) {
return widget->GetNativeView()->layer();
}
@@ -57,6 +51,12 @@ AppList::~AppList() {
IconCache::DeleteInstance();
}
+// static
+bool AppList::UseAppListV2() {
+ return CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kEnableAppListV2);
+}
+
void AppList::SetVisible(bool visible) {
if (visible == is_visible_)
return;
@@ -73,8 +73,7 @@ void AppList::SetVisible(bool visible) {
// AppListModel and AppListViewDelegate are owned by AppListView. They
// will be released with AppListView on close.
SetView(new AppListView(
- Shell::GetInstance()->delegate()->CreateAppListViewDelegate(),
- GetPreferredBounds()));
+ Shell::GetInstance()->delegate()->CreateAppListViewDelegate()));
}
}
@@ -132,6 +131,10 @@ void AppList::ScheduleAnimation() {
ScheduleDimmingAnimation();
+ // No browser window fading and app list secondary animation for v2.
+ if (UseAppListV2())
+ return;
+
if (is_visible_) {
ScheduleBrowserWindowsAnimation();
second_animation_timer_.Start(
@@ -187,9 +190,12 @@ void AppList::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(2 * kAnimationDurationMs));
+ base::TimeDelta::FromMilliseconds(duration));
animation.AddObserver(this);
layer->SetOpacity(is_visible_ ? 1.0 : 0.0);
@@ -236,8 +242,8 @@ ui::GestureStatus AppList::PreHandleGestureEvent(
// AppList, ura::RootWindowObserver implementation:
void AppList::OnRootWindowResized(const aura::RootWindow* root,
const gfx::Size& old_size) {
- if (view_&& is_visible_)
- view_->GetWidget()->SetBounds(gfx::Rect(root->bounds().size()));
+ if (view_ && is_visible_)
+ view_->UpdateBounds();
}
void AppList::OnWindowFocused(aura::Window* window) {
« no previous file with comments | « ash/app_list/app_list.h ('k') | ash/app_list/app_list_bubble_border.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698