summaryrefslogtreecommitdiffstats
path: root/ash
diff options
context:
space:
mode:
authorzturner@chromium.org <zturner@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-04-14 17:58:51 +0000
committerzturner@chromium.org <zturner@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-04-14 17:58:51 +0000
commit01f63dfc920f9caed470e87e4ea5f92c5ad2035d (patch)
tree37157049cc0776749c1a4778b2daa0683c0d17c6 /ash
parentd10833bcfa6bfa5d1d9f4ca38ee49a55f7b5d375 (diff)
downloadchromium_src-01f63dfc920f9caed470e87e4ea5f92c5ad2035d.zip
chromium_src-01f63dfc920f9caed470e87e4ea5f92c5ad2035d.tar.gz
chromium_src-01f63dfc920f9caed470e87e4ea5f92c5ad2035d.tar.bz2
Re-enable "Enable immersive fullscreen on Windows Ash."
The problem was that we were creating the ImmersiveModeControllerAsh even when the host desktop type was not HOST_DESKTOP_TYPE_ASH. BUG=355571, 356419 Review URL: https://codereview.chromium.org/217273002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@263665 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash')
-rw-r--r--ash/frame/custom_frame_view_ash.cc4
-rw-r--r--ash/shelf/shelf_layout_manager_unittest.cc29
-rw-r--r--ash/wm/immersive_fullscreen_controller.cc31
-rw-r--r--ash/wm/immersive_fullscreen_controller.h2
-rw-r--r--ash/wm/immersive_fullscreen_controller_unittest.cc25
-rw-r--r--ash/wm/system_gesture_event_filter.cc4
6 files changed, 58 insertions, 37 deletions
diff --git a/ash/frame/custom_frame_view_ash.cc b/ash/frame/custom_frame_view_ash.cc
index 5a90e87..c9029ec 100644
--- a/ash/frame/custom_frame_view_ash.cc
+++ b/ash/frame/custom_frame_view_ash.cc
@@ -51,9 +51,6 @@ class CustomFrameViewAshWindowStateDelegate
ash::wm::WindowState* window_state,
ash::CustomFrameViewAsh* custom_frame_view)
: window_state_(NULL) {
-#if defined(OS_CHROMEOS)
- // TODO(pkotwicz): Investigate if immersive fullscreen can be enabled for
- // Windows Ash.
immersive_fullscreen_controller_.reset(
new ash::ImmersiveFullscreenController);
custom_frame_view->InitImmersiveFullscreenControllerForView(
@@ -67,7 +64,6 @@ class CustomFrameViewAshWindowStateDelegate
window_state_ = window_state;
window_state_->AddObserver(this);
window_state_->window()->AddObserver(this);
-#endif
}
virtual ~CustomFrameViewAshWindowStateDelegate() {
if (window_state_) {
diff --git a/ash/shelf/shelf_layout_manager_unittest.cc b/ash/shelf/shelf_layout_manager_unittest.cc
index 81ecc9f..b388735 100644
--- a/ash/shelf/shelf_layout_manager_unittest.cc
+++ b/ash/shelf/shelf_layout_manager_unittest.cc
@@ -1522,8 +1522,7 @@ TEST_F(ShelfLayoutManagerTest, MAYBE_SetAlignment) {
display.work_area().y() - display.bounds().y());
}
-// https://code.google.com/p/chromium/issues/detail?id=356419
-TEST_F(ShelfLayoutManagerTest, DISABLED_GestureEdgeSwipe) {
+TEST_F(ShelfLayoutManagerTest, GestureEdgeSwipe) {
ShelfLayoutManager* shelf = GetShelfLayoutManager();
shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_NEVER);
views::Widget* widget = new views::Widget;
@@ -1534,35 +1533,41 @@ TEST_F(ShelfLayoutManagerTest, DISABLED_GestureEdgeSwipe) {
widget->Show();
widget->Maximize();
+ aura::test::EventGenerator generator(Shell::GetPrimaryRootWindow());
+
aura::Window* window = widget->GetNativeWindow();
shelf->LayoutShelf();
gfx::Rect shelf_shown = GetShelfWidget()->GetWindowBoundsInScreen();
gfx::Rect bounds_shelf = window->bounds();
+
+ // Edge swipe when SHELF_VISIBLE should not change visibility state.
+ EXPECT_EQ(SHELF_VISIBLE, shelf->visibility_state());
+ generator.GestureEdgeSwipe();
EXPECT_EQ(SHELF_VISIBLE, shelf->visibility_state());
+ // Edge swipe when AUTO_HIDE_HIDDEN should change to AUTO_HIDE_SHOWN.
shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS);
shelf->LayoutShelf();
+ EXPECT_EQ(SHELF_AUTO_HIDE, shelf->visibility_state());
EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf->auto_hide_state());
-
- aura::test::EventGenerator generator(Shell::GetPrimaryRootWindow());
generator.GestureEdgeSwipe();
-
- EXPECT_EQ(SHELF_VISIBLE, shelf->visibility_state());
- EXPECT_EQ(SHELF_AUTO_HIDE_BEHAVIOR_NEVER, shelf->auto_hide_behavior());
+ EXPECT_EQ(SHELF_AUTO_HIDE, shelf->visibility_state());
+ EXPECT_EQ(SHELF_AUTO_HIDE_SHOWN, shelf->auto_hide_state());
widget->SetFullscreen(true);
wm::GetWindowState(window)->set_hide_shelf_when_fullscreen(false);
shelf->UpdateVisibilityState();
- gfx::Rect bounds_fullscreen = window->bounds();
+ // Edge swipe in fullscreen + AUTO_HIDE_HIDDEN should show the shelf and
+ // remain fullscreen.
EXPECT_TRUE(widget->IsFullscreen());
+ EXPECT_EQ(SHELF_AUTO_HIDE, shelf->visibility_state());
EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf->auto_hide_state());
-
generator.GestureEdgeSwipe();
- EXPECT_EQ(SHELF_VISIBLE, shelf->visibility_state());
- EXPECT_EQ(SHELF_AUTO_HIDE_BEHAVIOR_NEVER, shelf->auto_hide_behavior());
- EXPECT_FALSE(widget->IsFullscreen());
+ EXPECT_EQ(SHELF_AUTO_HIDE, shelf->visibility_state());
+ EXPECT_EQ(SHELF_AUTO_HIDE_SHOWN, shelf->auto_hide_state());
+ EXPECT_TRUE(widget->IsFullscreen());
}
// Check that in maximize mode gesture swipes on the shelf have no effect.
diff --git a/ash/wm/immersive_fullscreen_controller.cc b/ash/wm/immersive_fullscreen_controller.cc
index b8c721c..b5df4b1 100644
--- a/ash/wm/immersive_fullscreen_controller.cc
+++ b/ash/wm/immersive_fullscreen_controller.cc
@@ -62,13 +62,6 @@ const int kSwipeVerticalThresholdMultiplier = 3;
// See ShouldIgnoreMouseEventAtLocation() for more details.
const int kHeightOfDeadRegionAboveTopContainer = 10;
-// The height in pixels of the region below the top edge of the display in which
-// the mouse can trigger revealing the top-of-window views. The height must be
-// greater than 1px because the top pixel is used to trigger moving the cursor
-// between displays if the user has a vertical display layout (primary display
-// above/below secondary display).
-const int kMouseRevealBoundsHeight = 3;
-
// Returns the BubbleDelegateView corresponding to |maybe_bubble| if
// |maybe_bubble| is a bubble.
views::BubbleDelegateView* AsBubbleDelegate(aura::Window* maybe_bubble) {
@@ -111,6 +104,20 @@ gfx::Rect GetDisplayBoundsInScreen(aura::Window* window) {
} // namespace
+// The height in pixels of the region below the top edge of the display in which
+// the mouse can trigger revealing the top-of-window views.
+#if defined(OS_WIN)
+// Windows 8 reserves some pixels at the top of the screen for the hand icon
+// that allows you to drag a metro app off the screen, so a few additional
+// pixels of space must be reserved for the mouse reveal.
+const int ImmersiveFullscreenController::kMouseRevealBoundsHeight = 9;
+#else
+// The height must be greater than 1px because the top pixel is used to trigger
+// moving the cursor between displays if the user has a vertical display layout
+// (primary display above/below secondary display).
+const int ImmersiveFullscreenController::kMouseRevealBoundsHeight = 3;
+#endif
+
////////////////////////////////////////////////////////////////////////////////
// Class which keeps the top-of-window views revealed as long as one of the
@@ -397,6 +404,12 @@ void ImmersiveFullscreenController::OnGestureEvent(ui::GestureEvent* event) {
return;
switch (event->type()) {
+#if defined(OS_WIN)
+ case ui::ET_GESTURE_WIN8_EDGE_SWIPE:
+ UpdateRevealedLocksForSwipe(GetSwipeType(event));
+ event->SetHandled();
+ break;
+#endif
case ui::ET_GESTURE_SCROLL_BEGIN:
if (ShouldHandleGestureEvent(GetEventLocationInScreen(*event))) {
gesture_begun_ = true;
@@ -850,6 +863,10 @@ void ImmersiveFullscreenController::OnSlideClosedAnimationCompleted() {
ImmersiveFullscreenController::SwipeType
ImmersiveFullscreenController::GetSwipeType(ui::GestureEvent* event) const {
+#if defined(OS_WIN)
+ if (event->type() == ui::ET_GESTURE_WIN8_EDGE_SWIPE)
+ return SWIPE_OPEN;
+#endif
if (event->type() != ui::ET_GESTURE_SCROLL_UPDATE)
return SWIPE_NONE;
// Make sure that it is a clear vertical gesture.
diff --git a/ash/wm/immersive_fullscreen_controller.h b/ash/wm/immersive_fullscreen_controller.h
index b98b32f..4f0b20b 100644
--- a/ash/wm/immersive_fullscreen_controller.h
+++ b/ash/wm/immersive_fullscreen_controller.h
@@ -46,6 +46,8 @@ class ASH_EXPORT ImmersiveFullscreenController
public views::WidgetObserver,
public ImmersiveRevealedLock::Delegate {
public:
+ static const int kMouseRevealBoundsHeight;
+
// The enum is used for an enumerated histogram. New items should be only
// added to the end.
enum WindowType {
diff --git a/ash/wm/immersive_fullscreen_controller_unittest.cc b/ash/wm/immersive_fullscreen_controller_unittest.cc
index 214ee92..ac0ac86 100644
--- a/ash/wm/immersive_fullscreen_controller_unittest.cc
+++ b/ash/wm/immersive_fullscreen_controller_unittest.cc
@@ -25,9 +25,6 @@
#include "ui/views/view.h"
#include "ui/views/widget/widget.h"
-// For now, immersive fullscreen is Chrome OS only.
-#if defined(OS_CHROMEOS)
-
namespace ash {
namespace {
@@ -346,12 +343,6 @@ TEST_F(ImmersiveFullscreenControllerTest, RevealedLock) {
// Test mouse event processing for top-of-screen reveal triggering.
TEST_F(ImmersiveFullscreenControllerTest, OnMouseEvent) {
// Set up initial state.
- UpdateDisplay("800x600,800x600");
- ash::DisplayLayout display_layout(ash::DisplayLayout::RIGHT, 0);
- ash::Shell::GetInstance()->display_manager()->SetLayoutForCurrentDisplays(
- display_layout);
-
- // Set up initial state.
SetEnabled(true);
ASSERT_TRUE(controller()->IsEnabled());
ASSERT_FALSE(controller()->IsRevealed());
@@ -378,7 +369,8 @@ TEST_F(ImmersiveFullscreenControllerTest, OnMouseEvent) {
// Moving |ImmersiveFullscreenControllerTest::kMouseRevealBoundsHeight| down
// from the top edge stops it.
- event_generator.MoveMouseBy(0, 3);
+ event_generator.MoveMouseBy(0,
+ ImmersiveFullscreenController::kMouseRevealBoundsHeight);
EXPECT_FALSE(top_edge_hover_timer_running());
// Moving back to the top starts the timer again.
@@ -679,7 +671,16 @@ TEST_F(ImmersiveFullscreenControllerTest, DifferentModalityEnterExit) {
}
// Test when the SWIPE_CLOSE edge gesture closes the top-of-window views.
-TEST_F(ImmersiveFullscreenControllerTest, EndRevealViaGesture) {
+#if defined(OS_WIN)
+// On Windows, touch events do not result in mouse events being disabled. As
+// a result, the last part of this test which ends the reveal via a gesture will
+// not work correctly. See crbug.com/332430, and the function
+// ShouldHideCursorOnTouch() in compound_event_filter.cc.
+#define MAYBE_EndRevealViaGesture DISABLED_EndRevealViaGesture
+#else
+#define MAYBE_EndRevealViaGesture EndRevealViaGesture
+#endif
+TEST_F(ImmersiveFullscreenControllerTest, MAYBE_EndRevealViaGesture) {
SetEnabled(true);
EXPECT_TRUE(controller()->IsEnabled());
EXPECT_FALSE(controller()->IsRevealed());
@@ -1054,5 +1055,3 @@ TEST_F(ImmersiveFullscreenControllerTest, Shelf) {
}
} // namespase ash
-
-#endif // defined(OS_CHROMEOS)
diff --git a/ash/wm/system_gesture_event_filter.cc b/ash/wm/system_gesture_event_filter.cc
index 0767514..0332869 100644
--- a/ash/wm/system_gesture_event_filter.cc
+++ b/ash/wm/system_gesture_event_filter.cc
@@ -64,7 +64,9 @@ void SystemGestureEventFilter::OnGestureEvent(ui::GestureEvent* event) {
if (event->type() == ui::ET_GESTURE_WIN8_EDGE_SWIPE &&
shelf_gesture_handler_->ProcessGestureEvent(*event)) {
- event->StopPropagation();
+ // Do not stop propagation, since the immersive fullscreen controller may
+ // need to handle this event.
+ return;
}
}