| 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 <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "ash/common/material_design/material_design_controller.h" | 11 #include "ash/common/material_design/material_design_controller.h" |
| 12 #include "ash/common/session/session_state_delegate.h" | 12 #include "ash/common/session/session_state_delegate.h" |
| 13 #include "ash/common/shelf/shelf_constants.h" | 13 #include "ash/common/shelf/shelf_constants.h" |
| 14 #include "ash/common/shelf/shelf_delegate.h" | 14 #include "ash/common/shelf/shelf_delegate.h" |
| 15 #include "ash/common/shelf/wm_shelf_util.h" | 15 #include "ash/common/shelf/wm_shelf_util.h" |
| 16 #include "ash/common/shell_window_ids.h" | 16 #include "ash/common/shell_window_ids.h" |
| 17 #include "ash/common/system/status_area_widget.h" | 17 #include "ash/common/system/status_area_widget.h" |
| 18 #include "ash/common/wm/fullscreen_window_finder.h" | 18 #include "ash/common/wm/fullscreen_window_finder.h" |
| 19 #include "ash/common/wm/mru_window_tracker.h" | 19 #include "ash/common/wm/mru_window_tracker.h" |
| 20 #include "ash/common/wm/window_state.h" | 20 #include "ash/common/wm/window_state.h" |
| 21 #include "ash/common/wm/wm_screen_util.h" | 21 #include "ash/common/wm/wm_screen_util.h" |
| 22 #include "ash/common/wm_lookup.h" | 22 #include "ash/common/wm_lookup.h" |
| 23 #include "ash/common/wm_root_window_controller.h" | 23 #include "ash/common/wm_root_window_controller.h" |
| 24 #include "ash/common/wm_root_window_controller_observer.h" | 24 #include "ash/common/wm_root_window_controller_observer.h" |
| 25 #include "ash/common/wm_shell.h" | 25 #include "ash/common/wm_shell.h" |
| 26 #include "ash/common/wm_window.h" | 26 #include "ash/common/wm_window.h" |
| 27 #include "ash/shelf/shelf.h" | 27 #include "ash/shelf/shelf.h" |
| 28 #include "ash/shelf/shelf_bezel_event_filter.h" | |
| 29 #include "ash/shelf/shelf_layout_manager_observer.h" | 28 #include "ash/shelf/shelf_layout_manager_observer.h" |
| 30 #include "ash/shell.h" | |
| 31 #include "ash/wm/window_animations.h" | |
| 32 #include "ash/wm/workspace_controller.h" | 29 #include "ash/wm/workspace_controller.h" |
| 33 #include "base/auto_reset.h" | 30 #include "base/auto_reset.h" |
| 34 #include "base/i18n/rtl.h" | 31 #include "base/i18n/rtl.h" |
| 35 #include "ui/compositor/layer.h" | 32 #include "ui/compositor/layer.h" |
| 36 #include "ui/compositor/layer_animation_observer.h" | 33 #include "ui/compositor/layer_animation_observer.h" |
| 37 #include "ui/compositor/layer_animator.h" | 34 #include "ui/compositor/layer_animator.h" |
| 38 #include "ui/compositor/scoped_layer_animation_settings.h" | 35 #include "ui/compositor/scoped_layer_animation_settings.h" |
| 39 #include "ui/display/display.h" | 36 #include "ui/display/display.h" |
| 40 #include "ui/display/screen.h" | 37 #include "ui/display/screen.h" |
| 41 #include "ui/events/event.h" | 38 #include "ui/events/event.h" |
| 42 #include "ui/keyboard/keyboard_util.h" | 39 #include "ui/keyboard/keyboard_util.h" |
| 43 #include "ui/views/border.h" | 40 #include "ui/views/border.h" |
| 44 #include "ui/views/widget/widget.h" | 41 #include "ui/views/widget/widget.h" |
| 45 | 42 |
| 46 namespace ash { | 43 namespace ash { |
| 47 namespace { | 44 namespace { |
| 48 | 45 |
| 49 // Delay before showing the shelf. This is after the mouse stops moving. | 46 // Delay before showing the shelf. This is after the mouse stops moving. |
| 50 const int kAutoHideDelayMS = 200; | 47 const int kAutoHideDelayMS = 200; |
| 51 | 48 |
| 49 // Duration of the animation to show or hide the shelf. |
| 50 const int kAnimationDurationMS = 200; |
| 51 |
| 52 // To avoid hiding the shelf when the mouse transitions from a message bubble | 52 // To avoid hiding the shelf when the mouse transitions from a message bubble |
| 53 // into the shelf, the hit test area is enlarged by this amount of pixels to | 53 // into the shelf, the hit test area is enlarged by this amount of pixels to |
| 54 // keep the shelf from hiding. | 54 // keep the shelf from hiding. |
| 55 const int kNotificationBubbleGapHeight = 6; | 55 const int kNotificationBubbleGapHeight = 6; |
| 56 | 56 |
| 57 // The maximum size of the region on the display opposing the shelf managed by | 57 // The maximum size of the region on the display opposing the shelf managed by |
| 58 // this ShelfLayoutManager which can trigger showing the shelf. | 58 // this ShelfLayoutManager which can trigger showing the shelf. |
| 59 // For instance: | 59 // For instance: |
| 60 // - Primary display is left of secondary display. | 60 // - Primary display is left of secondary display. |
| 61 // - Shelf is left aligned | 61 // - Shelf is left aligned |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 }; | 140 }; |
| 141 | 141 |
| 142 // ShelfLayoutManager ---------------------------------------------------------- | 142 // ShelfLayoutManager ---------------------------------------------------------- |
| 143 | 143 |
| 144 ShelfLayoutManager::ShelfLayoutManager(ShelfWidget* shelf_widget) | 144 ShelfLayoutManager::ShelfLayoutManager(ShelfWidget* shelf_widget) |
| 145 : updating_bounds_(false), | 145 : updating_bounds_(false), |
| 146 shelf_widget_(shelf_widget), | 146 shelf_widget_(shelf_widget), |
| 147 workspace_controller_(NULL), | 147 workspace_controller_(NULL), |
| 148 window_overlaps_shelf_(false), | 148 window_overlaps_shelf_(false), |
| 149 mouse_over_shelf_when_auto_hide_timer_started_(false), | 149 mouse_over_shelf_when_auto_hide_timer_started_(false), |
| 150 bezel_event_filter_(new ShelfBezelEventFilter(this)), | |
| 151 gesture_drag_status_(GESTURE_DRAG_NONE), | 150 gesture_drag_status_(GESTURE_DRAG_NONE), |
| 152 gesture_drag_amount_(0.f), | 151 gesture_drag_amount_(0.f), |
| 153 gesture_drag_auto_hide_state_(SHELF_AUTO_HIDE_SHOWN), | 152 gesture_drag_auto_hide_state_(SHELF_AUTO_HIDE_SHOWN), |
| 154 update_shelf_observer_(NULL), | 153 update_shelf_observer_(NULL), |
| 155 chromevox_panel_height_(0), | 154 chromevox_panel_height_(0), |
| 156 duration_override_in_ms_(0), | 155 duration_override_in_ms_(0), |
| 157 root_window_controller_observer_( | 156 root_window_controller_observer_( |
| 158 new RootWindowControllerObserverImpl(this)) { | 157 new RootWindowControllerObserverImpl(this)) { |
| 159 WmShell::Get()->AddShellObserver(this); | 158 WmShell::Get()->AddShellObserver(this); |
| 160 WmShell::Get()->AddLockStateObserver(this); | 159 WmShell::Get()->AddLockStateObserver(this); |
| 161 WmShell::Get()->AddActivationObserver(this); | 160 WmShell::Get()->AddActivationObserver(this); |
| 162 WmShell::Get()->GetSessionStateDelegate()->AddSessionStateObserver(this); | 161 WmShell::Get()->GetSessionStateDelegate()->AddSessionStateObserver(this); |
| 163 } | 162 } |
| 164 | 163 |
| 165 ShelfLayoutManager::~ShelfLayoutManager() { | 164 ShelfLayoutManager::~ShelfLayoutManager() { |
| 166 if (update_shelf_observer_) | 165 if (update_shelf_observer_) |
| 167 update_shelf_observer_->Detach(); | 166 update_shelf_observer_->Detach(); |
| 168 | 167 |
| 169 FOR_EACH_OBSERVER(ShelfLayoutManagerObserver, observers_, | 168 FOR_EACH_OBSERVER(ShelfLayoutManagerObserver, observers_, |
| 170 WillDeleteShelfLayoutManager()); | 169 WillDeleteShelfLayoutManager()); |
| 171 WmShell::Get()->RemoveShellObserver(this); | 170 WmShell::Get()->RemoveShellObserver(this); |
| 172 WmShell::Get()->RemoveLockStateObserver(this); | 171 WmShell::Get()->RemoveLockStateObserver(this); |
| 173 WmShell::Get()->GetSessionStateDelegate()->RemoveSessionStateObserver(this); | 172 WmShell::Get()->GetSessionStateDelegate()->RemoveSessionStateObserver(this); |
| 174 } | 173 } |
| 175 | 174 |
| 176 void ShelfLayoutManager::PrepareForShutdown() { | 175 void ShelfLayoutManager::PrepareForShutdown() { |
| 177 in_shutdown_ = true; | 176 in_shutdown_ = true; |
| 178 // Clear all event filters, otherwise sometimes those filters may catch | 177 set_workspace_controller(nullptr); |
| 179 // synthesized mouse event and cause crashes during the shutdown. | |
| 180 set_workspace_controller(NULL); | |
| 181 bezel_event_filter_.reset(); | |
| 182 // Stop observing changes to avoid updating a partially destructed shelf. | 178 // Stop observing changes to avoid updating a partially destructed shelf. |
| 183 WmShell::Get()->RemoveActivationObserver(this); | 179 WmShell::Get()->RemoveActivationObserver(this); |
| 184 } | 180 } |
| 185 | 181 |
| 186 bool ShelfLayoutManager::IsVisible() const { | 182 bool ShelfLayoutManager::IsVisible() const { |
| 187 // status_area_widget() may be NULL during the shutdown. | 183 // status_area_widget() may be NULL during the shutdown. |
| 188 return shelf_widget_->status_area_widget() && | 184 return shelf_widget_->status_area_widget() && |
| 189 shelf_widget_->status_area_widget()->IsVisible() && | 185 shelf_widget_->status_area_widget()->IsVisible() && |
| 190 (state_.visibility_state == SHELF_VISIBLE || | 186 (state_.visibility_state == SHELF_VISIBLE || |
| 191 (state_.visibility_state == SHELF_AUTO_HIDE && | 187 (state_.visibility_state == SHELF_AUTO_HIDE && |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 395 } | 391 } |
| 396 } | 392 } |
| 397 | 393 |
| 398 void ShelfLayoutManager::OnLockStateChanged(bool locked) { | 394 void ShelfLayoutManager::OnLockStateChanged(bool locked) { |
| 399 // Force the shelf to layout for alignment (bottom if locked, restore | 395 // Force the shelf to layout for alignment (bottom if locked, restore |
| 400 // the previous alignment otherwise). | 396 // the previous alignment otherwise). |
| 401 state_.is_screen_locked = locked; | 397 state_.is_screen_locked = locked; |
| 402 UpdateShelfVisibilityAfterLoginUIChange(); | 398 UpdateShelfVisibilityAfterLoginUIChange(); |
| 403 } | 399 } |
| 404 | 400 |
| 405 void ShelfLayoutManager::OnShelfAlignmentChanged(WmWindow* root_window) { | |
| 406 if (Shell::GetInstance()->in_mus()) | |
| 407 LayoutShelf(); | |
| 408 } | |
| 409 | |
| 410 void ShelfLayoutManager::OnShelfAutoHideBehaviorChanged(WmWindow* root_window) { | 401 void ShelfLayoutManager::OnShelfAutoHideBehaviorChanged(WmWindow* root_window) { |
| 411 UpdateVisibilityState(); | 402 UpdateVisibilityState(); |
| 412 } | 403 } |
| 413 | 404 |
| 414 void ShelfLayoutManager::OnPinnedStateChanged(WmWindow* pinned_window) { | 405 void ShelfLayoutManager::OnPinnedStateChanged(WmWindow* pinned_window) { |
| 415 // Shelf needs to be hidden on entering to pinned mode, or restored | 406 // Shelf needs to be hidden on entering to pinned mode, or restored |
| 416 // on exiting from pinned mode. | 407 // on exiting from pinned mode. |
| 417 UpdateVisibilityState(); | 408 UpdateVisibilityState(); |
| 418 } | 409 } |
| 419 | 410 |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 569 bool animate, | 560 bool animate, |
| 570 ui::ImplicitAnimationObserver* observer) { | 561 ui::ImplicitAnimationObserver* observer) { |
| 571 base::AutoReset<bool> auto_reset_updating_bounds(&updating_bounds_, true); | 562 base::AutoReset<bool> auto_reset_updating_bounds(&updating_bounds_, true); |
| 572 { | 563 { |
| 573 ui::ScopedLayerAnimationSettings shelf_animation_setter( | 564 ui::ScopedLayerAnimationSettings shelf_animation_setter( |
| 574 GetLayer(shelf_widget_)->GetAnimator()); | 565 GetLayer(shelf_widget_)->GetAnimator()); |
| 575 ui::ScopedLayerAnimationSettings status_animation_setter( | 566 ui::ScopedLayerAnimationSettings status_animation_setter( |
| 576 GetLayer(shelf_widget_->status_area_widget())->GetAnimator()); | 567 GetLayer(shelf_widget_->status_area_widget())->GetAnimator()); |
| 577 if (animate) { | 568 if (animate) { |
| 578 int duration = duration_override_in_ms_ ? duration_override_in_ms_ | 569 int duration = duration_override_in_ms_ ? duration_override_in_ms_ |
| 579 : kCrossFadeDurationMS; | 570 : kAnimationDurationMS; |
| 580 shelf_animation_setter.SetTransitionDuration( | 571 shelf_animation_setter.SetTransitionDuration( |
| 581 base::TimeDelta::FromMilliseconds(duration)); | 572 base::TimeDelta::FromMilliseconds(duration)); |
| 582 shelf_animation_setter.SetTweenType(gfx::Tween::EASE_OUT); | 573 shelf_animation_setter.SetTweenType(gfx::Tween::EASE_OUT); |
| 583 shelf_animation_setter.SetPreemptionStrategy( | 574 shelf_animation_setter.SetPreemptionStrategy( |
| 584 ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET); | 575 ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET); |
| 585 status_animation_setter.SetTransitionDuration( | 576 status_animation_setter.SetTransitionDuration( |
| 586 base::TimeDelta::FromMilliseconds(duration)); | 577 base::TimeDelta::FromMilliseconds(duration)); |
| 587 status_animation_setter.SetTweenType(gfx::Tween::EASE_OUT); | 578 status_animation_setter.SetTweenType(gfx::Tween::EASE_OUT); |
| 588 status_animation_setter.SetPreemptionStrategy( | 579 status_animation_setter.SetPreemptionStrategy( |
| 589 ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET); | 580 ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET); |
| 590 } else { | 581 } else { |
| 591 StopAnimating(); | 582 StopAnimating(); |
| 592 shelf_animation_setter.SetTransitionDuration(base::TimeDelta()); | 583 shelf_animation_setter.SetTransitionDuration(base::TimeDelta()); |
| 593 status_animation_setter.SetTransitionDuration(base::TimeDelta()); | 584 status_animation_setter.SetTransitionDuration(base::TimeDelta()); |
| 594 } | 585 } |
| 595 if (observer) | 586 if (observer) |
| 596 status_animation_setter.AddObserver(observer); | 587 status_animation_setter.AddObserver(observer); |
| 597 | 588 |
| 598 GetLayer(shelf_widget_)->SetOpacity(target_bounds.opacity); | 589 GetLayer(shelf_widget_)->SetOpacity(target_bounds.opacity); |
| 599 // mash::wm::ShelfLayout manages window bounds when running in mash. | 590 WmWindow* shelf_window = WmLookup::Get()->GetWindowForWidget(shelf_widget_); |
| 600 if (!Shell::GetInstance()->in_mus()) { | 591 shelf_widget_->SetBounds(shelf_window->GetParent()->ConvertRectToScreen( |
| 601 WmWindow* window = WmLookup::Get()->GetWindowForWidget(shelf_widget_); | 592 target_bounds.shelf_bounds_in_root)); |
| 602 shelf_widget_->SetBounds(window->GetParent()->ConvertRectToScreen( | |
| 603 target_bounds.shelf_bounds_in_root)); | |
| 604 } | |
| 605 | 593 |
| 606 GetLayer(shelf_widget_->status_area_widget()) | 594 GetLayer(shelf_widget_->status_area_widget()) |
| 607 ->SetOpacity(target_bounds.status_opacity); | 595 ->SetOpacity(target_bounds.status_opacity); |
| 608 | 596 |
| 609 // Having a window which is visible but does not have an opacity is an | 597 // Having a window which is visible but does not have an opacity is an |
| 610 // illegal state. We therefore hide the shelf here if required. | 598 // illegal state. We therefore hide the shelf here if required. |
| 611 if (!target_bounds.status_opacity) | 599 if (!target_bounds.status_opacity) |
| 612 shelf_widget_->status_area_widget()->Hide(); | 600 shelf_widget_->status_area_widget()->Hide(); |
| 613 // Setting visibility during an animation causes the visibility property to | 601 // Setting visibility during an animation causes the visibility property to |
| 614 // animate. Override the animation settings to immediately set the | 602 // animate. Override the animation settings to immediately set the |
| 615 // visibility property. Opacity will still animate. | 603 // visibility property. Opacity will still animate. |
| 616 | 604 |
| 617 // TODO(harrym): Once status area widget is a child view of shelf | 605 // TODO(harrym): Once status area widget is a child view of shelf |
| 618 // this can be simplified. | 606 // this can be simplified. |
| 619 gfx::Rect status_bounds = target_bounds.status_bounds_in_shelf; | 607 gfx::Rect status_bounds = target_bounds.status_bounds_in_shelf; |
| 620 status_bounds.Offset(target_bounds.shelf_bounds_in_root.OffsetFromOrigin()); | 608 status_bounds.Offset(target_bounds.shelf_bounds_in_root.OffsetFromOrigin()); |
| 621 // mash::wm::ShelfLayout manages window bounds when running mash. | 609 WmWindow* status_window = WmLookup::Get()->GetWindowForWidget( |
| 622 if (!Shell::GetInstance()->in_mus()) { | 610 shelf_widget_->status_area_widget()); |
| 623 WmWindow* window = WmLookup::Get()->GetWindowForWidget( | 611 shelf_widget_->status_area_widget()->SetBounds( |
| 624 shelf_widget_->status_area_widget()); | 612 status_window->GetParent()->ConvertRectToScreen(status_bounds)); |
| 625 shelf_widget_->status_area_widget()->SetBounds( | 613 |
| 626 window->GetParent()->ConvertRectToScreen(status_bounds)); | |
| 627 } | |
| 628 // For crbug.com/622431, when the shelf alignment is BOTTOM_LOCKED, we | 614 // For crbug.com/622431, when the shelf alignment is BOTTOM_LOCKED, we |
| 629 // don't set display work area, as it is not real user-set alignment. | 615 // don't set display work area, as it is not real user-set alignment. |
| 630 if (!state_.is_screen_locked && | 616 if (!state_.is_screen_locked && |
| 631 shelf_widget_->GetAlignment() != SHELF_ALIGNMENT_BOTTOM_LOCKED) { | 617 shelf_widget_->GetAlignment() != SHELF_ALIGNMENT_BOTTOM_LOCKED) { |
| 632 gfx::Insets insets; | 618 gfx::Insets insets; |
| 633 // If user session is blocked (login to new user session or add user to | 619 // If user session is blocked (login to new user session or add user to |
| 634 // the existing session - multi-profile) then give 100% of work area only | 620 // the existing session - multi-profile) then give 100% of work area only |
| 635 // if keyboard is not shown. | 621 // if keyboard is not shown. |
| 636 if (!state_.is_adding_user_screen || !keyboard_bounds_.IsEmpty()) | 622 if (!state_.is_adding_user_screen || !keyboard_bounds_.IsEmpty()) |
| 637 insets = target_bounds.work_area_insets; | 623 insets = target_bounds.work_area_insets; |
| 638 WmWindow* window = WmLookup::Get()->GetWindowForWidget(shelf_widget_); | 624 WmShell::Get()->SetDisplayWorkAreaInsets(shelf_window, insets); |
| 639 WmShell::Get()->SetDisplayWorkAreaInsets(window, insets); | |
| 640 } | 625 } |
| 641 } | 626 } |
| 642 | 627 |
| 643 // Set an empty border to avoid the shelf view and status area overlapping. | 628 // Set an empty border to avoid the shelf view and status area overlapping. |
| 644 // TODO(msw): Avoid setting bounds of views within the shelf widget here. | 629 // TODO(msw): Avoid setting bounds of views within the shelf widget here. |
| 645 gfx::Rect shelf_bounds = gfx::Rect(target_bounds.shelf_bounds_in_root.size()); | 630 gfx::Rect shelf_bounds = gfx::Rect(target_bounds.shelf_bounds_in_root.size()); |
| 646 shelf_widget_->GetContentsView()->SetBorder(views::Border::CreateEmptyBorder( | 631 shelf_widget_->GetContentsView()->SetBorder(views::Border::CreateEmptyBorder( |
| 647 shelf_bounds.InsetsFrom(target_bounds.shelf_bounds_in_shelf))); | 632 shelf_bounds.InsetsFrom(target_bounds.shelf_bounds_in_shelf))); |
| 648 shelf_widget_->GetContentsView()->Layout(); | 633 shelf_widget_->GetContentsView()->Layout(); |
| 649 | 634 |
| (...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 900 | 885 |
| 901 if (shelf_widget_->shelf() && | 886 if (shelf_widget_->shelf() && |
| 902 shelf_widget_->shelf()->IsShowingOverflowBubble()) | 887 shelf_widget_->shelf()->IsShowingOverflowBubble()) |
| 903 return SHELF_AUTO_HIDE_SHOWN; | 888 return SHELF_AUTO_HIDE_SHOWN; |
| 904 | 889 |
| 905 if (shelf_widget_->IsActive() || | 890 if (shelf_widget_->IsActive() || |
| 906 (shelf_widget_->status_area_widget() && | 891 (shelf_widget_->status_area_widget() && |
| 907 shelf_widget_->status_area_widget()->IsActive())) | 892 shelf_widget_->status_area_widget()->IsActive())) |
| 908 return SHELF_AUTO_HIDE_SHOWN; | 893 return SHELF_AUTO_HIDE_SHOWN; |
| 909 | 894 |
| 910 // TODO(jamescook): Track visible windows on mash via ShelfDelegate. | 895 const std::vector<WmWindow*> windows = |
| 911 if (!Shell::GetInstance()->in_mus()) { | 896 WmShell::Get()->mru_window_tracker()->BuildWindowListIgnoreModal(); |
| 912 const std::vector<WmWindow*> windows = | |
| 913 WmShell::Get()->mru_window_tracker()->BuildWindowListIgnoreModal(); | |
| 914 | 897 |
| 915 // Process the window list and check if there are any visible windows. | 898 // Process the window list and check if there are any visible windows. |
| 916 bool visible_window = false; | 899 bool visible_window = false; |
| 917 for (size_t i = 0; i < windows.size(); ++i) { | 900 for (size_t i = 0; i < windows.size(); ++i) { |
| 918 if (windows[i] && windows[i]->IsVisible() && | 901 if (windows[i] && windows[i]->IsVisible() && |
| 919 !windows[i]->GetWindowState()->IsMinimized() && | 902 !windows[i]->GetWindowState()->IsMinimized() && |
| 920 windows[i]->GetDisplayNearestWindow().id() == shelf_display_id) { | 903 windows[i]->GetDisplayNearestWindow().id() == shelf_display_id) { |
| 921 visible_window = true; | 904 visible_window = true; |
| 922 break; | 905 break; |
| 923 } | |
| 924 } | 906 } |
| 925 // If there are no visible windows do not hide the shelf. | |
| 926 if (!visible_window) | |
| 927 return SHELF_AUTO_HIDE_SHOWN; | |
| 928 } | 907 } |
| 908 // If there are no visible windows do not hide the shelf. |
| 909 if (!visible_window) |
| 910 return SHELF_AUTO_HIDE_SHOWN; |
| 929 | 911 |
| 930 if (gesture_drag_status_ == GESTURE_DRAG_COMPLETE_IN_PROGRESS) | 912 if (gesture_drag_status_ == GESTURE_DRAG_COMPLETE_IN_PROGRESS) |
| 931 return gesture_drag_auto_hide_state_; | 913 return gesture_drag_auto_hide_state_; |
| 932 | 914 |
| 933 // Don't show if the user is dragging the mouse. | 915 // Don't show if the user is dragging the mouse. |
| 934 if (in_mouse_drag_) | 916 if (in_mouse_drag_) |
| 935 return SHELF_AUTO_HIDE_HIDDEN; | 917 return SHELF_AUTO_HIDE_HIDDEN; |
| 936 | 918 |
| 937 // Ignore the mouse position if mouse events are disabled. | 919 // Ignore the mouse position if mouse events are disabled. |
| 938 if (!shelf_widget_->IsMouseEventsEnabled()) | 920 if (!shelf_widget_->IsMouseEventsEnabled()) |
| (...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1154 gesture_drag_status_ = GESTURE_DRAG_NONE; | 1136 gesture_drag_status_ = GESTURE_DRAG_NONE; |
| 1155 } | 1137 } |
| 1156 | 1138 |
| 1157 void ShelfLayoutManager::CancelGestureDrag() { | 1139 void ShelfLayoutManager::CancelGestureDrag() { |
| 1158 gesture_drag_status_ = GESTURE_DRAG_CANCEL_IN_PROGRESS; | 1140 gesture_drag_status_ = GESTURE_DRAG_CANCEL_IN_PROGRESS; |
| 1159 UpdateVisibilityState(); | 1141 UpdateVisibilityState(); |
| 1160 gesture_drag_status_ = GESTURE_DRAG_NONE; | 1142 gesture_drag_status_ = GESTURE_DRAG_NONE; |
| 1161 } | 1143 } |
| 1162 | 1144 |
| 1163 } // namespace ash | 1145 } // namespace ash |
| OLD | NEW |