Index: ash/wm/frame_border_hittest_controller.cc |
diff --git a/ash/wm/frame_border_hittest_controller.cc b/ash/wm/frame_border_hittest_controller.cc |
index 729aa8e5c677e35ad1ca60856b4f16391555bccb..794d37333974268478320605c83fb6d44ee98a1d 100644 |
--- a/ash/wm/frame_border_hittest_controller.cc |
+++ b/ash/wm/frame_border_hittest_controller.cc |
@@ -6,7 +6,9 @@ |
#include "ash/ash_constants.h" |
#include "ash/wm/header_painter.h" |
+#include "ash/wm/window_properties.h" |
#include "ash/wm/window_state.h" |
+#include "ash/wm/wm_types.h" |
#include "ui/aura/env.h" |
#include "ui/aura/window.h" |
#include "ui/base/hit_test.h" |
@@ -14,6 +16,17 @@ |
#include "ui/views/widget/widget_delegate.h" |
#include "ui/views/window/non_client_view.h" |
+namespace { |
+ |
+// The height of the region in |frame_window_| where |frame_window_| should grab |
+// touches while in immersive fullscreen. (Even if a child window overlaps this |
+// region.) This region is used to allow us to intercept edge gestures to |
+// reveal the top-of-window views even if |frame_window_|'s web page conumes all |
+// touch events. |
+const int kImmersiveFullscreenTopInnerInsetTouch = 8; |
James Cook
2013/10/16 16:38:35
Are you sure you want to do it this way? We're OK
pkotwicz
2013/10/17 04:45:08
This is not a change. This is just moving what we
|
+ |
+} // namespace |
+ |
namespace ash { |
FrameBorderHittestController::FrameBorderHittestController(views::Widget* frame) |
@@ -82,15 +95,30 @@ int FrameBorderHittestController::NonClientHitTest( |
} |
void FrameBorderHittestController::UpdateHitTestBoundsOverrideInner() { |
- // Maximized and fullscreen windows don't want resize handles overlapping the |
- // content area, because when the user moves the cursor to the right screen |
- // edge we want them to be able to hit the scroll bar. |
- if (wm::GetWindowState(frame_window_)->IsMaximizedOrFullscreen()) { |
- frame_window_->set_hit_test_bounds_override_inner(gfx::Insets()); |
+ if (wm::GetWindowState(frame_window_)->IsFullscreen()) { |
+ // Fullscreen windows don't want resize handles when the mouse is on top of |
+ // the content area, so it is unnecessary to steal events from the web |
+ // contents along |frame_window_|'s edges. While in immersive fullscreen, we |
+ // grab touch events along the top edge of |frame_window_| so that we can |
+ // intercept edge gestures to reveal the top-of-window views even if the |
+ // web contents consumes all touch events. |
+ wm::FullscreenType fullscreen_type = |
+ frame_window_->GetProperty(internal::kFullscreenTypeKey); |
+ if (wm::IsImmersiveFullscreenType(fullscreen_type)) { |
+ frame_window_->SetHitTestBoundsOverrideInner(gfx::Insets(), |
+ gfx::Insets(kImmersiveFullscreenTopInnerInsetTouch, 0, 0, 0)); |
+ } else { |
+ frame_window_->SetHitTestBoundsOverrideInner(gfx::Insets(), |
+ gfx::Insets()); |
+ } |
+ } else if (wm::GetWindowState(frame_window_)->IsMaximized()) { |
+ // We do not want resize handles for maximized windows either. |
+ frame_window_->SetHitTestBoundsOverrideInner(gfx::Insets(), |
+ gfx::Insets()); |
} else { |
- frame_window_->set_hit_test_bounds_override_inner( |
- gfx::Insets(kResizeInsideBoundsSize, kResizeInsideBoundsSize, |
- kResizeInsideBoundsSize, kResizeInsideBoundsSize)); |
+ gfx::Insets insets(kResizeInsideBoundsSize, kResizeInsideBoundsSize, |
+ kResizeInsideBoundsSize, kResizeInsideBoundsSize); |
+ frame_window_->SetHitTestBoundsOverrideInner(insets, insets); |
} |
} |
@@ -100,6 +128,13 @@ void FrameBorderHittestController::OnWindowShowTypeChanged( |
UpdateHitTestBoundsOverrideInner(); |
} |
+void FrameBorderHittestController::OnWindowPropertyChanged(aura::Window* window, |
+ const void* key, |
+ intptr_t old) { |
+ if (key == ash::internal::kFullscreenTypeKey) |
+ UpdateHitTestBoundsOverrideInner(); |
+} |
+ |
void FrameBorderHittestController::OnWindowDestroying(aura::Window* window) { |
frame_window_->RemoveObserver(this); |
ash::wm::GetWindowState(frame_window_)->RemoveObserver(this); |