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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 93 const int ShelfLayoutManager::kWorkspaceAreaAutoHideInset = 5; | 93 const int ShelfLayoutManager::kWorkspaceAreaAutoHideInset = 5; |
| 94 | 94 |
| 95 // static | 95 // static |
| 96 const int ShelfLayoutManager::kAutoHideSize = 3; | 96 const int ShelfLayoutManager::kAutoHideSize = 3; |
| 97 | 97 |
| 98 // static | 98 // static |
| 99 const int ShelfLayoutManager::kShelfItemInset = 3; | 99 const int ShelfLayoutManager::kShelfItemInset = 3; |
| 100 | 100 |
| 101 // ShelfLayoutManager::AutoHideEventFilter ------------------------------------- | 101 // ShelfLayoutManager::AutoHideEventFilter ------------------------------------- |
| 102 | 102 |
| 103 // Notifies ShelfLayoutManager any time the mouse moves. | 103 // Notifies ShelfLayoutManager any time the mouse moves. Not used on mash. |
| 104 // TODO(jamescook): Delete this once the mash implementation handles drags on | |
| 105 // and off the shelf. | |
| 104 class ShelfLayoutManager::AutoHideEventFilter : public ui::EventHandler { | 106 class ShelfLayoutManager::AutoHideEventFilter : public ui::EventHandler { |
| 105 public: | 107 public: |
| 106 explicit AutoHideEventFilter(ShelfLayoutManager* shelf); | 108 explicit AutoHideEventFilter(ShelfLayoutManager* shelf); |
| 107 ~AutoHideEventFilter() override; | 109 ~AutoHideEventFilter() override; |
| 108 | 110 |
| 109 // Returns true if the last mouse event was a mouse drag. | 111 // Returns true if the last mouse event was a mouse drag. |
| 110 bool in_mouse_drag() const { return in_mouse_drag_; } | 112 bool in_mouse_drag() const { return in_mouse_drag_; } |
| 111 | 113 |
| 112 // Overridden from ui::EventHandler: | 114 // Overridden from ui::EventHandler: |
| 113 void OnMouseEvent(ui::MouseEvent* event) override; | 115 void OnMouseEvent(ui::MouseEvent* event) override; |
| 114 void OnGestureEvent(ui::GestureEvent* event) override; | 116 void OnGestureEvent(ui::GestureEvent* event) override; |
| 115 | 117 |
| 116 private: | 118 private: |
| 117 ShelfLayoutManager* shelf_; | 119 ShelfLayoutManager* shelf_; |
| 118 bool in_mouse_drag_; | 120 bool in_mouse_drag_; |
| 119 ShelfGestureHandler gesture_handler_; | |
| 120 DISALLOW_COPY_AND_ASSIGN(AutoHideEventFilter); | 121 DISALLOW_COPY_AND_ASSIGN(AutoHideEventFilter); |
| 121 }; | 122 }; |
| 122 | 123 |
| 123 ShelfLayoutManager::AutoHideEventFilter::AutoHideEventFilter( | 124 ShelfLayoutManager::AutoHideEventFilter::AutoHideEventFilter( |
| 124 ShelfLayoutManager* shelf) | 125 ShelfLayoutManager* shelf) |
| 125 : shelf_(shelf), | 126 : shelf_(shelf), |
| 126 in_mouse_drag_(false) { | 127 in_mouse_drag_(false) { |
| 127 Shell::GetInstance()->AddPreTargetHandler(this); | 128 Shell::GetInstance()->AddPreTargetHandler(this); |
| 128 } | 129 } |
| 129 | 130 |
| 130 ShelfLayoutManager::AutoHideEventFilter::~AutoHideEventFilter() { | 131 ShelfLayoutManager::AutoHideEventFilter::~AutoHideEventFilter() { |
| 131 Shell::GetInstance()->RemovePreTargetHandler(this); | 132 Shell::GetInstance()->RemovePreTargetHandler(this); |
| 132 } | 133 } |
| 133 | 134 |
| 134 void ShelfLayoutManager::AutoHideEventFilter::OnMouseEvent( | 135 void ShelfLayoutManager::AutoHideEventFilter::OnMouseEvent( |
| 135 ui::MouseEvent* event) { | 136 ui::MouseEvent* event) { |
| 136 // This also checks IsShelfWindow() to make sure we don't attempt to hide the | 137 // This also checks IsShelfWindow() to make sure we don't attempt to hide the |
| 137 // shelf if the mouse down occurs on the shelf. | 138 // shelf if the mouse down occurs on the shelf. |
| 138 in_mouse_drag_ = (event->type() == ui::ET_MOUSE_DRAGGED || | 139 in_mouse_drag_ = (event->type() == ui::ET_MOUSE_DRAGGED || |
| 139 (in_mouse_drag_ && event->type() != ui::ET_MOUSE_RELEASED && | 140 (in_mouse_drag_ && event->type() != ui::ET_MOUSE_RELEASED && |
| 140 event->type() != ui::ET_MOUSE_CAPTURE_CHANGED)) && | 141 event->type() != ui::ET_MOUSE_CAPTURE_CHANGED)) && |
| 141 !shelf_->IsShelfWindow(static_cast<aura::Window*>(event->target())); | 142 !shelf_->IsShelfWindow(static_cast<aura::Window*>(event->target())); |
| 142 if (event->type() == ui::ET_MOUSE_MOVED) | 143 shelf_->UpdateAutoHideForMouseEvent(event); |
| 143 shelf_->UpdateAutoHideState(); | |
| 144 return; | |
| 145 } | 144 } |
| 146 | 145 |
| 147 void ShelfLayoutManager::AutoHideEventFilter::OnGestureEvent( | 146 void ShelfLayoutManager::AutoHideEventFilter::OnGestureEvent( |
| 148 ui::GestureEvent* event) { | 147 ui::GestureEvent* event) { |
| 149 aura::Window* target_window = static_cast<aura::Window*>(event->target()); | 148 shelf_->UpdateAutoHideForGestureEvent(event); |
| 150 if (shelf_->IsShelfWindow(target_window)) { | |
| 151 if (gesture_handler_.ProcessGestureEvent(*event, target_window)) | |
| 152 event->StopPropagation(); | |
| 153 } | |
| 154 } | 149 } |
| 155 | 150 |
| 156 // ShelfLayoutManager:UpdateShelfObserver -------------------------------------- | 151 // ShelfLayoutManager:UpdateShelfObserver -------------------------------------- |
| 157 | 152 |
| 158 // UpdateShelfObserver is used to delay updating the background until the | 153 // UpdateShelfObserver is used to delay updating the background until the |
| 159 // animation completes. | 154 // animation completes. |
| 160 class ShelfLayoutManager::UpdateShelfObserver | 155 class ShelfLayoutManager::UpdateShelfObserver |
| 161 : public ui::ImplicitAnimationObserver { | 156 : public ui::ImplicitAnimationObserver { |
| 162 public: | 157 public: |
| 163 explicit UpdateShelfObserver(ShelfLayoutManager* shelf) : shelf_(shelf) { | 158 explicit UpdateShelfObserver(ShelfLayoutManager* shelf) : shelf_(shelf) { |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 285 | 280 |
| 286 gfx::Rect ShelfLayoutManager::GetIdealBounds() { | 281 gfx::Rect ShelfLayoutManager::GetIdealBounds() { |
| 287 gfx::Rect rect(ScreenUtil::GetDisplayBoundsInParent(shelf_->GetNativeView())); | 282 gfx::Rect rect(ScreenUtil::GetDisplayBoundsInParent(shelf_->GetNativeView())); |
| 288 return SelectValueForShelfAlignment( | 283 return SelectValueForShelfAlignment( |
| 289 gfx::Rect(rect.x(), rect.bottom() - kShelfSize, rect.width(), kShelfSize), | 284 gfx::Rect(rect.x(), rect.bottom() - kShelfSize, rect.width(), kShelfSize), |
| 290 gfx::Rect(rect.x(), rect.y(), kShelfSize, rect.height()), | 285 gfx::Rect(rect.x(), rect.y(), kShelfSize, rect.height()), |
| 291 gfx::Rect(rect.right() - kShelfSize, rect.y(), kShelfSize, | 286 gfx::Rect(rect.right() - kShelfSize, rect.y(), kShelfSize, |
| 292 rect.height())); | 287 rect.height())); |
| 293 } | 288 } |
| 294 | 289 |
| 290 gfx::Size ShelfLayoutManager::GetPreferredSize() { | |
| 291 TargetBounds target_bounds; | |
| 292 CalculateTargetBounds(state_, &target_bounds); | |
| 293 return target_bounds.shelf_bounds_in_root.size(); | |
| 294 } | |
| 295 | |
| 295 void ShelfLayoutManager::LayoutShelf() { | 296 void ShelfLayoutManager::LayoutShelf() { |
| 296 TargetBounds target_bounds; | 297 TargetBounds target_bounds; |
| 297 CalculateTargetBounds(state_, &target_bounds); | 298 CalculateTargetBounds(state_, &target_bounds); |
| 298 UpdateBoundsAndOpacity(target_bounds, false, NULL); | 299 UpdateBoundsAndOpacity(target_bounds, false, NULL); |
| 299 | 300 |
| 300 // Update insets in ShelfWindowTargeter when shelf bounds change. | 301 // Update insets in ShelfWindowTargeter when shelf bounds change. |
| 301 FOR_EACH_OBSERVER(ShelfLayoutManagerObserver, observers_, | 302 FOR_EACH_OBSERVER(ShelfLayoutManagerObserver, observers_, |
| 302 WillChangeVisibilityState(visibility_state())); | 303 WillChangeVisibilityState(visibility_state())); |
| 303 } | 304 } |
| 304 | 305 |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 372 auto_hide_timer_.Start( | 373 auto_hide_timer_.Start( |
| 373 FROM_HERE, | 374 FROM_HERE, |
| 374 base::TimeDelta::FromMilliseconds(kAutoHideDelayMS), | 375 base::TimeDelta::FromMilliseconds(kAutoHideDelayMS), |
| 375 this, &ShelfLayoutManager::UpdateAutoHideStateNow); | 376 this, &ShelfLayoutManager::UpdateAutoHideStateNow); |
| 376 } | 377 } |
| 377 } else { | 378 } else { |
| 378 StopAutoHideTimer(); | 379 StopAutoHideTimer(); |
| 379 } | 380 } |
| 380 } | 381 } |
| 381 | 382 |
| 383 void ShelfLayoutManager::UpdateAutoHideForMouseEvent(ui::MouseEvent* event) { | |
| 384 // Don't update during shutdown because synthetic mouse events (e.g. mouse | |
| 385 // exit) may be generate during status area widget teardown. | |
|
msw
2016/05/24 20:46:55
nit: generated
James Cook
2016/05/25 00:25:43
Whoops! Done.
| |
| 386 if (visibility_state() != SHELF_AUTO_HIDE || in_shutdown_) | |
|
msw
2016/05/24 20:46:55
q: Where is |in_shutdown_| declared and set?
James Cook
2016/05/25 00:25:43
Declared in the header, set in PrepareForShutdown(
| |
| 387 return; | |
| 388 | |
| 389 if (event->type() == ui::ET_MOUSE_MOVED || | |
| 390 event->type() == ui::ET_MOUSE_ENTERED || | |
| 391 event->type() == ui::ET_MOUSE_EXITED) | |
| 392 UpdateAutoHideState(); | |
| 393 } | |
| 394 | |
| 395 void ShelfLayoutManager::UpdateAutoHideForGestureEvent( | |
| 396 ui::GestureEvent* event) { | |
| 397 if (visibility_state() != SHELF_AUTO_HIDE || in_shutdown_) | |
| 398 return; | |
| 399 | |
| 400 aura::Window* target_window = static_cast<aura::Window*>(event->target()); | |
| 401 if (IsShelfWindow(target_window)) { | |
| 402 if (gesture_handler_.ProcessGestureEvent(*event, target_window)) | |
| 403 event->StopPropagation(); | |
| 404 } | |
| 405 } | |
| 406 | |
| 382 void ShelfLayoutManager::SetWindowOverlapsShelf(bool value) { | 407 void ShelfLayoutManager::SetWindowOverlapsShelf(bool value) { |
| 383 window_overlaps_shelf_ = value; | 408 window_overlaps_shelf_ = value; |
| 384 UpdateShelfBackground(BACKGROUND_CHANGE_ANIMATE); | 409 UpdateShelfBackground(BACKGROUND_CHANGE_ANIMATE); |
| 385 } | 410 } |
| 386 | 411 |
| 387 void ShelfLayoutManager::AddObserver(ShelfLayoutManagerObserver* observer) { | 412 void ShelfLayoutManager::AddObserver(ShelfLayoutManagerObserver* observer) { |
| 388 observers_.AddObserver(observer); | 413 observers_.AddObserver(observer); |
| 389 } | 414 } |
| 390 | 415 |
| 391 void ShelfLayoutManager::RemoveObserver(ShelfLayoutManagerObserver* observer) { | 416 void ShelfLayoutManager::RemoveObserver(ShelfLayoutManagerObserver* observer) { |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 576 bool force_update = | 601 bool force_update = |
| 577 (gesture_drag_status_ == GESTURE_DRAG_CANCEL_IN_PROGRESS || | 602 (gesture_drag_status_ == GESTURE_DRAG_CANCEL_IN_PROGRESS || |
| 578 gesture_drag_status_ == GESTURE_DRAG_COMPLETE_IN_PROGRESS); | 603 gesture_drag_status_ == GESTURE_DRAG_COMPLETE_IN_PROGRESS); |
| 579 | 604 |
| 580 if (!force_update && state_.Equals(state)) | 605 if (!force_update && state_.Equals(state)) |
| 581 return; // Nothing changed. | 606 return; // Nothing changed. |
| 582 | 607 |
| 583 FOR_EACH_OBSERVER(ShelfLayoutManagerObserver, observers_, | 608 FOR_EACH_OBSERVER(ShelfLayoutManagerObserver, observers_, |
| 584 WillChangeVisibilityState(visibility_state)); | 609 WillChangeVisibilityState(visibility_state)); |
| 585 | 610 |
| 586 if (state.visibility_state == SHELF_AUTO_HIDE) { | 611 // mash does not support global event handlers. It uses events on the shelf |
| 587 // When state is SHELF_AUTO_HIDE we need to track when the mouse is over the | 612 // and status area widgets to update auto-hide. |
| 588 // shelf to unhide it. AutoHideEventFilter does that for us. | 613 if (!Shell::GetInstance()->in_mus()) { |
| 589 if (!auto_hide_event_filter_) | 614 if (state.visibility_state == SHELF_AUTO_HIDE) { |
| 590 auto_hide_event_filter_.reset(new AutoHideEventFilter(this)); | 615 // When state is SHELF_AUTO_HIDE we need to track when the mouse is over |
| 591 } else { | 616 // the shelf to unhide it. AutoHideEventFilter does that for us. |
| 592 auto_hide_event_filter_.reset(NULL); | 617 if (!auto_hide_event_filter_) |
| 618 auto_hide_event_filter_.reset(new AutoHideEventFilter(this)); | |
| 619 } else { | |
| 620 auto_hide_event_filter_.reset(NULL); | |
| 621 } | |
| 593 } | 622 } |
| 594 | 623 |
| 595 StopAutoHideTimer(); | 624 StopAutoHideTimer(); |
| 596 | 625 |
| 597 State old_state = state_; | 626 State old_state = state_; |
| 598 state_ = state; | 627 state_ = state; |
| 599 | 628 |
| 600 BackgroundAnimatorChangeType change_type = BACKGROUND_CHANGE_ANIMATE; | 629 BackgroundAnimatorChangeType change_type = BACKGROUND_CHANGE_ANIMATE; |
| 601 bool delay_background_change = false; | 630 bool delay_background_change = false; |
| 602 | 631 |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 630 | 659 |
| 631 shelf_->SetDimsShelf(state.visibility_state == SHELF_VISIBLE && | 660 shelf_->SetDimsShelf(state.visibility_state == SHELF_VISIBLE && |
| 632 state.window_state == | 661 state.window_state == |
| 633 wm::WORKSPACE_WINDOW_STATE_MAXIMIZED); | 662 wm::WORKSPACE_WINDOW_STATE_MAXIMIZED); |
| 634 | 663 |
| 635 TargetBounds target_bounds; | 664 TargetBounds target_bounds; |
| 636 CalculateTargetBounds(state_, &target_bounds); | 665 CalculateTargetBounds(state_, &target_bounds); |
| 637 UpdateBoundsAndOpacity(target_bounds, true, | 666 UpdateBoundsAndOpacity(target_bounds, true, |
| 638 delay_background_change ? update_shelf_observer_ : NULL); | 667 delay_background_change ? update_shelf_observer_ : NULL); |
| 639 | 668 |
| 669 // These observers must be notified after |state_| is updated so that they can | |
| 670 // query the new target bounds. | |
| 671 if (old_state.visibility_state != state_.visibility_state) { | |
| 672 FOR_EACH_OBSERVER(ShelfLayoutManagerObserver, observers_, | |
| 673 DidChangeVisibilityState(this, state_.visibility_state)); | |
| 674 } | |
| 675 | |
| 640 // OnAutoHideStateChanged Should be emitted when: | 676 // OnAutoHideStateChanged Should be emitted when: |
| 641 // - firstly state changed to auto-hide from other state | 677 // - firstly state changed to auto-hide from other state |
| 642 // - or, auto_hide_state has changed | 678 // - or, auto_hide_state has changed |
| 643 if ((old_state.visibility_state != state_.visibility_state && | 679 if ((old_state.visibility_state != state_.visibility_state && |
| 644 state_.visibility_state == SHELF_AUTO_HIDE) || | 680 state_.visibility_state == SHELF_AUTO_HIDE) || |
| 645 old_state.auto_hide_state != state_.auto_hide_state) { | 681 old_state.auto_hide_state != state_.auto_hide_state) { |
| 646 FOR_EACH_OBSERVER(ShelfLayoutManagerObserver, observers_, | 682 FOR_EACH_OBSERVER(ShelfLayoutManagerObserver, observers_, |
| 647 OnAutoHideStateChanged(state_.auto_hide_state)); | 683 OnAutoHideStateChanged(this, state_.auto_hide_state)); |
| 648 } | 684 } |
| 649 } | 685 } |
| 650 | 686 |
| 651 void ShelfLayoutManager::UpdateBoundsAndOpacity( | 687 void ShelfLayoutManager::UpdateBoundsAndOpacity( |
| 652 const TargetBounds& target_bounds, | 688 const TargetBounds& target_bounds, |
| 653 bool animate, | 689 bool animate, |
| 654 ui::ImplicitAnimationObserver* observer) { | 690 ui::ImplicitAnimationObserver* observer) { |
| 655 base::AutoReset<bool> auto_reset_updating_bounds(&updating_bounds_, true); | 691 base::AutoReset<bool> auto_reset_updating_bounds(&updating_bounds_, true); |
| 656 { | 692 { |
| 657 ui::ScopedLayerAnimationSettings shelf_animation_setter( | 693 ui::ScopedLayerAnimationSettings shelf_animation_setter( |
| (...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 916 | 952 |
| 917 void ShelfLayoutManager::UpdateShelfBackground( | 953 void ShelfLayoutManager::UpdateShelfBackground( |
| 918 BackgroundAnimatorChangeType type) { | 954 BackgroundAnimatorChangeType type) { |
| 919 const wm::ShelfBackgroundType background_type(GetShelfBackgroundType()); | 955 const wm::ShelfBackgroundType background_type(GetShelfBackgroundType()); |
| 920 shelf_->SetPaintsBackground(background_type, type); | 956 shelf_->SetPaintsBackground(background_type, type); |
| 921 FOR_EACH_OBSERVER(ShelfLayoutManagerObserver, observers_, | 957 FOR_EACH_OBSERVER(ShelfLayoutManagerObserver, observers_, |
| 922 OnBackgroundUpdated(background_type, type)); | 958 OnBackgroundUpdated(background_type, type)); |
| 923 } | 959 } |
| 924 | 960 |
| 925 wm::ShelfBackgroundType ShelfLayoutManager::GetShelfBackgroundType() const { | 961 wm::ShelfBackgroundType ShelfLayoutManager::GetShelfBackgroundType() const { |
| 962 // TODO(jamescook): Get maximized window state from the window manager. | |
| 963 if (Shell::GetInstance()->in_mus()) | |
|
msw
2016/05/24 20:46:55
q: Do we actually need this early return? What hap
James Cook
2016/05/25 00:25:43
Good catch, we don't really need this.
| |
| 964 return wm::SHELF_BACKGROUND_DEFAULT; | |
| 965 | |
| 926 if (state_.visibility_state != SHELF_AUTO_HIDE && | 966 if (state_.visibility_state != SHELF_AUTO_HIDE && |
| 927 state_.window_state == wm::WORKSPACE_WINDOW_STATE_MAXIMIZED) { | 967 state_.window_state == wm::WORKSPACE_WINDOW_STATE_MAXIMIZED) { |
| 928 return wm::SHELF_BACKGROUND_MAXIMIZED; | 968 return wm::SHELF_BACKGROUND_MAXIMIZED; |
| 929 } | 969 } |
| 930 | 970 |
| 931 if (gesture_drag_status_ == GESTURE_DRAG_IN_PROGRESS || | 971 if (gesture_drag_status_ == GESTURE_DRAG_IN_PROGRESS || |
| 932 (!state_.is_screen_locked && !state_.is_adding_user_screen && | 972 (!state_.is_screen_locked && !state_.is_adding_user_screen && |
| 933 window_overlaps_shelf_) || | 973 window_overlaps_shelf_) || |
| 934 (state_.visibility_state == SHELF_AUTO_HIDE)) { | 974 (state_.visibility_state == SHELF_AUTO_HIDE)) { |
| 935 return wm::SHELF_BACKGROUND_OVERLAP; | 975 return wm::SHELF_BACKGROUND_OVERLAP; |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 994 return SHELF_AUTO_HIDE_SHOWN; | 1034 return SHELF_AUTO_HIDE_SHOWN; |
| 995 | 1035 |
| 996 if (shelf_->shelf() && shelf_->shelf()->IsShowingOverflowBubble()) | 1036 if (shelf_->shelf() && shelf_->shelf()->IsShowingOverflowBubble()) |
| 997 return SHELF_AUTO_HIDE_SHOWN; | 1037 return SHELF_AUTO_HIDE_SHOWN; |
| 998 | 1038 |
| 999 if (shelf_->IsActive() || | 1039 if (shelf_->IsActive() || |
| 1000 (shelf_->status_area_widget() && | 1040 (shelf_->status_area_widget() && |
| 1001 shelf_->status_area_widget()->IsActive())) | 1041 shelf_->status_area_widget()->IsActive())) |
| 1002 return SHELF_AUTO_HIDE_SHOWN; | 1042 return SHELF_AUTO_HIDE_SHOWN; |
| 1003 | 1043 |
| 1004 const std::vector<aura::Window*> windows = | 1044 // TODO(jamescook): Track visible windows on mash via ShelfDelegate. |
| 1005 shell->mru_window_tracker()->BuildWindowListIgnoreModal(); | 1045 if (!Shell::GetInstance()->in_mus()) { |
| 1046 const std::vector<aura::Window*> windows = | |
| 1047 shell->mru_window_tracker()->BuildWindowListIgnoreModal(); | |
| 1006 | 1048 |
| 1007 // Process the window list and check if there are any visible windows. | 1049 // Process the window list and check if there are any visible windows. |
| 1008 bool visible_window = false; | 1050 bool visible_window = false; |
| 1009 for (size_t i = 0; i < windows.size(); ++i) { | 1051 for (size_t i = 0; i < windows.size(); ++i) { |
| 1010 if (windows[i] && windows[i]->IsVisible() && | 1052 if (windows[i] && windows[i]->IsVisible() && |
| 1011 !wm::GetWindowState(windows[i])->IsMinimized() && | 1053 !wm::GetWindowState(windows[i])->IsMinimized() && |
| 1012 root_window_ == windows[i]->GetRootWindow()) { | 1054 root_window_ == windows[i]->GetRootWindow()) { |
| 1013 visible_window = true; | 1055 visible_window = true; |
| 1014 break; | 1056 break; |
| 1057 } | |
| 1015 } | 1058 } |
| 1059 // If there are no visible windows do not hide the shelf. | |
| 1060 if (!visible_window) | |
| 1061 return SHELF_AUTO_HIDE_SHOWN; | |
| 1016 } | 1062 } |
| 1017 // If there are no visible windows do not hide the shelf. | |
| 1018 if (!visible_window) | |
| 1019 return SHELF_AUTO_HIDE_SHOWN; | |
| 1020 | 1063 |
| 1021 if (gesture_drag_status_ == GESTURE_DRAG_COMPLETE_IN_PROGRESS) | 1064 if (gesture_drag_status_ == GESTURE_DRAG_COMPLETE_IN_PROGRESS) |
| 1022 return gesture_drag_auto_hide_state_; | 1065 return gesture_drag_auto_hide_state_; |
| 1023 | 1066 |
| 1024 // Don't show if the user is dragging the mouse. | 1067 // Don't show if the user is dragging the mouse. |
| 1025 if (auto_hide_event_filter_.get() && auto_hide_event_filter_->in_mouse_drag()) | 1068 if (auto_hide_event_filter_.get() && auto_hide_event_filter_->in_mouse_drag()) |
| 1026 return SHELF_AUTO_HIDE_HIDDEN; | 1069 return SHELF_AUTO_HIDE_HIDDEN; |
| 1027 | 1070 |
| 1028 // Ignore the mouse position if mouse events are disabled. | 1071 // Ignore the mouse position if mouse events are disabled. |
| 1029 aura::client::CursorClient* cursor_client = aura::client::GetCursorClient( | 1072 aura::client::CursorClient* cursor_client = aura::client::GetCursorClient( |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1148 UpdateBoundsAndOpacity(target_bounds, true, NULL); | 1191 UpdateBoundsAndOpacity(target_bounds, true, NULL); |
| 1149 UpdateVisibilityState(); | 1192 UpdateVisibilityState(); |
| 1150 } | 1193 } |
| 1151 | 1194 |
| 1152 void ShelfLayoutManager::UpdateShelfVisibilityAfterLoginUIChange() { | 1195 void ShelfLayoutManager::UpdateShelfVisibilityAfterLoginUIChange() { |
| 1153 UpdateVisibilityState(); | 1196 UpdateVisibilityState(); |
| 1154 LayoutShelf(); | 1197 LayoutShelf(); |
| 1155 } | 1198 } |
| 1156 | 1199 |
| 1157 } // namespace ash | 1200 } // namespace ash |
| OLD | NEW |