OLD | NEW |
---|---|
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 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
187 // Shelf we're in. NULL if deleted before we're deleted. | 187 // Shelf we're in. NULL if deleted before we're deleted. |
188 ShelfLayoutManager* shelf_; | 188 ShelfLayoutManager* shelf_; |
189 | 189 |
190 DISALLOW_COPY_AND_ASSIGN(UpdateShelfObserver); | 190 DISALLOW_COPY_AND_ASSIGN(UpdateShelfObserver); |
191 }; | 191 }; |
192 | 192 |
193 // ShelfLayoutManager ---------------------------------------------------------- | 193 // ShelfLayoutManager ---------------------------------------------------------- |
194 | 194 |
195 ShelfLayoutManager::ShelfLayoutManager(ShelfWidget* shelf) | 195 ShelfLayoutManager::ShelfLayoutManager(ShelfWidget* shelf) |
196 : root_window_(shelf->GetNativeView()->GetRootWindow()), | 196 : root_window_(shelf->GetNativeView()->GetRootWindow()), |
197 in_layout_(false), | 197 updating_bounds_(false), |
198 auto_hide_behavior_(SHELF_AUTO_HIDE_BEHAVIOR_NEVER), | 198 auto_hide_behavior_(SHELF_AUTO_HIDE_BEHAVIOR_NEVER), |
199 alignment_(SHELF_ALIGNMENT_BOTTOM), | 199 alignment_(SHELF_ALIGNMENT_BOTTOM), |
200 shelf_(shelf), | 200 shelf_(shelf), |
201 workspace_controller_(NULL), | 201 workspace_controller_(NULL), |
202 window_overlaps_shelf_(false), | 202 window_overlaps_shelf_(false), |
203 mouse_over_shelf_when_auto_hide_timer_started_(false), | 203 mouse_over_shelf_when_auto_hide_timer_started_(false), |
204 bezel_event_filter_(new ShelfBezelEventFilter(this)), | 204 bezel_event_filter_(new ShelfBezelEventFilter(this)), |
205 gesture_drag_status_(GESTURE_DRAG_NONE), | 205 gesture_drag_status_(GESTURE_DRAG_NONE), |
206 gesture_drag_amount_(0.f), | 206 gesture_drag_amount_(0.f), |
207 gesture_drag_auto_hide_state_(SHELF_AUTO_HIDE_SHOWN), | 207 gesture_drag_auto_hide_state_(SHELF_AUTO_HIDE_SHOWN), |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
262 int width = 0, height = 0; | 262 int width = 0, height = 0; |
263 GetShelfSize(&width, &height); | 263 GetShelfSize(&width, &height); |
264 return SelectValueForShelfAlignment( | 264 return SelectValueForShelfAlignment( |
265 gfx::Rect(bounds.x(), bounds.bottom() - height, bounds.width(), height), | 265 gfx::Rect(bounds.x(), bounds.bottom() - height, bounds.width(), height), |
266 gfx::Rect(bounds.x(), bounds.y(), width, bounds.height()), | 266 gfx::Rect(bounds.x(), bounds.y(), width, bounds.height()), |
267 gfx::Rect(bounds.right() - width, bounds.y(), width, bounds.height()), | 267 gfx::Rect(bounds.right() - width, bounds.y(), width, bounds.height()), |
268 gfx::Rect(bounds.x(), bounds.y(), bounds.width(), height)); | 268 gfx::Rect(bounds.x(), bounds.y(), bounds.width(), height)); |
269 } | 269 } |
270 | 270 |
271 void ShelfLayoutManager::LayoutShelf() { | 271 void ShelfLayoutManager::LayoutShelf() { |
272 base::AutoReset<bool> auto_reset_in_layout(&in_layout_, true); | |
273 StopAnimating(); | |
274 TargetBounds target_bounds; | 272 TargetBounds target_bounds; |
275 CalculateTargetBounds(state_, &target_bounds); | 273 CalculateTargetBounds(state_, &target_bounds); |
276 GetLayer(shelf_)->SetOpacity(target_bounds.opacity); | 274 UpdateBoundsAndOpacity(target_bounds, false, NULL); |
277 shelf_->SetWidgetBounds( | 275 |
278 ScreenAsh::ConvertRectToScreen( | 276 if (shelf_->launcher()) { |
279 shelf_->GetNativeView()->parent(), | 277 // This is not part of UpdateBoundsAndOpacity() because |
280 target_bounds.shelf_bounds_in_root)); | 278 // SetLauncherViewBounds() sets the bounds immediately and does not animate. |
281 if (shelf_->launcher()) | 279 // The height of the LauncherView for a horizontal shelf and the width of |
280 // the LauncherView for a vertical shelf are set when |shelf_|'s bounds | |
281 // are changed via UpdateBoundsAndOpacity(). This sets the bounds in the | |
282 // other direction. | |
pkotwicz
2013/08/09 02:56:03
I do not call SetLauncherViewBounds() in UpateBoun
| |
282 shelf_->launcher()->SetLauncherViewBounds( | 283 shelf_->launcher()->SetLauncherViewBounds( |
283 target_bounds.launcher_bounds_in_shelf); | 284 target_bounds.launcher_bounds_in_shelf); |
284 GetLayer(shelf_->status_area_widget())->SetOpacity( | 285 } |
285 target_bounds.status_opacity); | |
286 // TODO(harrym): Once status area widget is a child view of shelf | |
287 // this can be simplified. | |
288 gfx::Rect status_bounds = target_bounds.status_bounds_in_shelf; | |
289 status_bounds.set_x(status_bounds.x() + | |
290 target_bounds.shelf_bounds_in_root.x()); | |
291 status_bounds.set_y(status_bounds.y() + | |
292 target_bounds.shelf_bounds_in_root.y()); | |
293 shelf_->status_area_widget()->SetBounds( | |
294 ScreenAsh::ConvertRectToScreen( | |
295 shelf_->status_area_widget()->GetNativeView()->parent(), | |
296 status_bounds)); | |
297 Shell::GetInstance()->SetDisplayWorkAreaInsets( | |
298 root_window_, target_bounds.work_area_insets); | |
299 UpdateHitTestBounds(); | |
300 } | 286 } |
301 | 287 |
302 ShelfVisibilityState ShelfLayoutManager::CalculateShelfVisibility() { | 288 ShelfVisibilityState ShelfLayoutManager::CalculateShelfVisibility() { |
303 switch(auto_hide_behavior_) { | 289 switch(auto_hide_behavior_) { |
304 case SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS: | 290 case SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS: |
305 return SHELF_AUTO_HIDE; | 291 return SHELF_AUTO_HIDE; |
306 case SHELF_AUTO_HIDE_BEHAVIOR_NEVER: | 292 case SHELF_AUTO_HIDE_BEHAVIOR_NEVER: |
307 return SHELF_VISIBLE; | 293 return SHELF_VISIBLE; |
308 case SHELF_AUTO_HIDE_ALWAYS_HIDDEN: | 294 case SHELF_AUTO_HIDE_ALWAYS_HIDDEN: |
309 return SHELF_HIDDEN; | 295 return SHELF_HIDDEN; |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
471 // In fullscreen with minimal chrome, the auto hide behavior affects neither | 457 // In fullscreen with minimal chrome, the auto hide behavior affects neither |
472 // the visibility state nor the auto hide state. Set |gesture_drag_status_| | 458 // the visibility state nor the auto hide state. Set |gesture_drag_status_| |
473 // to GESTURE_DRAG_COMPLETE_IN_PROGRESS to set the auto hide state to | 459 // to GESTURE_DRAG_COMPLETE_IN_PROGRESS to set the auto hide state to |
474 // |gesture_drag_auto_hide_state_|. | 460 // |gesture_drag_auto_hide_state_|. |
475 gesture_drag_status_ = GESTURE_DRAG_COMPLETE_IN_PROGRESS; | 461 gesture_drag_status_ = GESTURE_DRAG_COMPLETE_IN_PROGRESS; |
476 if (auto_hide_behavior_ != new_auto_hide_behavior) | 462 if (auto_hide_behavior_ != new_auto_hide_behavior) |
477 SetAutoHideBehavior(new_auto_hide_behavior); | 463 SetAutoHideBehavior(new_auto_hide_behavior); |
478 else | 464 else |
479 UpdateVisibilityState(); | 465 UpdateVisibilityState(); |
480 gesture_drag_status_ = GESTURE_DRAG_NONE; | 466 gesture_drag_status_ = GESTURE_DRAG_NONE; |
481 LayoutShelf(); | |
482 } | 467 } |
483 | 468 |
484 void ShelfLayoutManager::CancelGestureDrag() { | 469 void ShelfLayoutManager::CancelGestureDrag() { |
470 gesture_drag_status_ = GESTURE_DRAG_CANCEL_IN_PROGRESS; | |
471 UpdateVisibilityState(); | |
485 gesture_drag_status_ = GESTURE_DRAG_NONE; | 472 gesture_drag_status_ = GESTURE_DRAG_NONE; |
486 ui::ScopedLayerAnimationSettings | |
487 launcher_settings(GetLayer(shelf_)->GetAnimator()), | |
488 status_settings(GetLayer(shelf_->status_area_widget())->GetAnimator()); | |
489 LayoutShelf(); | |
490 UpdateVisibilityState(); | |
491 UpdateShelfBackground(BackgroundAnimator::CHANGE_ANIMATE); | |
492 } | 473 } |
493 | 474 |
494 //////////////////////////////////////////////////////////////////////////////// | 475 //////////////////////////////////////////////////////////////////////////////// |
495 // ShelfLayoutManager, aura::LayoutManager implementation: | 476 // ShelfLayoutManager, aura::LayoutManager implementation: |
496 | 477 |
497 void ShelfLayoutManager::OnWindowResized() { | 478 void ShelfLayoutManager::OnWindowResized() { |
498 LayoutShelf(); | 479 LayoutShelf(); |
499 } | 480 } |
500 | 481 |
501 void ShelfLayoutManager::OnWindowAddedToLayout(aura::Window* child) { | 482 void ShelfLayoutManager::OnWindowAddedToLayout(aura::Window* child) { |
502 } | 483 } |
503 | 484 |
504 void ShelfLayoutManager::OnWillRemoveWindowFromLayout(aura::Window* child) { | 485 void ShelfLayoutManager::OnWillRemoveWindowFromLayout(aura::Window* child) { |
505 } | 486 } |
506 | 487 |
507 void ShelfLayoutManager::OnWindowRemovedFromLayout(aura::Window* child) { | 488 void ShelfLayoutManager::OnWindowRemovedFromLayout(aura::Window* child) { |
508 } | 489 } |
509 | 490 |
510 void ShelfLayoutManager::OnChildWindowVisibilityChanged(aura::Window* child, | 491 void ShelfLayoutManager::OnChildWindowVisibilityChanged(aura::Window* child, |
511 bool visible) { | 492 bool visible) { |
512 } | 493 } |
513 | 494 |
514 void ShelfLayoutManager::SetChildBounds(aura::Window* child, | 495 void ShelfLayoutManager::SetChildBounds(aura::Window* child, |
515 const gfx::Rect& requested_bounds) { | 496 const gfx::Rect& requested_bounds) { |
516 SetChildBoundsDirect(child, requested_bounds); | 497 SetChildBoundsDirect(child, requested_bounds); |
517 // We may contain other widgets (such as frame maximize bubble) but they don't | 498 // We may contain other widgets (such as frame maximize bubble) but they don't |
518 // effect the layout in anyway. | 499 // effect the layout in anyway. |
519 if (!in_layout_ && | 500 if (!updating_bounds_ && |
520 ((shelf_->GetNativeView() == child) || | 501 ((shelf_->GetNativeView() == child) || |
521 (shelf_->status_area_widget()->GetNativeView() == child))) { | 502 (shelf_->status_area_widget()->GetNativeView() == child))) { |
522 LayoutShelf(); | 503 LayoutShelf(); |
523 } | 504 } |
524 } | 505 } |
525 | 506 |
526 void ShelfLayoutManager::OnLockStateChanged(bool locked) { | 507 void ShelfLayoutManager::OnLockStateChanged(bool locked) { |
527 UpdateVisibilityState(); | 508 UpdateVisibilityState(); |
528 } | 509 } |
529 | 510 |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
566 return; | 547 return; |
567 | 548 |
568 State state; | 549 State state; |
569 state.visibility_state = visibility_state; | 550 state.visibility_state = visibility_state; |
570 state.auto_hide_state = CalculateAutoHideState(visibility_state); | 551 state.auto_hide_state = CalculateAutoHideState(visibility_state); |
571 state.is_screen_locked = | 552 state.is_screen_locked = |
572 Shell::GetInstance()->session_state_delegate()->IsScreenLocked(); | 553 Shell::GetInstance()->session_state_delegate()->IsScreenLocked(); |
573 state.window_state = workspace_controller_ ? | 554 state.window_state = workspace_controller_ ? |
574 workspace_controller_->GetWindowState() : WORKSPACE_WINDOW_STATE_DEFAULT; | 555 workspace_controller_->GetWindowState() : WORKSPACE_WINDOW_STATE_DEFAULT; |
575 | 556 |
576 if (state_.Equals(state)) | 557 // Force an update because gesture drags affect the shelf bounds and we |
558 // should animate back to the normal bounds at the end of a gesture. | |
559 bool force_update = | |
560 (gesture_drag_status_ == GESTURE_DRAG_CANCEL_IN_PROGRESS || | |
561 gesture_drag_status_ == GESTURE_DRAG_COMPLETE_IN_PROGRESS); | |
562 | |
563 if (!force_update && state_.Equals(state)) | |
577 return; // Nothing changed. | 564 return; // Nothing changed. |
578 | 565 |
579 FOR_EACH_OBSERVER(ShelfLayoutManagerObserver, observers_, | 566 FOR_EACH_OBSERVER(ShelfLayoutManagerObserver, observers_, |
580 WillChangeVisibilityState(visibility_state)); | 567 WillChangeVisibilityState(visibility_state)); |
581 | 568 |
582 if (state.visibility_state == SHELF_AUTO_HIDE) { | 569 if (state.visibility_state == SHELF_AUTO_HIDE) { |
583 // When state is SHELF_AUTO_HIDE we need to track when the mouse is over the | 570 // When state is SHELF_AUTO_HIDE we need to track when the mouse is over the |
584 // launcher to unhide the shelf. AutoHideEventFilter does that for us. | 571 // launcher to unhide the shelf. AutoHideEventFilter does that for us. |
585 if (!auto_hide_event_filter_) | 572 if (!auto_hide_event_filter_) |
586 auto_hide_event_filter_.reset(new AutoHideEventFilter(this)); | 573 auto_hide_event_filter_.reset(new AutoHideEventFilter(this)); |
587 } else { | 574 } else { |
588 auto_hide_event_filter_.reset(NULL); | 575 auto_hide_event_filter_.reset(NULL); |
589 } | 576 } |
590 | 577 |
591 StopAutoHideTimer(); | 578 StopAutoHideTimer(); |
592 | 579 |
593 State old_state = state_; | 580 State old_state = state_; |
594 state_ = state; | 581 state_ = state; |
595 TargetBounds target_bounds; | |
596 CalculateTargetBounds(state_, &target_bounds); | |
597 | |
598 ui::ScopedLayerAnimationSettings launcher_animation_setter( | |
599 GetLayer(shelf_)->GetAnimator()); | |
600 launcher_animation_setter.SetTransitionDuration( | |
601 base::TimeDelta::FromMilliseconds(kCrossFadeDurationMS)); | |
602 launcher_animation_setter.SetTweenType(ui::Tween::EASE_OUT); | |
603 launcher_animation_setter.SetPreemptionStrategy( | |
604 ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET); | |
605 GetLayer(shelf_)->SetBounds( | |
606 target_bounds.shelf_bounds_in_root); | |
607 GetLayer(shelf_)->SetOpacity(target_bounds.opacity); | |
608 ui::ScopedLayerAnimationSettings status_animation_setter( | |
609 GetLayer(shelf_->status_area_widget())->GetAnimator()); | |
610 status_animation_setter.SetTransitionDuration( | |
611 base::TimeDelta::FromMilliseconds(kCrossFadeDurationMS)); | |
612 status_animation_setter.SetTweenType(ui::Tween::EASE_OUT); | |
613 status_animation_setter.SetPreemptionStrategy( | |
614 ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET); | |
615 | 582 |
616 BackgroundAnimator::ChangeType change_type = | 583 BackgroundAnimator::ChangeType change_type = |
617 BackgroundAnimator::CHANGE_ANIMATE; | 584 BackgroundAnimator::CHANGE_ANIMATE; |
618 bool delay_background_change = false; | 585 bool delay_background_change = false; |
619 | 586 |
620 // Do not animate the background when: | 587 // Do not animate the background when: |
621 // - Going from a hidden / auto hidden shelf in fullscreen to a visible shelf | 588 // - Going from a hidden / auto hidden shelf in fullscreen to a visible shelf |
622 // in maximized mode. | 589 // in maximized mode. |
623 // - Going from an auto hidden shelf in maximized mode to a visible shelf in | 590 // - Going from an auto hidden shelf in maximized mode to a visible shelf in |
624 // maximized mode. | 591 // maximized mode. |
625 if (state.visibility_state == SHELF_VISIBLE && | 592 if (state.visibility_state == SHELF_VISIBLE && |
626 state.window_state == WORKSPACE_WINDOW_STATE_MAXIMIZED && | 593 state.window_state == WORKSPACE_WINDOW_STATE_MAXIMIZED && |
627 old_state.visibility_state != SHELF_VISIBLE) { | 594 old_state.visibility_state != SHELF_VISIBLE) { |
628 change_type = BackgroundAnimator::CHANGE_IMMEDIATE; | 595 change_type = BackgroundAnimator::CHANGE_IMMEDIATE; |
629 } else { | 596 } else { |
630 // Delay the animation when the shelf was hidden, and has just been made | 597 // Delay the animation when the shelf was hidden, and has just been made |
631 // visible (e.g. using a gesture-drag). | 598 // visible (e.g. using a gesture-drag). |
632 if (state.visibility_state == SHELF_VISIBLE && | 599 if (state.visibility_state == SHELF_VISIBLE && |
633 old_state.visibility_state == SHELF_AUTO_HIDE && | 600 old_state.visibility_state == SHELF_AUTO_HIDE && |
634 old_state.auto_hide_state == SHELF_AUTO_HIDE_HIDDEN) { | 601 old_state.auto_hide_state == SHELF_AUTO_HIDE_HIDDEN) { |
635 delay_background_change = true; | 602 delay_background_change = true; |
636 } | 603 } |
637 } | 604 } |
638 | 605 |
639 if (delay_background_change) { | 606 if (delay_background_change) { |
640 if (update_shelf_observer_) | 607 if (update_shelf_observer_) |
641 update_shelf_observer_->Detach(); | 608 update_shelf_observer_->Detach(); |
642 // UpdateShelfBackground deletes itself when the animation is done. | 609 // UpdateShelfBackground deletes itself when the animation is done. |
643 update_shelf_observer_ = new UpdateShelfObserver(this); | 610 update_shelf_observer_ = new UpdateShelfObserver(this); |
644 status_animation_setter.AddObserver(update_shelf_observer_); | |
645 } else { | 611 } else { |
646 UpdateShelfBackground(change_type); | 612 UpdateShelfBackground(change_type); |
647 } | 613 } |
648 | 614 |
649 shelf_->SetDimsShelf( | 615 shelf_->SetDimsShelf( |
650 (state.visibility_state == SHELF_VISIBLE) && | 616 (state.visibility_state == SHELF_VISIBLE) && |
651 state.window_state == WORKSPACE_WINDOW_STATE_MAXIMIZED); | 617 state.window_state == WORKSPACE_WINDOW_STATE_MAXIMIZED); |
652 | 618 |
653 ui::Layer* layer = GetLayer(shelf_->status_area_widget()); | 619 TargetBounds target_bounds; |
654 // TODO(harrym): Remove when status_area is view (crbug.com/180422). | 620 CalculateTargetBounds(state_, &target_bounds); |
655 gfx::Rect status_bounds = target_bounds.status_bounds_in_shelf; | 621 UpdateBoundsAndOpacity(target_bounds, true, |
656 status_bounds.set_x(status_bounds.x() + | 622 delay_background_change ? update_shelf_observer_ : NULL); |
657 target_bounds.shelf_bounds_in_root.x()); | |
658 status_bounds.set_y(status_bounds.y() + | |
659 target_bounds.shelf_bounds_in_root.y()); | |
660 layer->SetBounds(status_bounds); | |
661 layer->SetOpacity(target_bounds.status_opacity); | |
662 Shell::GetInstance()->SetDisplayWorkAreaInsets( | |
663 root_window_, target_bounds.work_area_insets); | |
664 UpdateHitTestBounds(); | |
665 | 623 |
666 // OnAutoHideStateChanged Should be emitted when: | 624 // OnAutoHideStateChanged Should be emitted when: |
667 // - firstly state changed to auto-hide from other state | 625 // - firstly state changed to auto-hide from other state |
668 // - or, auto_hide_state has changed | 626 // - or, auto_hide_state has changed |
669 if ((old_state.visibility_state != state_.visibility_state && | 627 if ((old_state.visibility_state != state_.visibility_state && |
670 state_.visibility_state == SHELF_AUTO_HIDE) || | 628 state_.visibility_state == SHELF_AUTO_HIDE) || |
671 old_state.auto_hide_state != state_.auto_hide_state) { | 629 old_state.auto_hide_state != state_.auto_hide_state) { |
672 FOR_EACH_OBSERVER(ShelfLayoutManagerObserver, observers_, | 630 FOR_EACH_OBSERVER(ShelfLayoutManagerObserver, observers_, |
673 OnAutoHideStateChanged(state_.auto_hide_state)); | 631 OnAutoHideStateChanged(state_.auto_hide_state)); |
674 } | 632 } |
675 } | 633 } |
676 | 634 |
635 void ShelfLayoutManager::UpdateBoundsAndOpacity( | |
636 const TargetBounds& target_bounds, | |
637 bool animate, | |
638 ui::ImplicitAnimationObserver* observer) { | |
639 base::AutoReset<bool> auto_reset_updating_bounds(&updating_bounds_, true); | |
640 | |
641 ui::ScopedLayerAnimationSettings launcher_animation_setter( | |
642 GetLayer(shelf_)->GetAnimator()); | |
643 ui::ScopedLayerAnimationSettings status_animation_setter( | |
644 GetLayer(shelf_->status_area_widget())->GetAnimator()); | |
645 if (animate) { | |
646 launcher_animation_setter.SetTransitionDuration( | |
647 base::TimeDelta::FromMilliseconds(kCrossFadeDurationMS)); | |
648 launcher_animation_setter.SetTweenType(ui::Tween::EASE_OUT); | |
649 launcher_animation_setter.SetPreemptionStrategy( | |
650 ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET); | |
651 status_animation_setter.SetTransitionDuration( | |
652 base::TimeDelta::FromMilliseconds(kCrossFadeDurationMS)); | |
653 status_animation_setter.SetTweenType(ui::Tween::EASE_OUT); | |
654 status_animation_setter.SetPreemptionStrategy( | |
655 ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET); | |
656 } else { | |
657 StopAnimating(); | |
658 launcher_animation_setter.SetTransitionDuration(base::TimeDelta()); | |
659 status_animation_setter.SetTransitionDuration(base::TimeDelta()); | |
660 } | |
661 if (observer) | |
662 status_animation_setter.AddObserver(observer); | |
663 | |
664 GetLayer(shelf_)->SetOpacity(target_bounds.opacity); | |
665 shelf_->SetWidgetBounds( | |
666 ScreenAsh::ConvertRectToScreen( | |
667 shelf_->GetNativeView()->parent(), | |
668 target_bounds.shelf_bounds_in_root)); | |
669 | |
670 GetLayer(shelf_->status_area_widget())->SetOpacity( | |
671 target_bounds.status_opacity); | |
672 // TODO(harrym): Once status area widget is a child view of shelf | |
673 // this can be simplified. | |
674 gfx::Rect status_bounds = target_bounds.status_bounds_in_shelf; | |
675 status_bounds.set_x(status_bounds.x() + | |
676 target_bounds.shelf_bounds_in_root.x()); | |
677 status_bounds.set_y(status_bounds.y() + | |
678 target_bounds.shelf_bounds_in_root.y()); | |
679 shelf_->status_area_widget()->SetBounds( | |
680 ScreenAsh::ConvertRectToScreen( | |
681 shelf_->status_area_widget()->GetNativeView()->parent(), | |
682 status_bounds)); | |
683 Shell::GetInstance()->SetDisplayWorkAreaInsets( | |
684 root_window_, target_bounds.work_area_insets); | |
685 UpdateHitTestBounds(); | |
686 } | |
687 | |
677 void ShelfLayoutManager::StopAnimating() { | 688 void ShelfLayoutManager::StopAnimating() { |
678 GetLayer(shelf_)->GetAnimator()->StopAnimating(); | 689 GetLayer(shelf_)->GetAnimator()->StopAnimating(); |
679 GetLayer(shelf_->status_area_widget())->GetAnimator()->StopAnimating(); | 690 GetLayer(shelf_->status_area_widget())->GetAnimator()->StopAnimating(); |
680 } | 691 } |
681 | 692 |
682 void ShelfLayoutManager::GetShelfSize(int* width, int* height) { | 693 void ShelfLayoutManager::GetShelfSize(int* width, int* height) { |
683 *width = *height = 0; | 694 *width = *height = 0; |
684 gfx::Size status_size( | 695 gfx::Size status_size( |
685 shelf_->status_area_widget()->GetWindowBoundsInScreen().size()); | 696 shelf_->status_area_widget()->GetWindowBoundsInScreen().size()); |
686 if (IsHorizontalAlignment()) | 697 if (IsHorizontalAlignment()) |
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1092 return gfx::Insets(0, distance, 0, 0); | 1103 return gfx::Insets(0, distance, 0, 0); |
1093 case SHELF_ALIGNMENT_TOP: | 1104 case SHELF_ALIGNMENT_TOP: |
1094 return gfx::Insets(0, 0, distance, 0); | 1105 return gfx::Insets(0, 0, distance, 0); |
1095 } | 1106 } |
1096 NOTREACHED(); | 1107 NOTREACHED(); |
1097 return gfx::Insets(); | 1108 return gfx::Insets(); |
1098 } | 1109 } |
1099 | 1110 |
1100 } // namespace internal | 1111 } // namespace internal |
1101 } // namespace ash | 1112 } // namespace ash |
OLD | NEW |