Chromium Code Reviews| 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 18 matching lines...) Expand all Loading... | |
| 29 #include "ash/wm/window_properties.h" | 29 #include "ash/wm/window_properties.h" |
| 30 #include "ash/wm/window_util.h" | 30 #include "ash/wm/window_util.h" |
| 31 #include "ash/wm/workspace_controller.h" | 31 #include "ash/wm/workspace_controller.h" |
| 32 #include "base/auto_reset.h" | 32 #include "base/auto_reset.h" |
| 33 #include "base/command_line.h" | 33 #include "base/command_line.h" |
| 34 #include "base/command_line.h" | 34 #include "base/command_line.h" |
| 35 #include "base/i18n/rtl.h" | 35 #include "base/i18n/rtl.h" |
| 36 #include "base/strings/string_number_conversions.h" | 36 #include "base/strings/string_number_conversions.h" |
| 37 #include "base/strings/string_util.h" | 37 #include "base/strings/string_util.h" |
| 38 #include "ui/aura/client/activation_client.h" | 38 #include "ui/aura/client/activation_client.h" |
| 39 #include "ui/aura/client/cursor_client.h" | |
| 39 #include "ui/aura/root_window.h" | 40 #include "ui/aura/root_window.h" |
| 40 #include "ui/base/events/event.h" | 41 #include "ui/base/events/event.h" |
| 41 #include "ui/base/events/event_handler.h" | 42 #include "ui/base/events/event_handler.h" |
| 42 #include "ui/base/ui_base_switches.h" | 43 #include "ui/base/ui_base_switches.h" |
| 43 #include "ui/compositor/layer.h" | 44 #include "ui/compositor/layer.h" |
| 44 #include "ui/compositor/layer_animation_observer.h" | 45 #include "ui/compositor/layer_animation_observer.h" |
| 45 #include "ui/compositor/layer_animator.h" | 46 #include "ui/compositor/layer_animator.h" |
| 46 #include "ui/compositor/scoped_layer_animation_settings.h" | 47 #include "ui/compositor/scoped_layer_animation_settings.h" |
| 47 #include "ui/gfx/screen.h" | 48 #include "ui/gfx/screen.h" |
| 48 #include "ui/views/widget/widget.h" | 49 #include "ui/views/widget/widget.h" |
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 273 TargetBounds target_bounds; | 274 TargetBounds target_bounds; |
| 274 CalculateTargetBounds(state_, &target_bounds); | 275 CalculateTargetBounds(state_, &target_bounds); |
| 275 GetLayer(shelf_)->SetOpacity(target_bounds.opacity); | 276 GetLayer(shelf_)->SetOpacity(target_bounds.opacity); |
| 276 shelf_->SetWidgetBounds( | 277 shelf_->SetWidgetBounds( |
| 277 ScreenAsh::ConvertRectToScreen( | 278 ScreenAsh::ConvertRectToScreen( |
| 278 shelf_->GetNativeView()->parent(), | 279 shelf_->GetNativeView()->parent(), |
| 279 target_bounds.shelf_bounds_in_root)); | 280 target_bounds.shelf_bounds_in_root)); |
| 280 if (shelf_->launcher()) | 281 if (shelf_->launcher()) |
| 281 shelf_->launcher()->SetLauncherViewBounds( | 282 shelf_->launcher()->SetLauncherViewBounds( |
| 282 target_bounds.launcher_bounds_in_shelf); | 283 target_bounds.launcher_bounds_in_shelf); |
| 283 GetLayer(shelf_->status_area_widget())->SetOpacity(target_bounds.opacity); | 284 GetLayer(shelf_->status_area_widget())->SetOpacity( |
| 285 target_bounds.status_opacity); | |
| 284 // TODO(harrym): Once status area widget is a child view of shelf | 286 // TODO(harrym): Once status area widget is a child view of shelf |
| 285 // this can be simplified. | 287 // this can be simplified. |
| 286 gfx::Rect status_bounds = target_bounds.status_bounds_in_shelf; | 288 gfx::Rect status_bounds = target_bounds.status_bounds_in_shelf; |
| 287 status_bounds.set_x(status_bounds.x() + | 289 status_bounds.set_x(status_bounds.x() + |
| 288 target_bounds.shelf_bounds_in_root.x()); | 290 target_bounds.shelf_bounds_in_root.x()); |
| 289 status_bounds.set_y(status_bounds.y() + | 291 status_bounds.set_y(status_bounds.y() + |
| 290 target_bounds.shelf_bounds_in_root.y()); | 292 target_bounds.shelf_bounds_in_root.y()); |
| 291 shelf_->status_area_widget()->SetBounds( | 293 shelf_->status_area_widget()->SetBounds( |
| 292 ScreenAsh::ConvertRectToScreen( | 294 ScreenAsh::ConvertRectToScreen( |
| 293 shelf_->status_area_widget()->GetNativeView()->parent(), | 295 shelf_->status_area_widget()->GetNativeView()->parent(), |
| (...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 564 return; | 566 return; |
| 565 | 567 |
| 566 State state; | 568 State state; |
| 567 state.visibility_state = visibility_state; | 569 state.visibility_state = visibility_state; |
| 568 state.auto_hide_state = CalculateAutoHideState(visibility_state); | 570 state.auto_hide_state = CalculateAutoHideState(visibility_state); |
| 569 state.is_screen_locked = | 571 state.is_screen_locked = |
| 570 Shell::GetInstance()->session_state_delegate()->IsScreenLocked(); | 572 Shell::GetInstance()->session_state_delegate()->IsScreenLocked(); |
| 571 state.window_state = workspace_controller_ ? | 573 state.window_state = workspace_controller_ ? |
| 572 workspace_controller_->GetWindowState() : WORKSPACE_WINDOW_STATE_DEFAULT; | 574 workspace_controller_->GetWindowState() : WORKSPACE_WINDOW_STATE_DEFAULT; |
| 573 | 575 |
| 574 // It's possible for SetState() when a window becomes maximized but the state | |
|
pkotwicz
2013/08/09 00:04:34
This comment is outdated. State::window_state now
| |
| 575 // won't have changed value. Do the dimming check before the early exit. | |
| 576 shelf_->SetDimsShelf( | |
| 577 (state.visibility_state == SHELF_VISIBLE) && | |
| 578 state.window_state == WORKSPACE_WINDOW_STATE_MAXIMIZED); | |
| 579 | |
| 580 if (state_.Equals(state)) | 576 if (state_.Equals(state)) |
| 581 return; // Nothing changed. | 577 return; // Nothing changed. |
| 582 | 578 |
| 583 FOR_EACH_OBSERVER(ShelfLayoutManagerObserver, observers_, | 579 FOR_EACH_OBSERVER(ShelfLayoutManagerObserver, observers_, |
| 584 WillChangeVisibilityState(visibility_state)); | 580 WillChangeVisibilityState(visibility_state)); |
| 585 | 581 |
| 586 if (state.visibility_state == SHELF_AUTO_HIDE) { | 582 if (state.visibility_state == SHELF_AUTO_HIDE) { |
| 587 // 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 |
| 588 // launcher to unhide the shelf. AutoHideEventFilter does that for us. | 584 // launcher to unhide the shelf. AutoHideEventFilter does that for us. |
| 589 if (!auto_hide_event_filter_) | 585 if (!auto_hide_event_filter_) |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 624 // Do not animate the background when: | 620 // Do not animate the background when: |
| 625 // - Going from a hidden / auto hidden shelf in fullscreen to a visible shelf | 621 // - Going from a hidden / auto hidden shelf in fullscreen to a visible shelf |
| 626 // in maximized mode. | 622 // in maximized mode. |
| 627 // - Going from an auto hidden shelf in maximized mode to a visible shelf in | 623 // - Going from an auto hidden shelf in maximized mode to a visible shelf in |
| 628 // maximized mode. | 624 // maximized mode. |
| 629 if (state.visibility_state == SHELF_VISIBLE && | 625 if (state.visibility_state == SHELF_VISIBLE && |
| 630 state.window_state == WORKSPACE_WINDOW_STATE_MAXIMIZED && | 626 state.window_state == WORKSPACE_WINDOW_STATE_MAXIMIZED && |
| 631 old_state.visibility_state != SHELF_VISIBLE) { | 627 old_state.visibility_state != SHELF_VISIBLE) { |
| 632 change_type = BackgroundAnimator::CHANGE_IMMEDIATE; | 628 change_type = BackgroundAnimator::CHANGE_IMMEDIATE; |
| 633 } else { | 629 } else { |
| 634 // Delay updating the background when going from SHELF_AUTO_HIDE_SHOWN to | 630 // Delay the animation when the shelf was hidden, and has just been made |
| 635 // SHELF_AUTO_HIDE_HIDDEN until the shelf animates out. Otherwise during the | 631 // visible (e.g. using a gesture-drag). |
| 636 // animation you see the background change. | 632 if (state.visibility_state == SHELF_VISIBLE && |
| 637 // Also delay the animation when the shelf was hidden, and has just been | 633 old_state.visibility_state == SHELF_AUTO_HIDE && |
| 638 // made visible (e.g. using a gesture-drag). | 634 old_state.auto_hide_state == SHELF_AUTO_HIDE_HIDDEN) { |
| 639 if (state.visibility_state == SHELF_AUTO_HIDE && | |
|
pkotwicz
2013/08/09 00:04:34
To the extent of my understanding this is dead cod
| |
| 640 state.auto_hide_state == SHELF_AUTO_HIDE_HIDDEN && | |
| 641 old_state.visibility_state == SHELF_AUTO_HIDE) { | |
| 642 delay_background_change = true; | |
| 643 } else if (state.visibility_state == SHELF_VISIBLE && | |
| 644 old_state.visibility_state == SHELF_AUTO_HIDE && | |
| 645 old_state.auto_hide_state == SHELF_AUTO_HIDE_HIDDEN) { | |
| 646 delay_background_change = true; | 635 delay_background_change = true; |
| 647 } | 636 } |
| 648 } | 637 } |
| 649 | 638 |
| 650 if (delay_background_change) { | 639 if (delay_background_change) { |
| 651 if (update_shelf_observer_) | 640 if (update_shelf_observer_) |
| 652 update_shelf_observer_->Detach(); | 641 update_shelf_observer_->Detach(); |
| 653 // UpdateShelfBackground deletes itself when the animation is done. | 642 // UpdateShelfBackground deletes itself when the animation is done. |
| 654 update_shelf_observer_ = new UpdateShelfObserver(this); | 643 update_shelf_observer_ = new UpdateShelfObserver(this); |
| 655 status_animation_setter.AddObserver(update_shelf_observer_); | 644 status_animation_setter.AddObserver(update_shelf_observer_); |
| 645 } else { | |
|
pkotwicz
2013/08/09 00:04:34
Some house cleaning.
| |
| 646 UpdateShelfBackground(change_type); | |
| 656 } | 647 } |
| 648 | |
| 649 shelf_->SetDimsShelf( | |
| 650 (state.visibility_state == SHELF_VISIBLE) && | |
| 651 state.window_state == WORKSPACE_WINDOW_STATE_MAXIMIZED); | |
| 652 | |
| 657 ui::Layer* layer = GetLayer(shelf_->status_area_widget()); | 653 ui::Layer* layer = GetLayer(shelf_->status_area_widget()); |
| 658 // TODO(harrym): Remove when status_area is view (crbug.com/180422). | 654 // TODO(harrym): Remove when status_area is view (crbug.com/180422). |
| 659 gfx::Rect status_bounds = target_bounds.status_bounds_in_shelf; | 655 gfx::Rect status_bounds = target_bounds.status_bounds_in_shelf; |
| 660 status_bounds.set_x(status_bounds.x() + | 656 status_bounds.set_x(status_bounds.x() + |
| 661 target_bounds.shelf_bounds_in_root.x()); | 657 target_bounds.shelf_bounds_in_root.x()); |
| 662 status_bounds.set_y(status_bounds.y() + | 658 status_bounds.set_y(status_bounds.y() + |
| 663 target_bounds.shelf_bounds_in_root.y()); | 659 target_bounds.shelf_bounds_in_root.y()); |
| 664 layer->SetBounds(status_bounds); | 660 layer->SetBounds(status_bounds); |
| 665 layer->SetOpacity(target_bounds.status_opacity); | 661 layer->SetOpacity(target_bounds.status_opacity); |
| 666 Shell::GetInstance()->SetDisplayWorkAreaInsets( | 662 Shell::GetInstance()->SetDisplayWorkAreaInsets( |
| 667 root_window_, target_bounds.work_area_insets); | 663 root_window_, target_bounds.work_area_insets); |
| 668 UpdateHitTestBounds(); | 664 UpdateHitTestBounds(); |
| 669 if (!delay_background_change) | |
| 670 UpdateShelfBackground(change_type); | |
|
sadrul
2013/08/09 05:30:13
This change, the change between newlines 645-652,
| |
| 671 | 665 |
| 672 // OnAutoHideStateChanged Should be emitted when: | 666 // OnAutoHideStateChanged Should be emitted when: |
| 673 // - firstly state changed to auto-hide from other state | 667 // - firstly state changed to auto-hide from other state |
| 674 // - or, auto_hide_state has changed | 668 // - or, auto_hide_state has changed |
| 675 if ((old_state.visibility_state != state_.visibility_state && | 669 if ((old_state.visibility_state != state_.visibility_state && |
| 676 state_.visibility_state == SHELF_AUTO_HIDE) || | 670 state_.visibility_state == SHELF_AUTO_HIDE) || |
| 677 old_state.auto_hide_state != state_.auto_hide_state) { | 671 old_state.auto_hide_state != state_.auto_hide_state) { |
| 678 FOR_EACH_OBSERVER(ShelfLayoutManagerObserver, observers_, | 672 FOR_EACH_OBSERVER(ShelfLayoutManagerObserver, observers_, |
| 679 OnAutoHideStateChanged(state_.auto_hide_state)); | 673 OnAutoHideStateChanged(state_.auto_hide_state)); |
| 680 } | 674 } |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 782 0, (dock_bounds_.x() > 0 ? dock_bounds_.width() : 0)); | 776 0, (dock_bounds_.x() > 0 ? dock_bounds_.width() : 0)); |
| 783 target_bounds->work_area_insets += dock_insets; | 777 target_bounds->work_area_insets += dock_insets; |
| 784 } | 778 } |
| 785 | 779 |
| 786 target_bounds->opacity = | 780 target_bounds->opacity = |
| 787 (gesture_drag_status_ == GESTURE_DRAG_IN_PROGRESS || | 781 (gesture_drag_status_ == GESTURE_DRAG_IN_PROGRESS || |
| 788 state.visibility_state == SHELF_VISIBLE || | 782 state.visibility_state == SHELF_VISIBLE || |
| 789 state.visibility_state == SHELF_AUTO_HIDE) ? 1.0f : 0.0f; | 783 state.visibility_state == SHELF_AUTO_HIDE) ? 1.0f : 0.0f; |
| 790 target_bounds->status_opacity = | 784 target_bounds->status_opacity = |
| 791 (state.visibility_state == SHELF_AUTO_HIDE && | 785 (state.visibility_state == SHELF_AUTO_HIDE && |
| 792 state.auto_hide_state == SHELF_AUTO_HIDE_HIDDEN) ? | 786 state.auto_hide_state == SHELF_AUTO_HIDE_HIDDEN && |
| 787 gesture_drag_status_ != GESTURE_DRAG_IN_PROGRESS) ? | |
| 793 0.0f : target_bounds->opacity; | 788 0.0f : target_bounds->opacity; |
| 794 | 789 |
| 795 if (gesture_drag_status_ == GESTURE_DRAG_IN_PROGRESS) | 790 if (gesture_drag_status_ == GESTURE_DRAG_IN_PROGRESS) |
| 796 UpdateTargetBoundsForGesture(target_bounds); | 791 UpdateTargetBoundsForGesture(target_bounds); |
| 797 | 792 |
| 798 // This needs to happen after calling UpdateTargetBoundsForGesture(), because | 793 // This needs to happen after calling UpdateTargetBoundsForGesture(), because |
| 799 // that can change the size of the shelf. | 794 // that can change the size of the shelf. |
| 800 target_bounds->launcher_bounds_in_shelf = SelectValueForShelfAlignment( | 795 target_bounds->launcher_bounds_in_shelf = SelectValueForShelfAlignment( |
| 801 gfx::Rect(base::i18n::IsRTL() ? status_size.width() : 0, 0, | 796 gfx::Rect(base::i18n::IsRTL() ? status_size.width() : 0, 0, |
| 802 shelf_width - status_size.width(), | 797 shelf_width - status_size.width(), |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 934 // TODO: Figure out if we need any special handling when the keyboard is | 929 // TODO: Figure out if we need any special handling when the keyboard is |
| 935 // visible. | 930 // visible. |
| 936 return show_shelf_region_in_screen; | 931 return show_shelf_region_in_screen; |
| 937 } | 932 } |
| 938 | 933 |
| 939 ShelfAutoHideState ShelfLayoutManager::CalculateAutoHideState( | 934 ShelfAutoHideState ShelfLayoutManager::CalculateAutoHideState( |
| 940 ShelfVisibilityState visibility_state) const { | 935 ShelfVisibilityState visibility_state) const { |
| 941 if (visibility_state != SHELF_AUTO_HIDE || !shelf_) | 936 if (visibility_state != SHELF_AUTO_HIDE || !shelf_) |
| 942 return SHELF_AUTO_HIDE_HIDDEN; | 937 return SHELF_AUTO_HIDE_HIDDEN; |
| 943 | 938 |
| 944 if (gesture_drag_status_ == GESTURE_DRAG_COMPLETE_IN_PROGRESS) | |
| 945 return gesture_drag_auto_hide_state_; | |
| 946 | |
| 947 Shell* shell = Shell::GetInstance(); | 939 Shell* shell = Shell::GetInstance(); |
| 948 if (shell->GetAppListTargetVisibility()) | 940 if (shell->GetAppListTargetVisibility()) |
| 949 return SHELF_AUTO_HIDE_SHOWN; | 941 return SHELF_AUTO_HIDE_SHOWN; |
| 950 | 942 |
| 951 if (shelf_->status_area_widget() && | 943 if (shelf_->status_area_widget() && |
| 952 shelf_->status_area_widget()->ShouldShowLauncher()) | 944 shelf_->status_area_widget()->ShouldShowLauncher()) |
| 953 return SHELF_AUTO_HIDE_SHOWN; | 945 return SHELF_AUTO_HIDE_SHOWN; |
| 954 | 946 |
| 955 if (shelf_->launcher() && shelf_->launcher()->IsShowingMenu()) | 947 if (shelf_->launcher() && shelf_->launcher()->IsShowingMenu()) |
| 956 return SHELF_AUTO_HIDE_SHOWN; | 948 return SHELF_AUTO_HIDE_SHOWN; |
| 957 | 949 |
| 958 if (shelf_->launcher() && shelf_->launcher()->IsShowingOverflowBubble()) | 950 if (shelf_->launcher() && shelf_->launcher()->IsShowingOverflowBubble()) |
| 959 return SHELF_AUTO_HIDE_SHOWN; | 951 return SHELF_AUTO_HIDE_SHOWN; |
| 960 | 952 |
| 961 if (shelf_->IsActive() || shelf_->status_area_widget()->IsActive()) | 953 if (shelf_->IsActive() || shelf_->status_area_widget()->IsActive()) |
| 962 return SHELF_AUTO_HIDE_SHOWN; | 954 return SHELF_AUTO_HIDE_SHOWN; |
| 963 | 955 |
| 956 const std::vector<aura::Window*> windows = | |
| 957 ash::MruWindowTracker::BuildWindowList(false); | |
| 958 | |
| 959 // Process the window list and check if there are any visible windows. | |
| 960 bool visible_window = false; | |
| 961 for (size_t i = 0; i < windows.size(); ++i) { | |
| 962 if (windows[i] && windows[i]->IsVisible() && | |
| 963 !ash::wm::IsWindowMinimized(windows[i]) && | |
| 964 root_window_ == windows[i]->GetRootWindow()) { | |
| 965 visible_window = true; | |
| 966 break; | |
| 967 } | |
| 968 } | |
| 969 // If there are no visible windows do not hide the shelf. | |
| 970 if (!visible_window) | |
| 971 return SHELF_AUTO_HIDE_SHOWN; | |
| 972 | |
| 973 if (gesture_drag_status_ == GESTURE_DRAG_COMPLETE_IN_PROGRESS) | |
| 974 return gesture_drag_auto_hide_state_; | |
| 975 | |
| 964 // Don't show if the user is dragging the mouse. | 976 // Don't show if the user is dragging the mouse. |
| 965 if (auto_hide_event_filter_.get() && auto_hide_event_filter_->in_mouse_drag()) | 977 if (auto_hide_event_filter_.get() && auto_hide_event_filter_->in_mouse_drag()) |
| 966 return SHELF_AUTO_HIDE_HIDDEN; | 978 return SHELF_AUTO_HIDE_HIDDEN; |
| 967 | 979 |
| 980 // Ignore the mouse position if mouse events are disabled. | |
| 981 aura::client::CursorClient* cursor_client = aura::client::GetCursorClient( | |
| 982 shelf_->GetNativeWindow()->GetRootWindow()); | |
| 983 if (!cursor_client->IsMouseEventsEnabled()) | |
| 984 return SHELF_AUTO_HIDE_HIDDEN; | |
| 985 | |
| 968 gfx::Rect shelf_region = shelf_->GetWindowBoundsInScreen(); | 986 gfx::Rect shelf_region = shelf_->GetWindowBoundsInScreen(); |
| 969 if (shelf_->status_area_widget() && | 987 if (shelf_->status_area_widget() && |
| 970 shelf_->status_area_widget()->IsMessageBubbleShown() && | 988 shelf_->status_area_widget()->IsMessageBubbleShown() && |
| 971 IsVisible()) { | 989 IsVisible()) { |
| 972 // Increase the the hit test area to prevent the shelf from disappearing | 990 // Increase the the hit test area to prevent the shelf from disappearing |
| 973 // when the mouse is over the bubble gap. | 991 // when the mouse is over the bubble gap. |
| 974 shelf_region.Inset(alignment_ == SHELF_ALIGNMENT_RIGHT ? | 992 shelf_region.Inset(alignment_ == SHELF_ALIGNMENT_RIGHT ? |
| 975 -kNotificationBubbleGapHeight : 0, | 993 -kNotificationBubbleGapHeight : 0, |
| 976 alignment_ == SHELF_ALIGNMENT_BOTTOM ? | 994 alignment_ == SHELF_ALIGNMENT_BOTTOM ? |
| 977 -kNotificationBubbleGapHeight : 0, | 995 -kNotificationBubbleGapHeight : 0, |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 998 // shelf slightly to make it easier to show the shelf in this situation. We | 1016 // shelf slightly to make it easier to show the shelf in this situation. We |
| 999 // do not check |auto_hide_timer_|.IsRunning() because it returns false when | 1017 // do not check |auto_hide_timer_|.IsRunning() because it returns false when |
| 1000 // the timer's task is running. | 1018 // the timer's task is running. |
| 1001 if ((state_.auto_hide_state == SHELF_AUTO_HIDE_SHOWN || | 1019 if ((state_.auto_hide_state == SHELF_AUTO_HIDE_SHOWN || |
| 1002 mouse_over_shelf_when_auto_hide_timer_started_) && | 1020 mouse_over_shelf_when_auto_hide_timer_started_) && |
| 1003 GetAutoHideShowShelfRegionInScreen().Contains( | 1021 GetAutoHideShowShelfRegionInScreen().Contains( |
| 1004 cursor_position_in_screen)) { | 1022 cursor_position_in_screen)) { |
| 1005 return SHELF_AUTO_HIDE_SHOWN; | 1023 return SHELF_AUTO_HIDE_SHOWN; |
| 1006 } | 1024 } |
| 1007 | 1025 |
| 1008 const std::vector<aura::Window*> windows = | 1026 return SHELF_AUTO_HIDE_HIDDEN; |
| 1009 ash::MruWindowTracker::BuildWindowList(false); | |
| 1010 | |
| 1011 // Process the window list and check if there are any visible windows. | |
| 1012 for (size_t i = 0; i < windows.size(); ++i) { | |
| 1013 if (windows[i] && windows[i]->IsVisible() && | |
| 1014 !ash::wm::IsWindowMinimized(windows[i]) && | |
| 1015 root_window_ == windows[i]->GetRootWindow()) | |
| 1016 return SHELF_AUTO_HIDE_HIDDEN; | |
| 1017 } | |
| 1018 | |
| 1019 // If there are no visible windows do not hide the shelf. | |
| 1020 return SHELF_AUTO_HIDE_SHOWN; | |
| 1021 } | 1027 } |
| 1022 | 1028 |
| 1023 void ShelfLayoutManager::UpdateHitTestBounds() { | 1029 void ShelfLayoutManager::UpdateHitTestBounds() { |
| 1024 gfx::Insets mouse_insets; | 1030 gfx::Insets mouse_insets; |
| 1025 gfx::Insets touch_insets; | 1031 gfx::Insets touch_insets; |
| 1026 if (state_.visibility_state == SHELF_VISIBLE) { | 1032 if (state_.visibility_state == SHELF_VISIBLE) { |
| 1027 // Let clicks at the very top of the launcher through so windows can be | 1033 // Let clicks at the very top of the launcher through so windows can be |
| 1028 // resized with the bottom-right corner and bottom edge. | 1034 // resized with the bottom-right corner and bottom edge. |
| 1029 mouse_insets = GetInsetsForAlignment(kWorkspaceAreaVisibleInset); | 1035 mouse_insets = GetInsetsForAlignment(kWorkspaceAreaVisibleInset); |
| 1030 } else if (state_.visibility_state == SHELF_AUTO_HIDE) { | 1036 } else if (state_.visibility_state == SHELF_AUTO_HIDE) { |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1086 return gfx::Insets(0, distance, 0, 0); | 1092 return gfx::Insets(0, distance, 0, 0); |
| 1087 case SHELF_ALIGNMENT_TOP: | 1093 case SHELF_ALIGNMENT_TOP: |
| 1088 return gfx::Insets(0, 0, distance, 0); | 1094 return gfx::Insets(0, 0, distance, 0); |
| 1089 } | 1095 } |
| 1090 NOTREACHED(); | 1096 NOTREACHED(); |
| 1091 return gfx::Insets(); | 1097 return gfx::Insets(); |
| 1092 } | 1098 } |
| 1093 | 1099 |
| 1094 } // namespace internal | 1100 } // namespace internal |
| 1095 } // namespace ash | 1101 } // namespace ash |
| OLD | NEW |