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

Side by Side Diff: ash/shelf/shelf_layout_manager.cc

Issue 130983007: Creating multi profile animations for switching users and teleporting of windows. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed Created 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ash/shelf/shelf_layout_manager.h" 5 #include "ash/shelf/shelf_layout_manager.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 #include <cstring> 9 #include <cstring>
10 #include <string> 10 #include <string>
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 auto_hide_behavior_(SHELF_AUTO_HIDE_BEHAVIOR_NEVER), 200 auto_hide_behavior_(SHELF_AUTO_HIDE_BEHAVIOR_NEVER),
201 alignment_(SHELF_ALIGNMENT_BOTTOM), 201 alignment_(SHELF_ALIGNMENT_BOTTOM),
202 shelf_(shelf), 202 shelf_(shelf),
203 workspace_controller_(NULL), 203 workspace_controller_(NULL),
204 window_overlaps_shelf_(false), 204 window_overlaps_shelf_(false),
205 mouse_over_shelf_when_auto_hide_timer_started_(false), 205 mouse_over_shelf_when_auto_hide_timer_started_(false),
206 bezel_event_filter_(new ShelfBezelEventFilter(this)), 206 bezel_event_filter_(new ShelfBezelEventFilter(this)),
207 gesture_drag_status_(GESTURE_DRAG_NONE), 207 gesture_drag_status_(GESTURE_DRAG_NONE),
208 gesture_drag_amount_(0.f), 208 gesture_drag_amount_(0.f),
209 gesture_drag_auto_hide_state_(SHELF_AUTO_HIDE_SHOWN), 209 gesture_drag_auto_hide_state_(SHELF_AUTO_HIDE_SHOWN),
210 update_shelf_observer_(NULL) { 210 update_shelf_observer_(NULL),
211 duration_override_in_ms_(0) {
211 Shell::GetInstance()->AddShellObserver(this); 212 Shell::GetInstance()->AddShellObserver(this);
212 Shell::GetInstance()->lock_state_controller()->AddObserver(this); 213 Shell::GetInstance()->lock_state_controller()->AddObserver(this);
213 aura::client::GetActivationClient(root_window_)->AddObserver(this); 214 aura::client::GetActivationClient(root_window_)->AddObserver(this);
214 } 215 }
215 216
216 ShelfLayoutManager::~ShelfLayoutManager() { 217 ShelfLayoutManager::~ShelfLayoutManager() {
217 if (update_shelf_observer_) 218 if (update_shelf_observer_)
218 update_shelf_observer_->Detach(); 219 update_shelf_observer_->Detach();
219 220
220 FOR_EACH_OBSERVER(ShelfLayoutManagerObserver, observers_, WillDeleteShelf()); 221 FOR_EACH_OBSERVER(ShelfLayoutManagerObserver, observers_, WillDeleteShelf());
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
491 UpdateVisibilityState(); 492 UpdateVisibilityState();
492 gesture_drag_status_ = GESTURE_DRAG_NONE; 493 gesture_drag_status_ = GESTURE_DRAG_NONE;
493 } 494 }
494 495
495 void ShelfLayoutManager::CancelGestureDrag() { 496 void ShelfLayoutManager::CancelGestureDrag() {
496 gesture_drag_status_ = GESTURE_DRAG_CANCEL_IN_PROGRESS; 497 gesture_drag_status_ = GESTURE_DRAG_CANCEL_IN_PROGRESS;
497 UpdateVisibilityState(); 498 UpdateVisibilityState();
498 gesture_drag_status_ = GESTURE_DRAG_NONE; 499 gesture_drag_status_ = GESTURE_DRAG_NONE;
499 } 500 }
500 501
502 void ShelfLayoutManager::SetAnimationDurationOverride(
503 int duration_override_in_ms) {
504 duration_override_in_ms_ = duration_override_in_ms;
505 }
506
501 //////////////////////////////////////////////////////////////////////////////// 507 ////////////////////////////////////////////////////////////////////////////////
502 // ShelfLayoutManager, aura::LayoutManager implementation: 508 // ShelfLayoutManager, aura::LayoutManager implementation:
503 509
504 void ShelfLayoutManager::OnWindowResized() { 510 void ShelfLayoutManager::OnWindowResized() {
505 LayoutShelf(); 511 LayoutShelf();
506 } 512 }
507 513
508 void ShelfLayoutManager::OnWindowAddedToLayout(aura::Window* child) { 514 void ShelfLayoutManager::OnWindowAddedToLayout(aura::Window* child) {
509 } 515 }
510 516
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
653 const TargetBounds& target_bounds, 659 const TargetBounds& target_bounds,
654 bool animate, 660 bool animate,
655 ui::ImplicitAnimationObserver* observer) { 661 ui::ImplicitAnimationObserver* observer) {
656 base::AutoReset<bool> auto_reset_updating_bounds(&updating_bounds_, true); 662 base::AutoReset<bool> auto_reset_updating_bounds(&updating_bounds_, true);
657 663
658 ui::ScopedLayerAnimationSettings shelf_animation_setter( 664 ui::ScopedLayerAnimationSettings shelf_animation_setter(
659 GetLayer(shelf_)->GetAnimator()); 665 GetLayer(shelf_)->GetAnimator());
660 ui::ScopedLayerAnimationSettings status_animation_setter( 666 ui::ScopedLayerAnimationSettings status_animation_setter(
661 GetLayer(shelf_->status_area_widget())->GetAnimator()); 667 GetLayer(shelf_->status_area_widget())->GetAnimator());
662 if (animate) { 668 if (animate) {
669 int duration = duration_override_in_ms_ ? duration_override_in_ms_ :
670 kCrossFadeDurationMS;
663 shelf_animation_setter.SetTransitionDuration( 671 shelf_animation_setter.SetTransitionDuration(
664 base::TimeDelta::FromMilliseconds(kCrossFadeDurationMS)); 672 base::TimeDelta::FromMilliseconds(duration));
665 shelf_animation_setter.SetTweenType(gfx::Tween::EASE_OUT); 673 shelf_animation_setter.SetTweenType(gfx::Tween::EASE_OUT);
666 shelf_animation_setter.SetPreemptionStrategy( 674 shelf_animation_setter.SetPreemptionStrategy(
667 ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET); 675 ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET);
668 status_animation_setter.SetTransitionDuration( 676 status_animation_setter.SetTransitionDuration(
669 base::TimeDelta::FromMilliseconds(kCrossFadeDurationMS)); 677 base::TimeDelta::FromMilliseconds(duration));
670 status_animation_setter.SetTweenType(gfx::Tween::EASE_OUT); 678 status_animation_setter.SetTweenType(gfx::Tween::EASE_OUT);
671 status_animation_setter.SetPreemptionStrategy( 679 status_animation_setter.SetPreemptionStrategy(
672 ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET); 680 ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET);
673 } else { 681 } else {
674 StopAnimating(); 682 StopAnimating();
675 shelf_animation_setter.SetTransitionDuration(base::TimeDelta()); 683 shelf_animation_setter.SetTransitionDuration(base::TimeDelta());
676 status_animation_setter.SetTransitionDuration(base::TimeDelta()); 684 status_animation_setter.SetTransitionDuration(base::TimeDelta());
677 } 685 }
678 if (observer) 686 if (observer)
679 status_animation_setter.AddObserver(observer); 687 status_animation_setter.AddObserver(observer);
(...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after
1162 return gfx::Insets(0, distance, 0, 0); 1170 return gfx::Insets(0, distance, 0, 0);
1163 case SHELF_ALIGNMENT_TOP: 1171 case SHELF_ALIGNMENT_TOP:
1164 return gfx::Insets(0, 0, distance, 0); 1172 return gfx::Insets(0, 0, distance, 0);
1165 } 1173 }
1166 NOTREACHED(); 1174 NOTREACHED();
1167 return gfx::Insets(); 1175 return gfx::Insets();
1168 } 1176 }
1169 1177
1170 } // namespace internal 1178 } // namespace internal
1171 } // namespace ash 1179 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698