Chromium Code Reviews| Index: chrome/browser/ui/views/frame/immersive_mode_controller_ash.cc |
| diff --git a/chrome/browser/ui/views/frame/immersive_mode_controller_ash.cc b/chrome/browser/ui/views/frame/immersive_mode_controller_ash.cc |
| index 9fd4faca5236a346b9c17f11ddd62e455778e87c..e8fd908fcf8d7caa4b2e43d6a0ffaed975010ee3 100644 |
| --- a/chrome/browser/ui/views/frame/immersive_mode_controller_ash.cc |
| +++ b/chrome/browser/ui/views/frame/immersive_mode_controller_ash.cc |
| @@ -340,7 +340,7 @@ void ImmersiveModeControllerAsh::SetEnabled(bool enabled) { |
| if (reveal_state_ == REVEALED) { |
| // Reveal was unsuccessful. Reacquire the revealed locks if appropriate. |
| - UpdateLocatedEventRevealedLock(NULL); |
| + UpdateLocatedEventRevealedLock(NULL, REVEAL_WHILE_CLOSING_NO); |
| UpdateFocusRevealedLock(); |
| } |
| } else { |
| @@ -427,7 +427,7 @@ void ImmersiveModeControllerAsh::OnMouseEvent(ui::MouseEvent* event) { |
| return; |
| if (IsRevealed()) |
| - UpdateLocatedEventRevealedLock(event); |
| + UpdateLocatedEventRevealedLock(event, REVEAL_WHILE_CLOSING_NO); |
| // Trigger a reveal if the cursor pauses at the top of the screen for a |
| // while. |
| @@ -439,7 +439,7 @@ void ImmersiveModeControllerAsh::OnTouchEvent(ui::TouchEvent* event) { |
| if (!enabled_ || event->type() != ui::ET_TOUCH_PRESSED) |
| return; |
| - UpdateLocatedEventRevealedLock(event); |
| + UpdateLocatedEventRevealedLock(event, REVEAL_WHILE_CLOSING_NO); |
| } |
| void ImmersiveModeControllerAsh::OnGestureEvent(ui::GestureEvent* event) { |
| @@ -480,15 +480,6 @@ void ImmersiveModeControllerAsh::OnWillChangeFocus(views::View* focused_before, |
| void ImmersiveModeControllerAsh::OnDidChangeFocus(views::View* focused_before, |
| views::View* focused_now) { |
| - scoped_ptr<ImmersiveRevealedLock> lock; |
| - if (reveal_state_ == REVEALED || reveal_state_ == SLIDING_OPEN) { |
| - // Acquire a lock so that if UpdateLocatedEventRevealedLock() or |
| - // UpdateFocusRevealedLock() ends the reveal, it occurs after the |
| - // function terminates. This is useful in tests. |
| - lock.reset(GetRevealedLock(ANIMATE_REVEAL_YES)); |
| - } |
| - |
| - UpdateLocatedEventRevealedLock(NULL); |
|
pkotwicz
2013/08/05 19:14:07
This is no longer necessary given that it is now o
|
| UpdateFocusRevealedLock(); |
| } |
| @@ -504,20 +495,21 @@ void ImmersiveModeControllerAsh::OnWidgetDestroying(views::Widget* widget) { |
| void ImmersiveModeControllerAsh::OnWidgetActivationChanged( |
| views::Widget* widget, |
| bool active) { |
| - scoped_ptr<ImmersiveRevealedLock> lock; |
| - if (reveal_state_ == REVEALED || reveal_state_ == SLIDING_OPEN) { |
| - // Acquire a lock so that if UpdateLocatedEventRevealedLock() or |
| - // UpdateFocusRevealedLock() ends the reveal, it occurs after the |
| - // function terminates. This is useful in tests. |
| - lock.reset(GetRevealedLock(ANIMATE_REVEAL_YES)); |
| - } |
| - |
| // Mouse hover should not initiate revealing the top-of-window views while |
| // |native_window_| is inactive. |
| top_edge_hover_timer_.Stop(); |
| - UpdateLocatedEventRevealedLock(NULL); |
| UpdateFocusRevealedLock(); |
| + |
| + // Allow the top-of-window views to stay revealed if all of the revealed locks |
| + // were released in the process of activating |widget| but the mouse is still |
| + // hovered above the top-of-window views. For instance, if the bubble which |
| + // has been keeping the top-of-window views revealed is hidden but the mouse |
| + // is hovered above the top-of-window views, the top-of-window views should |
| + // stay revealed. We cannot call UpdateLocatedEventRevealedLock() from |
| + // BubbleManager::UpdateRevealedLock() because |widget| is not yet activate |
|
James Cook
2013/08/06 23:32:42
activate -> activated
|
| + // at that time. |
| + UpdateLocatedEventRevealedLock(NULL, REVEAL_WHILE_CLOSING_YES); |
| } |
| //////////////////////////////////////////////////////////////////////////////// |
| @@ -610,12 +602,12 @@ void ImmersiveModeControllerAsh::SetForceHideTabIndicatorsForTest(bool force) { |
| void ImmersiveModeControllerAsh::StartRevealForTest(bool hovered) { |
| MaybeStartReveal(ANIMATE_NO); |
| MoveMouse(top_container_, hovered); |
| - UpdateLocatedEventRevealedLock(NULL); |
| + UpdateLocatedEventRevealedLock(NULL, REVEAL_WHILE_CLOSING_NO); |
| } |
| void ImmersiveModeControllerAsh::SetMouseHoveredForTest(bool hovered) { |
| MoveMouse(top_container_, hovered); |
| - UpdateLocatedEventRevealedLock(NULL); |
| + UpdateLocatedEventRevealedLock(NULL, REVEAL_WHILE_CLOSING_NO); |
| } |
| void ImmersiveModeControllerAsh::DisableAnimationsForTest() { |
| @@ -730,7 +722,8 @@ void ImmersiveModeControllerAsh::UpdateTopEdgeHoverTimer( |
| } |
| void ImmersiveModeControllerAsh::UpdateLocatedEventRevealedLock( |
| - ui::LocatedEvent* event) { |
| + ui::LocatedEvent* event, |
| + RevealWhileClosing reveal_while_closing) { |
| if (!enabled_) |
| return; |
| DCHECK(!event || event->IsMouseEvent() || event->IsTouchEvent()); |
| @@ -739,8 +732,11 @@ void ImmersiveModeControllerAsh::UpdateLocatedEventRevealedLock( |
| // views are sliding closed or are closed with the following exceptions: |
| // - Hovering at y = 0 which is handled in OnMouseEvent(). |
| // - Doing a SWIPE_OPEN edge gesture which is handled in OnGestureEvent(). |
| - if (reveal_state_ == SLIDING_CLOSED || reveal_state_ == CLOSED) |
| + if (reveal_state_ == CLOSED || |
| + (reveal_state_ == SLIDING_CLOSED && |
| + reveal_while_closing == REVEAL_WHILE_CLOSING_NO)) { |
| return; |
| + } |
| // Neither the mouse nor touch should keep the top-of-window views revealed if |
| // |native_window_| is not active. |
| @@ -867,7 +863,7 @@ bool ImmersiveModeControllerAsh::UpdateRevealedLocksForSwipe( |
| return true; |
| // Ending the reveal was unsuccessful. Reaquire the locks if appropriate. |
| - UpdateLocatedEventRevealedLock(NULL); |
| + UpdateLocatedEventRevealedLock(NULL, REVEAL_WHILE_CLOSING_NO); |
| UpdateFocusRevealedLock(); |
| } |
| } |
| @@ -1003,7 +999,7 @@ void ImmersiveModeControllerAsh::OnSlideOpenAnimationCompleted(Layout layout) { |
| // The user may not have moved the mouse since the reveal was initiated. |
| // Update the revealed lock to reflect the mouse's current state. |
| - UpdateLocatedEventRevealedLock(NULL); |
| + UpdateLocatedEventRevealedLock(NULL, REVEAL_WHILE_CLOSING_NO); |
| } |
| void ImmersiveModeControllerAsh::MaybeEndReveal(Animate animate) { |