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

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: Created 6 years, 11 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 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
486 UpdateVisibilityState(); 487 UpdateVisibilityState();
487 gesture_drag_status_ = GESTURE_DRAG_NONE; 488 gesture_drag_status_ = GESTURE_DRAG_NONE;
488 } 489 }
489 490
490 void ShelfLayoutManager::CancelGestureDrag() { 491 void ShelfLayoutManager::CancelGestureDrag() {
491 gesture_drag_status_ = GESTURE_DRAG_CANCEL_IN_PROGRESS; 492 gesture_drag_status_ = GESTURE_DRAG_CANCEL_IN_PROGRESS;
492 UpdateVisibilityState(); 493 UpdateVisibilityState();
493 gesture_drag_status_ = GESTURE_DRAG_NONE; 494 gesture_drag_status_ = GESTURE_DRAG_NONE;
494 } 495 }
495 496
497 void ShelfLayoutManager::SetAnimationDurationOverride(
498 int duration_override_in_ms) {
499 duration_override_in_ms_ = duration_override_in_ms;
500 }
501
496 //////////////////////////////////////////////////////////////////////////////// 502 ////////////////////////////////////////////////////////////////////////////////
497 // ShelfLayoutManager, aura::LayoutManager implementation: 503 // ShelfLayoutManager, aura::LayoutManager implementation:
498 504
499 void ShelfLayoutManager::OnWindowResized() { 505 void ShelfLayoutManager::OnWindowResized() {
500 LayoutShelf(); 506 LayoutShelf();
501 } 507 }
502 508
503 void ShelfLayoutManager::OnWindowAddedToLayout(aura::Window* child) { 509 void ShelfLayoutManager::OnWindowAddedToLayout(aura::Window* child) {
504 } 510 }
505 511
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
648 const TargetBounds& target_bounds, 654 const TargetBounds& target_bounds,
649 bool animate, 655 bool animate,
650 ui::ImplicitAnimationObserver* observer) { 656 ui::ImplicitAnimationObserver* observer) {
651 base::AutoReset<bool> auto_reset_updating_bounds(&updating_bounds_, true); 657 base::AutoReset<bool> auto_reset_updating_bounds(&updating_bounds_, true);
652 658
653 ui::ScopedLayerAnimationSettings shelf_animation_setter( 659 ui::ScopedLayerAnimationSettings shelf_animation_setter(
654 GetLayer(shelf_)->GetAnimator()); 660 GetLayer(shelf_)->GetAnimator());
655 ui::ScopedLayerAnimationSettings status_animation_setter( 661 ui::ScopedLayerAnimationSettings status_animation_setter(
656 GetLayer(shelf_->status_area_widget())->GetAnimator()); 662 GetLayer(shelf_->status_area_widget())->GetAnimator());
657 if (animate) { 663 if (animate) {
664 int duration = duration_override_in_ms_ ? duration_override_in_ms_ :
665 kCrossFadeDurationMS;
658 shelf_animation_setter.SetTransitionDuration( 666 shelf_animation_setter.SetTransitionDuration(
659 base::TimeDelta::FromMilliseconds(kCrossFadeDurationMS)); 667 base::TimeDelta::FromMilliseconds(duration));
660 shelf_animation_setter.SetTweenType(gfx::Tween::EASE_OUT); 668 shelf_animation_setter.SetTweenType(gfx::Tween::EASE_OUT);
661 shelf_animation_setter.SetPreemptionStrategy( 669 shelf_animation_setter.SetPreemptionStrategy(
662 ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET); 670 ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET);
663 status_animation_setter.SetTransitionDuration( 671 status_animation_setter.SetTransitionDuration(
664 base::TimeDelta::FromMilliseconds(kCrossFadeDurationMS)); 672 base::TimeDelta::FromMilliseconds(duration));
665 status_animation_setter.SetTweenType(gfx::Tween::EASE_OUT); 673 status_animation_setter.SetTweenType(gfx::Tween::EASE_OUT);
666 status_animation_setter.SetPreemptionStrategy( 674 status_animation_setter.SetPreemptionStrategy(
667 ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET); 675 ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET);
668 } else { 676 } else {
669 StopAnimating(); 677 StopAnimating();
670 shelf_animation_setter.SetTransitionDuration(base::TimeDelta()); 678 shelf_animation_setter.SetTransitionDuration(base::TimeDelta());
671 status_animation_setter.SetTransitionDuration(base::TimeDelta()); 679 status_animation_setter.SetTransitionDuration(base::TimeDelta());
672 } 680 }
673 if (observer) 681 if (observer)
674 status_animation_setter.AddObserver(observer); 682 status_animation_setter.AddObserver(observer);
(...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after
1157 return gfx::Insets(0, distance, 0, 0); 1165 return gfx::Insets(0, distance, 0, 0);
1158 case SHELF_ALIGNMENT_TOP: 1166 case SHELF_ALIGNMENT_TOP:
1159 return gfx::Insets(0, 0, distance, 0); 1167 return gfx::Insets(0, 0, distance, 0);
1160 } 1168 }
1161 NOTREACHED(); 1169 NOTREACHED();
1162 return gfx::Insets(); 1170 return gfx::Insets();
1163 } 1171 }
1164 1172
1165 } // namespace internal 1173 } // namespace internal
1166 } // namespace ash 1174 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698