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> |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 #include "ash/ash_switches.h" | 13 #include "ash/ash_switches.h" |
14 #include "ash/launcher/launcher.h" | |
15 #include "ash/launcher/launcher_types.h" | 14 #include "ash/launcher/launcher_types.h" |
16 #include "ash/root_window_controller.h" | 15 #include "ash/root_window_controller.h" |
17 #include "ash/screen_ash.h" | 16 #include "ash/screen_ash.h" |
18 #include "ash/session_state_delegate.h" | 17 #include "ash/session_state_delegate.h" |
| 18 #include "ash/shelf/shelf.h" |
19 #include "ash/shelf/shelf_bezel_event_filter.h" | 19 #include "ash/shelf/shelf_bezel_event_filter.h" |
20 #include "ash/shelf/shelf_layout_manager_observer.h" | 20 #include "ash/shelf/shelf_layout_manager_observer.h" |
21 #include "ash/shelf/shelf_widget.h" | 21 #include "ash/shelf/shelf_widget.h" |
22 #include "ash/shell.h" | 22 #include "ash/shell.h" |
23 #include "ash/shell_window_ids.h" | 23 #include "ash/shell_window_ids.h" |
24 #include "ash/system/status_area_widget.h" | 24 #include "ash/system/status_area_widget.h" |
25 #include "ash/wm/gestures/shelf_gesture_handler.h" | 25 #include "ash/wm/gestures/shelf_gesture_handler.h" |
26 #include "ash/wm/lock_state_controller.h" | 26 #include "ash/wm/lock_state_controller.h" |
27 #include "ash/wm/mru_window_tracker.h" | 27 #include "ash/wm/mru_window_tracker.h" |
28 #include "ash/wm/window_animations.h" | 28 #include "ash/wm/window_animations.h" |
(...skipping 17 matching lines...) Expand all Loading... |
46 #include "ui/events/event.h" | 46 #include "ui/events/event.h" |
47 #include "ui/events/event_handler.h" | 47 #include "ui/events/event_handler.h" |
48 #include "ui/gfx/screen.h" | 48 #include "ui/gfx/screen.h" |
49 #include "ui/views/widget/widget.h" | 49 #include "ui/views/widget/widget.h" |
50 | 50 |
51 namespace ash { | 51 namespace ash { |
52 namespace internal { | 52 namespace internal { |
53 | 53 |
54 namespace { | 54 namespace { |
55 | 55 |
56 // Delay before showing the launcher. This is after the mouse stops moving. | 56 // Delay before showing the shelf. This is after the mouse stops moving. |
57 const int kAutoHideDelayMS = 200; | 57 const int kAutoHideDelayMS = 200; |
58 | 58 |
59 // To avoid hiding the shelf when the mouse transitions from a message bubble | 59 // To avoid hiding the shelf when the mouse transitions from a message bubble |
60 // into the shelf, the hit test area is enlarged by this amount of pixels to | 60 // into the shelf, the hit test area is enlarged by this amount of pixels to |
61 // keep the shelf from hiding. | 61 // keep the shelf from hiding. |
62 const int kNotificationBubbleGapHeight = 6; | 62 const int kNotificationBubbleGapHeight = 6; |
63 | 63 |
64 // The maximum size of the region on the display opposing the shelf managed by | 64 // The maximum size of the region on the display opposing the shelf managed by |
65 // this ShelfLayoutManager which can trigger showing the shelf. | 65 // this ShelfLayoutManager which can trigger showing the shelf. |
66 // For instance: | 66 // For instance: |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
279 gfx::Rect(bounds.x(), bounds.y(), width, bounds.height()), | 279 gfx::Rect(bounds.x(), bounds.y(), width, bounds.height()), |
280 gfx::Rect(bounds.right() - width, bounds.y(), width, bounds.height()), | 280 gfx::Rect(bounds.right() - width, bounds.y(), width, bounds.height()), |
281 gfx::Rect(bounds.x(), bounds.y(), bounds.width(), height)); | 281 gfx::Rect(bounds.x(), bounds.y(), bounds.width(), height)); |
282 } | 282 } |
283 | 283 |
284 void ShelfLayoutManager::LayoutShelf() { | 284 void ShelfLayoutManager::LayoutShelf() { |
285 TargetBounds target_bounds; | 285 TargetBounds target_bounds; |
286 CalculateTargetBounds(state_, &target_bounds); | 286 CalculateTargetBounds(state_, &target_bounds); |
287 UpdateBoundsAndOpacity(target_bounds, false, NULL); | 287 UpdateBoundsAndOpacity(target_bounds, false, NULL); |
288 | 288 |
289 if (shelf_->launcher()) { | 289 if (shelf_->shelf()) { |
290 // This is not part of UpdateBoundsAndOpacity() because | 290 // This is not part of UpdateBoundsAndOpacity() because |
291 // SetShelfViewBounds() sets the bounds immediately and does not animate. | 291 // SetShelfViewBounds() sets the bounds immediately and does not animate. |
292 // The height of the ShelfView for a horizontal shelf and the width of | 292 // The height of the ShelfView for a horizontal shelf and the width of |
293 // the ShelfView for a vertical shelf are set when |shelf_|'s bounds | 293 // the ShelfView for a vertical shelf are set when |shelf_|'s bounds |
294 // are changed via UpdateBoundsAndOpacity(). This sets the origin and the | 294 // are changed via UpdateBoundsAndOpacity(). This sets the origin and the |
295 // dimension in the other direction. | 295 // dimension in the other direction. |
296 shelf_->launcher()->SetShelfViewBounds( | 296 shelf_->shelf()->SetShelfViewBounds( |
297 target_bounds.launcher_bounds_in_shelf); | 297 target_bounds.shelf_bounds_in_shelf); |
298 } | 298 } |
299 } | 299 } |
300 | 300 |
301 ShelfVisibilityState ShelfLayoutManager::CalculateShelfVisibility() { | 301 ShelfVisibilityState ShelfLayoutManager::CalculateShelfVisibility() { |
302 switch(auto_hide_behavior_) { | 302 switch(auto_hide_behavior_) { |
303 case SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS: | 303 case SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS: |
304 return SHELF_AUTO_HIDE; | 304 return SHELF_AUTO_HIDE; |
305 case SHELF_AUTO_HIDE_BEHAVIOR_NEVER: | 305 case SHELF_AUTO_HIDE_BEHAVIOR_NEVER: |
306 return SHELF_VISIBLE; | 306 return SHELF_VISIBLE; |
307 case SHELF_AUTO_HIDE_ALWAYS_HIDDEN: | 307 case SHELF_AUTO_HIDE_ALWAYS_HIDDEN: |
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
537 aura::Window* lost_active) { | 537 aura::Window* lost_active) { |
538 UpdateAutoHideStateNow(); | 538 UpdateAutoHideStateNow(); |
539 } | 539 } |
540 | 540 |
541 bool ShelfLayoutManager::IsHorizontalAlignment() const { | 541 bool ShelfLayoutManager::IsHorizontalAlignment() const { |
542 return GetAlignment() == SHELF_ALIGNMENT_BOTTOM || | 542 return GetAlignment() == SHELF_ALIGNMENT_BOTTOM || |
543 GetAlignment() == SHELF_ALIGNMENT_TOP; | 543 GetAlignment() == SHELF_ALIGNMENT_TOP; |
544 } | 544 } |
545 | 545 |
546 // static | 546 // static |
547 ShelfLayoutManager* ShelfLayoutManager::ForLauncher(aura::Window* window) { | 547 ShelfLayoutManager* ShelfLayoutManager::ForShelf(aura::Window* window) { |
548 ShelfWidget* shelf = RootWindowController::ForLauncher(window)->shelf(); | 548 ShelfWidget* shelf = RootWindowController::ForShelf(window)->shelf(); |
549 return shelf ? shelf->shelf_layout_manager() : NULL; | 549 return shelf ? shelf->shelf_layout_manager() : NULL; |
550 } | 550 } |
551 | 551 |
552 //////////////////////////////////////////////////////////////////////////////// | 552 //////////////////////////////////////////////////////////////////////////////// |
553 // ShelfLayoutManager, private: | 553 // ShelfLayoutManager, private: |
554 | 554 |
555 ShelfLayoutManager::TargetBounds::TargetBounds() : opacity(0.0f) {} | 555 ShelfLayoutManager::TargetBounds::TargetBounds() : opacity(0.0f) {} |
556 ShelfLayoutManager::TargetBounds::~TargetBounds() {} | 556 ShelfLayoutManager::TargetBounds::~TargetBounds() {} |
557 | 557 |
558 void ShelfLayoutManager::SetState(ShelfVisibilityState visibility_state) { | 558 void ShelfLayoutManager::SetState(ShelfVisibilityState visibility_state) { |
(...skipping 15 matching lines...) Expand all Loading... |
574 gesture_drag_status_ == GESTURE_DRAG_COMPLETE_IN_PROGRESS); | 574 gesture_drag_status_ == GESTURE_DRAG_COMPLETE_IN_PROGRESS); |
575 | 575 |
576 if (!force_update && state_.Equals(state)) | 576 if (!force_update && state_.Equals(state)) |
577 return; // Nothing changed. | 577 return; // Nothing changed. |
578 | 578 |
579 FOR_EACH_OBSERVER(ShelfLayoutManagerObserver, observers_, | 579 FOR_EACH_OBSERVER(ShelfLayoutManagerObserver, observers_, |
580 WillChangeVisibilityState(visibility_state)); | 580 WillChangeVisibilityState(visibility_state)); |
581 | 581 |
582 if (state.visibility_state == SHELF_AUTO_HIDE) { | 582 if (state.visibility_state == SHELF_AUTO_HIDE) { |
583 // When state is SHELF_AUTO_HIDE we need to track when the mouse is over the | 583 // 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. | 584 // shelf to unhide it. AutoHideEventFilter does that for us. |
585 if (!auto_hide_event_filter_) | 585 if (!auto_hide_event_filter_) |
586 auto_hide_event_filter_.reset(new AutoHideEventFilter(this)); | 586 auto_hide_event_filter_.reset(new AutoHideEventFilter(this)); |
587 } else { | 587 } else { |
588 auto_hide_event_filter_.reset(NULL); | 588 auto_hide_event_filter_.reset(NULL); |
589 } | 589 } |
590 | 590 |
591 StopAutoHideTimer(); | 591 StopAutoHideTimer(); |
592 | 592 |
593 State old_state = state_; | 593 State old_state = state_; |
594 state_ = state; | 594 state_ = state; |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
643 OnAutoHideStateChanged(state_.auto_hide_state)); | 643 OnAutoHideStateChanged(state_.auto_hide_state)); |
644 } | 644 } |
645 } | 645 } |
646 | 646 |
647 void ShelfLayoutManager::UpdateBoundsAndOpacity( | 647 void ShelfLayoutManager::UpdateBoundsAndOpacity( |
648 const TargetBounds& target_bounds, | 648 const TargetBounds& target_bounds, |
649 bool animate, | 649 bool animate, |
650 ui::ImplicitAnimationObserver* observer) { | 650 ui::ImplicitAnimationObserver* observer) { |
651 base::AutoReset<bool> auto_reset_updating_bounds(&updating_bounds_, true); | 651 base::AutoReset<bool> auto_reset_updating_bounds(&updating_bounds_, true); |
652 | 652 |
653 ui::ScopedLayerAnimationSettings launcher_animation_setter( | 653 ui::ScopedLayerAnimationSettings shelf_animation_setter( |
654 GetLayer(shelf_)->GetAnimator()); | 654 GetLayer(shelf_)->GetAnimator()); |
655 ui::ScopedLayerAnimationSettings status_animation_setter( | 655 ui::ScopedLayerAnimationSettings status_animation_setter( |
656 GetLayer(shelf_->status_area_widget())->GetAnimator()); | 656 GetLayer(shelf_->status_area_widget())->GetAnimator()); |
657 if (animate) { | 657 if (animate) { |
658 launcher_animation_setter.SetTransitionDuration( | 658 shelf_animation_setter.SetTransitionDuration( |
659 base::TimeDelta::FromMilliseconds(kCrossFadeDurationMS)); | 659 base::TimeDelta::FromMilliseconds(kCrossFadeDurationMS)); |
660 launcher_animation_setter.SetTweenType(gfx::Tween::EASE_OUT); | 660 shelf_animation_setter.SetTweenType(gfx::Tween::EASE_OUT); |
661 launcher_animation_setter.SetPreemptionStrategy( | 661 shelf_animation_setter.SetPreemptionStrategy( |
662 ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET); | 662 ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET); |
663 status_animation_setter.SetTransitionDuration( | 663 status_animation_setter.SetTransitionDuration( |
664 base::TimeDelta::FromMilliseconds(kCrossFadeDurationMS)); | 664 base::TimeDelta::FromMilliseconds(kCrossFadeDurationMS)); |
665 status_animation_setter.SetTweenType(gfx::Tween::EASE_OUT); | 665 status_animation_setter.SetTweenType(gfx::Tween::EASE_OUT); |
666 status_animation_setter.SetPreemptionStrategy( | 666 status_animation_setter.SetPreemptionStrategy( |
667 ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET); | 667 ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET); |
668 } else { | 668 } else { |
669 StopAnimating(); | 669 StopAnimating(); |
670 launcher_animation_setter.SetTransitionDuration(base::TimeDelta()); | 670 shelf_animation_setter.SetTransitionDuration(base::TimeDelta()); |
671 status_animation_setter.SetTransitionDuration(base::TimeDelta()); | 671 status_animation_setter.SetTransitionDuration(base::TimeDelta()); |
672 } | 672 } |
673 if (observer) | 673 if (observer) |
674 status_animation_setter.AddObserver(observer); | 674 status_animation_setter.AddObserver(observer); |
675 | 675 |
676 GetLayer(shelf_)->SetOpacity(target_bounds.opacity); | 676 GetLayer(shelf_)->SetOpacity(target_bounds.opacity); |
677 shelf_->SetBounds(ScreenAsh::ConvertRectToScreen( | 677 shelf_->SetBounds(ScreenAsh::ConvertRectToScreen( |
678 shelf_->GetNativeView()->parent(), | 678 shelf_->GetNativeView()->parent(), |
679 target_bounds.shelf_bounds_in_root)); | 679 target_bounds.shelf_bounds_in_root)); |
680 | 680 |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
815 (state.visibility_state == SHELF_AUTO_HIDE && | 815 (state.visibility_state == SHELF_AUTO_HIDE && |
816 state.auto_hide_state == SHELF_AUTO_HIDE_HIDDEN && | 816 state.auto_hide_state == SHELF_AUTO_HIDE_HIDDEN && |
817 gesture_drag_status_ != GESTURE_DRAG_IN_PROGRESS) ? | 817 gesture_drag_status_ != GESTURE_DRAG_IN_PROGRESS) ? |
818 0.0f : target_bounds->opacity; | 818 0.0f : target_bounds->opacity; |
819 | 819 |
820 if (gesture_drag_status_ == GESTURE_DRAG_IN_PROGRESS) | 820 if (gesture_drag_status_ == GESTURE_DRAG_IN_PROGRESS) |
821 UpdateTargetBoundsForGesture(target_bounds); | 821 UpdateTargetBoundsForGesture(target_bounds); |
822 | 822 |
823 // This needs to happen after calling UpdateTargetBoundsForGesture(), because | 823 // This needs to happen after calling UpdateTargetBoundsForGesture(), because |
824 // that can change the size of the shelf. | 824 // that can change the size of the shelf. |
825 target_bounds->launcher_bounds_in_shelf = SelectValueForShelfAlignment( | 825 target_bounds->shelf_bounds_in_shelf = SelectValueForShelfAlignment( |
826 gfx::Rect(0, 0, | 826 gfx::Rect(0, 0, |
827 shelf_width - status_size.width(), | 827 shelf_width - status_size.width(), |
828 target_bounds->shelf_bounds_in_root.height()), | 828 target_bounds->shelf_bounds_in_root.height()), |
829 gfx::Rect(0, 0, target_bounds->shelf_bounds_in_root.width(), | 829 gfx::Rect(0, 0, target_bounds->shelf_bounds_in_root.width(), |
830 shelf_height - status_size.height()), | 830 shelf_height - status_size.height()), |
831 gfx::Rect(0, 0, target_bounds->shelf_bounds_in_root.width(), | 831 gfx::Rect(0, 0, target_bounds->shelf_bounds_in_root.width(), |
832 shelf_height - status_size.height()), | 832 shelf_height - status_size.height()), |
833 gfx::Rect(0, 0, | 833 gfx::Rect(0, 0, |
834 shelf_width - status_size.width(), | 834 shelf_width - status_size.width(), |
835 target_bounds->shelf_bounds_in_root.height())); | 835 target_bounds->shelf_bounds_in_root.height())); |
(...skipping 28 matching lines...) Expand all Loading... |
864 diff = std::min(diff, sqrtf(diff)); | 864 diff = std::min(diff, sqrtf(diff)); |
865 if (gesture_drag_amount_ < 0) | 865 if (gesture_drag_amount_ < 0) |
866 translate = -resistance_free_region - diff; | 866 translate = -resistance_free_region - diff; |
867 else | 867 else |
868 translate = resistance_free_region + diff; | 868 translate = resistance_free_region + diff; |
869 } else { | 869 } else { |
870 translate = gesture_drag_amount_; | 870 translate = gesture_drag_amount_; |
871 } | 871 } |
872 | 872 |
873 if (horizontal) { | 873 if (horizontal) { |
874 // Move and size the launcher with the gesture. | 874 // Move and size the shelf with the gesture. |
875 int shelf_height = target_bounds->shelf_bounds_in_root.height() - translate; | 875 int shelf_height = target_bounds->shelf_bounds_in_root.height() - translate; |
876 shelf_height = std::max(shelf_height, kAutoHideSize); | 876 shelf_height = std::max(shelf_height, kAutoHideSize); |
877 target_bounds->shelf_bounds_in_root.set_height(shelf_height); | 877 target_bounds->shelf_bounds_in_root.set_height(shelf_height); |
878 if (GetAlignment() == SHELF_ALIGNMENT_BOTTOM) { | 878 if (GetAlignment() == SHELF_ALIGNMENT_BOTTOM) { |
879 target_bounds->shelf_bounds_in_root.set_y( | 879 target_bounds->shelf_bounds_in_root.set_y( |
880 available_bounds.bottom() - shelf_height); | 880 available_bounds.bottom() - shelf_height); |
881 } | 881 } |
882 | 882 |
883 if (ash::switches::UseAlternateShelfLayout()) { | 883 if (ash::switches::UseAlternateShelfLayout()) { |
884 target_bounds->status_bounds_in_shelf.set_y(0); | 884 target_bounds->status_bounds_in_shelf.set_y(0); |
885 } else { | 885 } else { |
886 // The statusbar should be in the center of the shelf. | 886 // The statusbar should be in the center of the shelf. |
887 gfx::Rect status_y = target_bounds->shelf_bounds_in_root; | 887 gfx::Rect status_y = target_bounds->shelf_bounds_in_root; |
888 status_y.set_y(0); | 888 status_y.set_y(0); |
889 status_y.ClampToCenteredSize( | 889 status_y.ClampToCenteredSize( |
890 target_bounds->status_bounds_in_shelf.size()); | 890 target_bounds->status_bounds_in_shelf.size()); |
891 target_bounds->status_bounds_in_shelf.set_y(status_y.y()); | 891 target_bounds->status_bounds_in_shelf.set_y(status_y.y()); |
892 } | 892 } |
893 } else { | 893 } else { |
894 // Move and size the launcher with the gesture. | 894 // Move and size the shelf with the gesture. |
895 int shelf_width = target_bounds->shelf_bounds_in_root.width(); | 895 int shelf_width = target_bounds->shelf_bounds_in_root.width(); |
896 bool right_aligned = GetAlignment() == SHELF_ALIGNMENT_RIGHT; | 896 bool right_aligned = GetAlignment() == SHELF_ALIGNMENT_RIGHT; |
897 if (right_aligned) | 897 if (right_aligned) |
898 shelf_width -= translate; | 898 shelf_width -= translate; |
899 else | 899 else |
900 shelf_width += translate; | 900 shelf_width += translate; |
901 shelf_width = std::max(shelf_width, kAutoHideSize); | 901 shelf_width = std::max(shelf_width, kAutoHideSize); |
902 target_bounds->shelf_bounds_in_root.set_width(shelf_width); | 902 target_bounds->shelf_bounds_in_root.set_width(shelf_width); |
903 if (right_aligned) { | 903 if (right_aligned) { |
904 target_bounds->shelf_bounds_in_root.set_x( | 904 target_bounds->shelf_bounds_in_root.set_x( |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
981 ShelfAutoHideState ShelfLayoutManager::CalculateAutoHideState( | 981 ShelfAutoHideState ShelfLayoutManager::CalculateAutoHideState( |
982 ShelfVisibilityState visibility_state) const { | 982 ShelfVisibilityState visibility_state) const { |
983 if (visibility_state != SHELF_AUTO_HIDE || !shelf_) | 983 if (visibility_state != SHELF_AUTO_HIDE || !shelf_) |
984 return SHELF_AUTO_HIDE_HIDDEN; | 984 return SHELF_AUTO_HIDE_HIDDEN; |
985 | 985 |
986 Shell* shell = Shell::GetInstance(); | 986 Shell* shell = Shell::GetInstance(); |
987 if (shell->GetAppListTargetVisibility()) | 987 if (shell->GetAppListTargetVisibility()) |
988 return SHELF_AUTO_HIDE_SHOWN; | 988 return SHELF_AUTO_HIDE_SHOWN; |
989 | 989 |
990 if (shelf_->status_area_widget() && | 990 if (shelf_->status_area_widget() && |
991 shelf_->status_area_widget()->ShouldShowLauncher()) | 991 shelf_->status_area_widget()->ShouldShowShelf()) |
992 return SHELF_AUTO_HIDE_SHOWN; | 992 return SHELF_AUTO_HIDE_SHOWN; |
993 | 993 |
994 if (shelf_->launcher() && shelf_->launcher()->IsShowingMenu()) | 994 if (shelf_->shelf() && shelf_->shelf()->IsShowingMenu()) |
995 return SHELF_AUTO_HIDE_SHOWN; | 995 return SHELF_AUTO_HIDE_SHOWN; |
996 | 996 |
997 if (shelf_->launcher() && shelf_->launcher()->IsShowingOverflowBubble()) | 997 if (shelf_->shelf() && shelf_->shelf()->IsShowingOverflowBubble()) |
998 return SHELF_AUTO_HIDE_SHOWN; | 998 return SHELF_AUTO_HIDE_SHOWN; |
999 | 999 |
1000 if (shelf_->IsActive() || shelf_->status_area_widget()->IsActive()) | 1000 if (shelf_->IsActive() || shelf_->status_area_widget()->IsActive()) |
1001 return SHELF_AUTO_HIDE_SHOWN; | 1001 return SHELF_AUTO_HIDE_SHOWN; |
1002 | 1002 |
1003 const std::vector<aura::Window*> windows = | 1003 const std::vector<aura::Window*> windows = |
1004 ash::MruWindowTracker::BuildWindowList(false); | 1004 ash::MruWindowTracker::BuildWindowList(false); |
1005 | 1005 |
1006 // Process the window list and check if there are any visible windows. | 1006 // Process the window list and check if there are any visible windows. |
1007 bool visible_window = false; | 1007 bool visible_window = false; |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1071 return SHELF_AUTO_HIDE_SHOWN; | 1071 return SHELF_AUTO_HIDE_SHOWN; |
1072 } | 1072 } |
1073 | 1073 |
1074 return SHELF_AUTO_HIDE_HIDDEN; | 1074 return SHELF_AUTO_HIDE_HIDDEN; |
1075 } | 1075 } |
1076 | 1076 |
1077 void ShelfLayoutManager::UpdateHitTestBounds() { | 1077 void ShelfLayoutManager::UpdateHitTestBounds() { |
1078 gfx::Insets mouse_insets; | 1078 gfx::Insets mouse_insets; |
1079 gfx::Insets touch_insets; | 1079 gfx::Insets touch_insets; |
1080 if (state_.visibility_state == SHELF_VISIBLE) { | 1080 if (state_.visibility_state == SHELF_VISIBLE) { |
1081 // Let clicks at the very top of the launcher through so windows can be | 1081 // Let clicks at the very top of the shelf through so windows can be |
1082 // resized with the bottom-right corner and bottom edge. | 1082 // resized with the bottom-right corner and bottom edge. |
1083 mouse_insets = GetInsetsForAlignment(kWorkspaceAreaVisibleInset); | 1083 mouse_insets = GetInsetsForAlignment(kWorkspaceAreaVisibleInset); |
1084 } else if (state_.visibility_state == SHELF_AUTO_HIDE) { | 1084 } else if (state_.visibility_state == SHELF_AUTO_HIDE) { |
1085 // Extend the touch hit target out a bit to allow users to drag shelf out | 1085 // Extend the touch hit target out a bit to allow users to drag shelf out |
1086 // while hidden. | 1086 // while hidden. |
1087 touch_insets = GetInsetsForAlignment(-kWorkspaceAreaAutoHideInset); | 1087 touch_insets = GetInsetsForAlignment(-kWorkspaceAreaAutoHideInset); |
1088 } | 1088 } |
1089 | 1089 |
1090 if (shelf_ && shelf_->GetNativeWindow()) | 1090 if (shelf_ && shelf_->GetNativeWindow()) |
1091 shelf_->GetNativeWindow()->SetHitTestBoundsOverrideOuter(mouse_insets, | 1091 shelf_->GetNativeWindow()->SetHitTestBoundsOverrideOuter(mouse_insets, |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1157 return gfx::Insets(0, distance, 0, 0); | 1157 return gfx::Insets(0, distance, 0, 0); |
1158 case SHELF_ALIGNMENT_TOP: | 1158 case SHELF_ALIGNMENT_TOP: |
1159 return gfx::Insets(0, 0, distance, 0); | 1159 return gfx::Insets(0, 0, distance, 0); |
1160 } | 1160 } |
1161 NOTREACHED(); | 1161 NOTREACHED(); |
1162 return gfx::Insets(); | 1162 return gfx::Insets(); |
1163 } | 1163 } |
1164 | 1164 |
1165 } // namespace internal | 1165 } // namespace internal |
1166 } // namespace ash | 1166 } // namespace ash |
OLD | NEW |