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

Unified Diff: ash/wm/compact_layout_manager.cc

Issue 9388018: Compact layout mananger animates windows rather than the default container layer. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 10 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/wm/compact_layout_manager.cc
diff --git a/ash/wm/compact_layout_manager.cc b/ash/wm/compact_layout_manager.cc
index eacfbcd21036d2063d69b1954db51c91c9ce0578..49924746af4e4c3fd4f42f48434bb2586aef2900 100644
--- a/ash/wm/compact_layout_manager.cc
+++ b/ash/wm/compact_layout_manager.cc
@@ -10,6 +10,7 @@
#include "ash/shell_delegate.h"
#include "ash/shell_window_ids.h"
#include "ash/wm/window_util.h"
+#include "base/memory/scoped_vector.h"
#include "ui/aura/client/aura_constants.h"
#include "ui/aura/window.h"
#include "ui/gfx/compositor/scoped_layer_animation_settings.h"
@@ -39,14 +40,6 @@ bool ShouldAnimateOnEntrance(aura::Window* window) {
window_util::IsWindowMaximized(window);
}
-// Adjust layer bounds to grow or shrink in |delta_width|.
-void AdjustContainerLayerWidth(int delta_width) {
- gfx::Rect bounds(GetDefaultContainerLayer()->bounds());
- bounds.set_width(bounds.width() + delta_width);
- GetDefaultContainerLayer()->SetBounds(bounds);
- GetDefaultContainerLayer()->GetCompositor()->WidgetSizeChanged(
- GetDefaultContainerLayer()->bounds().size());
-}
} // namespace
/////////////////////////////////////////////////////////////////////////////
@@ -66,20 +59,11 @@ CompactLayoutManager::~CompactLayoutManager() {
void CompactLayoutManager::OnWindowAddedToLayout(aura::Window* child) {
BaseLayoutManager::OnWindowAddedToLayout(child);
UpdateStatusAreaVisibility();
- if (windows().size() > 1 &&
- child->type() == aura::client::WINDOW_TYPE_NORMAL) {
- // The first window is already contained in the current layer,
- // add subsequent windows to layer bounds calculation.
- AdjustContainerLayerWidth(child->bounds().width());
- }
}
void CompactLayoutManager::OnWillRemoveWindowFromLayout(aura::Window* child) {
BaseLayoutManager::OnWillRemoveWindowFromLayout(child);
UpdateStatusAreaVisibility();
- if (windows().size() > 1 && ShouldAnimateOnEntrance(child))
- AdjustContainerLayerWidth(-child->bounds().width());
-
if (child == current_window_) {
LayoutWindows(current_window_);
SwitchToReplacementWindow();
@@ -144,8 +128,7 @@ void CompactLayoutManager::OnWindowStackingChanged(aura::Window* window) {
// CompactLayoutManager, AnimationDelegate overrides:
void CompactLayoutManager::OnImplicitAnimationsCompleted() {
- if (!GetDefaultContainerLayer()->GetAnimator()->is_animating())
- HideWindows();
+ HideWindows();
}
//////////////////////////////////////////////////////////////////////////////
@@ -164,12 +147,24 @@ void CompactLayoutManager::UpdateStatusAreaVisibility() {
}
void CompactLayoutManager::AnimateSlideTo(int offset_x) {
- ui::ScopedLayerAnimationSettings settings(
- GetDefaultContainerLayer()->GetAnimator());
- settings.AddObserver(this);
+ // If we were waiting for another implicit animation to complete, forget
+ // about it since we're about to start observing a new animation.
+ StopObservingImplicitAnimations();
+ ScopedVector<ui::ScopedLayerAnimationSettings> settings;
sky 2012/02/13 22:21:13 Is there a reason you're creating this outside the
ui::Transform transform;
- transform.ConcatTranslate(-offset_x, 0);
- GetDefaultContainerLayer()->SetTransform(transform); // Will be animated!
+ transform.SetTranslateX(-offset_x);
+ ShellDelegate* shell_delegate = ash::Shell::GetInstance()->delegate();
+ const WindowList& windows_list = shell_delegate->GetCycleWindowList(
+ ShellDelegate::SOURCE_KEYBOARD,
+ ShellDelegate::ORDER_LINEAR);
+ for (WindowListConstIter const_it = windows_list.begin();
+ const_it != windows_list.end();
+ ++const_it) {
+ settings.push_back(new ui::ScopedLayerAnimationSettings(
+ (*const_it)->layer()->GetAnimator()));
+ settings[settings.size() - 1]->AddObserver(this);
+ (*const_it)->layer()->SetTransform(transform);
alicet1 2012/02/13 22:32:46 I'm not sure this will work properly -- this will
+ }
}
void CompactLayoutManager::LayoutWindows(aura::Window* skip) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698