Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(114)

Unified Diff: ash/wm/frame_border_hit_test_controller.cc

Issue 27458002: Allow setting different hit test bounds overrides for mouse and touch (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ash/wm/frame_border_hit_test_controller.cc
diff --git a/ash/wm/frame_border_hit_test_controller.cc b/ash/wm/frame_border_hit_test_controller.cc
index 28a572667153287db52c5356c6cd1f99f2cb16bc..b1e427cce4b023d128c5325f392b5f4243f43a66 100644
--- a/ash/wm/frame_border_hit_test_controller.cc
+++ b/ash/wm/frame_border_hit_test_controller.cc
@@ -14,6 +14,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;
+
+} // namespace
+
namespace ash {
FrameBorderHitTestController::FrameBorderHitTestController(views::Widget* frame)
@@ -82,15 +93,29 @@ 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());
+ wm::WindowState* window_state(wm::GetWindowState(frame_window_));
+ if (window_state->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.
+ if (window_state->IsImmersiveFullscreen()) {
+ frame_window_->SetHitTestBoundsOverrideInner(gfx::Insets(),
+ gfx::Insets(kImmersiveFullscreenTopInnerInsetTouch, 0, 0, 0));
+ } else {
+ frame_window_->SetHitTestBoundsOverrideInner(gfx::Insets(),
+ gfx::Insets());
+ }
+ } else if (window_state->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 +125,12 @@ void FrameBorderHitTestController::OnWindowShowTypeChanged(
UpdateHitTestBoundsOverrideInner();
}
+void FrameBorderHitTestController::OnWindowFullscreenTypeChanged(
+ wm::WindowState* window_state,
+ wm::FullscreenType old_type) {
+ UpdateHitTestBoundsOverrideInner();
+}
+
void FrameBorderHitTestController::OnWindowDestroying(aura::Window* window) {
frame_window_->RemoveObserver(this);
ash::wm::GetWindowState(frame_window_)->RemoveObserver(this);

Powered by Google App Engine
This is Rietveld 408576698