diff options
Diffstat (limited to 'ash')
-rw-r--r-- | ash/ash.gyp | 4 | ||||
-rw-r--r-- | ash/shelf/shelf_bezel_event_filter.cc | 73 | ||||
-rw-r--r-- | ash/shelf/shelf_bezel_event_filter.h | 39 | ||||
-rw-r--r-- | ash/shelf/shelf_layout_manager.cc | 20 | ||||
-rw-r--r-- | ash/shelf/shelf_layout_manager.h | 8 | ||||
-rw-r--r-- | ash/shelf/shelf_layout_manager_unittest.cc | 41 | ||||
-rw-r--r-- | ash/wm/gestures/border_gesture_handler.cc | 171 | ||||
-rw-r--r-- | ash/wm/gestures/border_gesture_handler.h | 103 | ||||
-rw-r--r-- | ash/wm/system_gesture_event_filter.cc | 7 | ||||
-rw-r--r-- | ash/wm/system_gesture_event_filter.h | 2 | ||||
-rw-r--r-- | ash/wm/system_gesture_event_filter_unittest.cc | 35 |
11 files changed, 175 insertions, 328 deletions
diff --git a/ash/ash.gyp b/ash/ash.gyp index 69d1c45..3a66f74 100644 --- a/ash/ash.gyp +++ b/ash/ash.gyp @@ -176,6 +176,8 @@ 'session_state_observer.h', 'shelf/background_animator.cc', 'shelf/background_animator.h', + 'shelf/shelf_bezel_event_filter.cc', + 'shelf/shelf_bezel_event_filter.h', 'shelf/shelf_layout_manager.cc', 'shelf/shelf_layout_manager.h', 'shelf/shelf_layout_manager_observer.h', @@ -381,8 +383,6 @@ 'wm/event_rewriter_event_filter.h', 'wm/frame_painter.cc', 'wm/frame_painter.h', - 'wm/gestures/border_gesture_handler.cc', - 'wm/gestures/border_gesture_handler.h', 'wm/gestures/long_press_affordance_handler.cc', 'wm/gestures/long_press_affordance_handler.h', 'wm/gestures/shelf_gesture_handler.cc', diff --git a/ash/shelf/shelf_bezel_event_filter.cc b/ash/shelf/shelf_bezel_event_filter.cc new file mode 100644 index 0000000..12ec940 --- /dev/null +++ b/ash/shelf/shelf_bezel_event_filter.cc @@ -0,0 +1,73 @@ +// Copyright 2013 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "ash/shelf/shelf_bezel_event_filter.h" + +#include "ash/shelf/shelf_layout_manager.h" +#include "ash/shell.h" + +namespace ash { +namespace internal { + +ShelfBezelEventFilter::ShelfBezelEventFilter( + ShelfLayoutManager* shelf) + : shelf_(shelf), + in_touch_drag_(false) { + Shell::GetInstance()->AddPreTargetHandler(this); +} + +ShelfBezelEventFilter::~ShelfBezelEventFilter() { + Shell::GetInstance()->RemovePreTargetHandler(this); +} + +void ShelfBezelEventFilter::OnGestureEvent( + ui::GestureEvent* event) { + gfx::Rect screen = + Shell::GetScreen()->GetDisplayNearestPoint(event->location()).bounds(); + if ((!screen.Contains(event->location()) && + IsShelfOnBezel(screen, event->location())) || + in_touch_drag_) { + if (gesture_handler_.ProcessGestureEvent(*event)) { + switch (event->type()) { + case ui::ET_GESTURE_SCROLL_BEGIN: + in_touch_drag_ = true; + break; + case ui::ET_GESTURE_SCROLL_END: + case ui::ET_SCROLL_FLING_START: + in_touch_drag_ = false; + break; + default: + break; + } + event->StopPropagation(); + } + } +} + +bool ShelfBezelEventFilter::IsShelfOnBezel( + const gfx::Rect& screen, + const gfx::Point& point) const{ + switch (shelf_->GetAlignment()) { + case SHELF_ALIGNMENT_BOTTOM: + if (point.y() >= screen.bottom()) + return true; + break; + case SHELF_ALIGNMENT_LEFT: + if (point.x() <= screen.x()) + return true; + break; + case SHELF_ALIGNMENT_TOP: + if (point.y() <= screen.y()) + return true; + break; + case SHELF_ALIGNMENT_RIGHT: + if (point.x() >= screen.right()) + return true; + break; + } + return false; +} + +} // namespace internal +} // namespace ash diff --git a/ash/shelf/shelf_bezel_event_filter.h b/ash/shelf/shelf_bezel_event_filter.h new file mode 100644 index 0000000..5390c4e --- /dev/null +++ b/ash/shelf/shelf_bezel_event_filter.h @@ -0,0 +1,39 @@ +// Copyright 2013 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef ASH_SHELF_SHELF_BEZEL_EVENT_FILTER_H_ +#define ASH_SHELF_SHELF_BEZEL_EVENT_FILTER_H_ + +#include "ash/wm/gestures/shelf_gesture_handler.h" +#include "ui/base/events/event_handler.h" +#include "ui/gfx/rect.h" + +namespace ash { +namespace internal { +class ShelfLayoutManager; + +// Detects and forwards touch gestures that occur on a bezel sensor to the +// shelf. +class ShelfBezelEventFilter : public ui::EventHandler { + public: + explicit ShelfBezelEventFilter(ShelfLayoutManager* shelf); + virtual ~ShelfBezelEventFilter(); + + // Overridden from ui::EventHandler: + virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE; + + private: + bool IsShelfOnBezel(const gfx::Rect& screen, + const gfx::Point& point) const; + + ShelfLayoutManager* shelf_; // non-owned + bool in_touch_drag_; + ShelfGestureHandler gesture_handler_; + DISALLOW_COPY_AND_ASSIGN(ShelfBezelEventFilter); +}; + +} // namespace internal +} // namespace ash + +#endif // ASH_SHELF_SHELF_BEZEL_EVENT_FILTER_H_ diff --git a/ash/shelf/shelf_layout_manager.cc b/ash/shelf/shelf_layout_manager.cc index cf3e9b3..4481e44 100644 --- a/ash/shelf/shelf_layout_manager.cc +++ b/ash/shelf/shelf_layout_manager.cc @@ -6,6 +6,9 @@ #include <algorithm> #include <cmath> +#include <cstring> +#include <string> +#include <vector> #include "ash/ash_switches.h" #include "ash/launcher/launcher.h" @@ -13,6 +16,7 @@ #include "ash/root_window_controller.h" #include "ash/screen_ash.h" #include "ash/session_state_delegate.h" +#include "ash/shelf/shelf_bezel_event_filter.h" #include "ash/shelf/shelf_layout_manager_observer.h" #include "ash/shelf/shelf_widget.h" #include "ash/shell.h" @@ -23,15 +27,19 @@ #include "ash/wm/window_cycle_controller.h" #include "ash/wm/window_properties.h" #include "ash/wm/window_util.h" -#include "ash/wm/workspace_controller.h" #include "ash/wm/workspace/workspace_animations.h" +#include "ash/wm/workspace_controller.h" #include "base/auto_reset.h" #include "base/command_line.h" +#include "base/command_line.h" #include "base/i18n/rtl.h" +#include "base/string_number_conversions.h" +#include "base/string_util.h" #include "ui/aura/client/activation_client.h" #include "ui/aura/root_window.h" #include "ui/base/events/event.h" #include "ui/base/events/event_handler.h" +#include "ui/base/ui_base_switches.h" #include "ui/compositor/layer.h" #include "ui/compositor/layer_animation_observer.h" #include "ui/compositor/layer_animator.h" @@ -92,7 +100,6 @@ class ShelfLayoutManager::AutoHideEventFilter : public ui::EventHandler { ShelfLayoutManager* shelf_; bool in_mouse_drag_; ShelfGestureHandler gesture_handler_; - DISALLOW_COPY_AND_ASSIGN(AutoHideEventFilter); }; @@ -172,6 +179,7 @@ ShelfLayoutManager::ShelfLayoutManager(ShelfWidget* shelf) shelf_(shelf), workspace_controller_(NULL), window_overlaps_shelf_(false), + bezel_event_filter_(new ShelfBezelEventFilter(this)), gesture_drag_status_(GESTURE_DRAG_NONE), gesture_drag_amount_(0.f), gesture_drag_auto_hide_state_(SHELF_AUTO_HIDE_SHOWN), @@ -567,10 +575,10 @@ void ShelfLayoutManager::SetState(ShelfVisibilityState visibility_state) { if (state.visibility_state == SHELF_AUTO_HIDE) { // When state is SHELF_AUTO_HIDE we need to track when the mouse is over the // launcher to unhide the shelf. AutoHideEventFilter does that for us. - if (!event_filter_) - event_filter_.reset(new AutoHideEventFilter(this)); + if (!auto_hide_event_filter_) + auto_hide_event_filter_.reset(new AutoHideEventFilter(this)); } else { - event_filter_.reset(NULL); + auto_hide_event_filter_.reset(NULL); } auto_hide_timer_.Stop(); @@ -874,7 +882,7 @@ ShelfAutoHideState ShelfLayoutManager::CalculateAutoHideState( return SHELF_AUTO_HIDE_SHOWN; // Don't show if the user is dragging the mouse. - if (event_filter_.get() && event_filter_->in_mouse_drag()) + if (auto_hide_event_filter_.get() && auto_hide_event_filter_->in_mouse_drag()) return SHELF_AUTO_HIDE_HIDDEN; gfx::Rect shelf_region = shelf_->GetWindowBoundsInScreen(); diff --git a/ash/shelf/shelf_layout_manager.h b/ash/shelf/shelf_layout_manager.h index e2018f8..b68206c 100644 --- a/ash/shelf/shelf_layout_manager.h +++ b/ash/shelf/shelf_layout_manager.h @@ -5,6 +5,8 @@ #ifndef ASH_SHELF_SHELF_LAYOUT_MANAGER_H_ #define ASH_SHELF_SHELF_LAYOUT_MANAGER_H_ +#include <vector> + #include "ash/ash_export.h" #include "ash/launcher/launcher.h" #include "ash/shelf/background_animator.h" @@ -38,6 +40,7 @@ class ShelfWidget; namespace internal { class PanelLayoutManagerTest; +class ShelfBezelEventFilter; class ShelfLayoutManagerTest; class StatusAreaWidget; class WorkspaceController; @@ -312,7 +315,10 @@ class ASH_EXPORT ShelfLayoutManager : // EventFilter used to detect when user moves the mouse over the launcher to // trigger showing the launcher. - scoped_ptr<AutoHideEventFilter> event_filter_; + scoped_ptr<AutoHideEventFilter> auto_hide_event_filter_; + + // EventFilter used to detect when user issues a gesture on a bezel sensor. + scoped_ptr<ShelfBezelEventFilter> bezel_event_filter_; ObserverList<ShelfLayoutManagerObserver> observers_; diff --git a/ash/shelf/shelf_layout_manager_unittest.cc b/ash/shelf/shelf_layout_manager_unittest.cc index 524ddf7..15bab64 100644 --- a/ash/shelf/shelf_layout_manager_unittest.cc +++ b/ash/shelf/shelf_layout_manager_unittest.cc @@ -470,7 +470,7 @@ void ShelfLayoutManagerTest::RunGestureDragTests(gfx::Vector2d delta) { (GetShelfWidget()->GetWindowBoundsInScreen().x() + GetShelfWidget()->GetWindowBoundsInScreen().right())/2, GetShelfWidget()->GetWindowBoundsInScreen().y() - 50); - end.set_y(outside_start.y() - 100); + end = outside_start + delta; generator.GestureScrollSequence(outside_start, end, base::TimeDelta::FromMilliseconds(10), @@ -481,14 +481,53 @@ void ShelfLayoutManagerTest::RunGestureDragTests(gfx::Vector2d delta) { EXPECT_EQ(shelf_hidden.ToString(), GetShelfWidget()->GetWindowBoundsInScreen().ToString()); + // Swipe up from below the shelf where a bezel would be, this should show the + // shelf. + gfx::Point below_start = start; + if (GetShelfLayoutManager()->IsHorizontalAlignment()) + below_start.set_y(GetShelfWidget()->GetWindowBoundsInScreen().bottom() + 1); + else if (SHELF_ALIGNMENT_LEFT == GetShelfLayoutManager()->GetAlignment()) + below_start.set_x( + GetShelfWidget()->GetWindowBoundsInScreen().x() - 1); + else if (SHELF_ALIGNMENT_RIGHT == GetShelfLayoutManager()->GetAlignment()) + below_start.set_x(GetShelfWidget()->GetWindowBoundsInScreen().right() + 1); + end = below_start - delta; + generator.GestureScrollSequence(below_start, + end, + base::TimeDelta::FromMilliseconds(10), + kNumScrollSteps); + EXPECT_EQ(SHELF_VISIBLE, shelf->visibility_state()); + EXPECT_EQ(SHELF_AUTO_HIDE_BEHAVIOR_NEVER, shelf->auto_hide_behavior()); + EXPECT_EQ(bounds_shelf.ToString(), window->bounds().ToString()); + EXPECT_EQ(GetShelfWidget()->GetDimmerBoundsForTest(), + GetShelfWidget()->GetWindowBoundsInScreen()); + EXPECT_EQ(shelf_shown.ToString(), + GetShelfWidget()->GetWindowBoundsInScreen().ToString()); + + // Swipe down again to hide. + end = start + delta; + generator.GestureScrollSequenceWithCallback(start, end, + base::TimeDelta::FromMilliseconds(10), kNumScrollSteps, + base::Bind(&ShelfDragCallback::ProcessScroll, + base::Unretained(&handler))); + EXPECT_EQ(SHELF_AUTO_HIDE, shelf->visibility_state()); + EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf->auto_hide_state()); + EXPECT_EQ(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS, shelf->auto_hide_behavior()); + EXPECT_EQ(GetShelfWidget()->GetDimmerBoundsForTest(), gfx::Rect()); + EXPECT_EQ(bounds_noshelf.ToString(), window->bounds().ToString()); + EXPECT_EQ(shelf_hidden.ToString(), + GetShelfWidget()->GetWindowBoundsInScreen().ToString()); + // Make the window fullscreen. widget->SetFullscreen(true); gfx::Rect bounds_fullscreen = window->bounds(); EXPECT_TRUE(widget->IsFullscreen()); EXPECT_NE(bounds_noshelf.ToString(), bounds_fullscreen.ToString()); EXPECT_EQ(SHELF_HIDDEN, shelf->visibility_state()); + EXPECT_EQ(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS, shelf->auto_hide_behavior()); // Swipe-up. This should not change anything. + end = start - delta; generator.GestureScrollSequenceWithCallback(end, start, base::TimeDelta::FromMilliseconds(10), kNumScrollSteps, base::Bind(&ShelfDragCallback::ProcessScroll, diff --git a/ash/wm/gestures/border_gesture_handler.cc b/ash/wm/gestures/border_gesture_handler.cc deleted file mode 100644 index 5124ff1..0000000 --- a/ash/wm/gestures/border_gesture_handler.cc +++ /dev/null @@ -1,171 +0,0 @@ -// Copyright (c) 2013 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "ash/wm/gestures/border_gesture_handler.h" - -#include "ash/root_window_controller.h" -#include "ash/shelf/shelf_layout_manager.h" -#include "ash/shelf/shelf_types.h" -#include "ash/shelf/shelf_widget.h" -#include "ash/shell.h" -#include "base/command_line.h" -#include "base/string_util.h" -#include "base/strings/string_number_conversions.h" -#include "ui/aura/root_window.h" -#include "ui/base/events/event.h" -#include "ui/base/ui_base_switches.h" -#include "ui/gfx/screen.h" - -namespace ash { -namespace internal { - -BorderGestureHandler::BorderGestureHandler() - : orientation_(BORDER_SCROLL_ORIENTATION_UNSET) { -} - -BorderGestureHandler::~BorderGestureHandler() { -} - -bool BorderGestureHandler::ProcessGestureEvent(aura::Window* target, - const ui::GestureEvent& event) { - switch (event.type()) { - case ui::ET_GESTURE_SCROLL_BEGIN: - return HandleBorderGestureStart(target, event); - case ui::ET_GESTURE_SCROLL_UPDATE: - if (start_location_.any() && - DetermineGestureOrientation(event)) - return HandleBorderGestureUpdate(target, event); - break; - case ui::ET_GESTURE_SCROLL_END: - case ui::ET_SCROLL_FLING_START: - return HandleBorderGestureEnd(target, event); - default: - break; - } - // If the event is outside of the display region and targetted at the root - // window then it is on a bezel and not in another window. All bezel events - // should be consumed here since no other part of the stack handles them. - gfx::Rect screen = - Shell::GetScreen()->GetDisplayNearestWindow(target).bounds(); - if (!screen.Contains(event.location()) && - target == target->GetRootWindow()) - return true; - return false; -} - -bool BorderGestureHandler::HandleLauncherControl( - const ui::GestureEvent& event) { - ShelfLayoutManager* shelf = - Shell::GetPrimaryRootWindowController()->GetShelfLayoutManager(); - switch (shelf->GetAlignment()) { - case SHELF_ALIGNMENT_BOTTOM: - if (start_location_.test(BORDER_LOCATION_BOTTOM)) - return shelf_handler_.ProcessGestureEvent(event); - break; - case SHELF_ALIGNMENT_LEFT: - if (start_location_.test(BORDER_LOCATION_LEFT)) - return shelf_handler_.ProcessGestureEvent(event); - break; - case SHELF_ALIGNMENT_TOP: - if (start_location_.test(BORDER_LOCATION_TOP)) - return shelf_handler_.ProcessGestureEvent(event); - break; - case SHELF_ALIGNMENT_RIGHT: - if (start_location_.test(BORDER_LOCATION_RIGHT)) - return shelf_handler_.ProcessGestureEvent(event); - break; - } - return false; -} - -bool BorderGestureHandler::HandleBorderGestureStart( - aura::Window* target, - const ui::GestureEvent& event) { - orientation_ = BORDER_SCROLL_ORIENTATION_UNSET; - start_location_.reset(); - - gfx::Rect screen = - Shell::GetScreen()->GetDisplayNearestWindow(target).bounds(); - GestureStartInTargetArea(screen, event); - - if (start_location_.any()) - return HandleLauncherControl(event); - return false; -} - -bool BorderGestureHandler::HandleBorderGestureUpdate( - aura::Window* target, - const ui::GestureEvent& event) { - if (IsGestureInLauncherOrientation(event)) - return HandleLauncherControl(event); - return false; -} - -bool BorderGestureHandler::HandleBorderGestureEnd( - aura::Window* target, - const ui::GestureEvent& event) { - bool ret_val = HandleLauncherControl(event); - start_location_.reset(); - return ret_val; -} - -void BorderGestureHandler::GestureStartInTargetArea( - const gfx::Rect& screen, - const ui::GestureEvent& event) { - if (event.y() > screen.bottom()) - start_location_[BORDER_LOCATION_BOTTOM] = 1; - if (event.x() < screen.x()) - start_location_[BORDER_LOCATION_LEFT] = 1; - if (event.y() < screen.y()) - start_location_[BORDER_LOCATION_TOP] = 1; - if (event.x() > screen.right()) - start_location_[BORDER_LOCATION_RIGHT] = 1; -} - -bool BorderGestureHandler::DetermineGestureOrientation( - const ui::GestureEvent& event) { - if (orientation_ == BORDER_SCROLL_ORIENTATION_UNSET) { - if (!event.details().scroll_x() && !event.details().scroll_y()) - return false; - orientation_ = abs(event.details().scroll_y()) > - abs(event.details().scroll_x()) ? - BORDER_SCROLL_ORIENTATION_VERTICAL : - BORDER_SCROLL_ORIENTATION_HORIZONTAL; - } - return true; -} - -bool BorderGestureHandler::IsGestureInLauncherOrientation( - const ui::GestureEvent& event) { - BorderScrollOrientation new_orientation = abs(event.details().scroll_y()) > - abs(event.details().scroll_x()) ? - BORDER_SCROLL_ORIENTATION_VERTICAL : BORDER_SCROLL_ORIENTATION_HORIZONTAL; - if (new_orientation != orientation_) - return false; - - ShelfLayoutManager* shelf = - Shell::GetPrimaryRootWindowController()->GetShelfLayoutManager(); - switch (shelf->GetAlignment()) { - case SHELF_ALIGNMENT_BOTTOM: - if (orientation_ == BORDER_SCROLL_ORIENTATION_VERTICAL) - return true; - break; - case SHELF_ALIGNMENT_LEFT: - if (orientation_ == BORDER_SCROLL_ORIENTATION_HORIZONTAL) - return true; - break; - case SHELF_ALIGNMENT_TOP: - if (orientation_ == BORDER_SCROLL_ORIENTATION_VERTICAL) - return true; - break; - case SHELF_ALIGNMENT_RIGHT: - if (orientation_ == BORDER_SCROLL_ORIENTATION_HORIZONTAL) - return true; - break; - } - return false; -} - -} // namespace internal -} // namespace ash diff --git a/ash/wm/gestures/border_gesture_handler.h b/ash/wm/gestures/border_gesture_handler.h deleted file mode 100644 index fe188f2..0000000 --- a/ash/wm/gestures/border_gesture_handler.h +++ /dev/null @@ -1,103 +0,0 @@ -// Copyright (c) 2013 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef ASH_WM_GESTURES_BORDER_GESTURE_HANDLER_H_ -#define ASH_WM_GESTURES_BORDER_GESTURE_HANDLER_H_ - -#include <bitset> - -#include "ash/shelf/shelf_types.h" -#include "ash/wm/gestures/shelf_gesture_handler.h" -#include "base/basictypes.h" - -namespace aura { -class Window; -} - -namespace gfx { -class Point; -class Rect; -} - -namespace ui { -class GestureEvent; -} - -namespace ash { -namespace internal { - -enum BorderScrollOrientation { - BORDER_SCROLL_ORIENTATION_UNSET = 0, - BORDER_SCROLL_ORIENTATION_HORIZONTAL, - BORDER_SCROLL_ORIENTATION_VERTICAL -}; - -// Bit positions of border location flags -enum BorderLocation { - BORDER_LOCATION_BOTTOM = 0, - BORDER_LOCATION_LEFT = 1, - BORDER_LOCATION_TOP = 2, - BORDER_LOCATION_RIGHT = 3, - NUM_BORDER_LOCATIONS -}; - -typedef std::bitset<NUM_BORDER_LOCATIONS> BorderFlags; - -// Handles touch gestures that occur around the border of the display area that -// might have actions associated with them. It handles both gestures that -// require a bezel sensor (bezel gestures) and those that do not (edge -// gestures). -class BorderGestureHandler { - public: - BorderGestureHandler(); - ~BorderGestureHandler(); - - // Returns true of the gesture has been handled and it should not be processed - // any farther, false otherwise. - bool ProcessGestureEvent(aura::Window* target, const ui::GestureEvent& event); - - private: - // Handle events meant for showing the launcher. Returns true when no further - // events from this gesture should be sent. - bool HandleLauncherControl(const ui::GestureEvent& event); - - bool HandleBorderGestureStart(aura::Window* target, - const ui::GestureEvent& event); - - // Handles a gesture update once the orientation has been found. - bool HandleBorderGestureUpdate(aura::Window* target, - const ui::GestureEvent& event); - - bool HandleBorderGestureEnd(aura::Window* target, - const ui::GestureEvent& event); - - // Check that gesture starts on a bezel or in the edge region of the - // screen. If so, set bits in |start_location_|. - void GestureStartInTargetArea(const gfx::Rect& screen, - const ui::GestureEvent& event); - - // Determine the gesture orientation (if not yet done). - // Returns true when the orientation has been successfully determined. - bool DetermineGestureOrientation(const ui::GestureEvent& event); - - // Test if the gesture orientation makes sense to be dragging in or out the - // launcher. - bool IsGestureInLauncherOrientation(const ui::GestureEvent& event); - - // Which bezel/edges the gesture started in. In the case that a gesture begins - // in a corner of the screen more then one flag may be set and the orientation - // of the gesture will be needed to disambiguate. - BorderFlags start_location_; - - // Orientation relative to the screen that the gesture is moving in - BorderScrollOrientation orientation_; - - ShelfGestureHandler shelf_handler_; - - DISALLOW_COPY_AND_ASSIGN(BorderGestureHandler); -}; - -} // namespace internal -} // namespace ash -#endif // ASH_WM_GESTURES_BORDER_GESTURE_HANDLER_H_ diff --git a/ash/wm/system_gesture_event_filter.cc b/ash/wm/system_gesture_event_filter.cc index aff065b..029ab72 100644 --- a/ash/wm/system_gesture_event_filter.cc +++ b/ash/wm/system_gesture_event_filter.cc @@ -11,7 +11,6 @@ #include "ash/shell.h" #include "ash/shell_delegate.h" #include "ash/shell_window_ids.h" -#include "ash/wm/gestures/border_gesture_handler.h" #include "ash/wm/gestures/long_press_affordance_handler.h" #include "ash/wm/gestures/system_pinch_handler.h" #include "ash/wm/gestures/two_finger_drag_handler.h" @@ -45,7 +44,6 @@ namespace internal { SystemGestureEventFilter::SystemGestureEventFilter() : system_gestures_enabled_(CommandLine::ForCurrentProcess()-> HasSwitch(ash::switches::kAshEnableAdvancedGestures)), - border_gestures_(new BorderGestureHandler), long_press_affordance_(new LongPressAffordanceHandler), two_finger_drag_(new TwoFingerDragHandler) { } @@ -77,11 +75,6 @@ void SystemGestureEventFilter::OnGestureEvent(ui::GestureEvent* event) { long_press_affordance_->ProcessEvent(target, event, event->GetLowestTouchId()); - if (border_gestures_->ProcessGestureEvent(target, *event)) { - event->StopPropagation(); - return; - } - if (two_finger_drag_->ProcessGestureEvent(target, *event)) { event->StopPropagation(); return; diff --git a/ash/wm/system_gesture_event_filter.h b/ash/wm/system_gesture_event_filter.h index ed0a283..182ed5a 100644 --- a/ash/wm/system_gesture_event_filter.h +++ b/ash/wm/system_gesture_event_filter.h @@ -31,7 +31,6 @@ class SystemGestureEventFilterTest; } namespace internal { -class BorderGestureHandler; class LongPressAffordanceHandler; class SystemPinchHandler; class TouchUMA; @@ -67,7 +66,6 @@ class SystemGestureEventFilter : public ui::EventHandler, bool system_gestures_enabled_; - scoped_ptr<BorderGestureHandler> border_gestures_; scoped_ptr<LongPressAffordanceHandler> long_press_affordance_; scoped_ptr<TwoFingerDragHandler> two_finger_drag_; diff --git a/ash/wm/system_gesture_event_filter_unittest.cc b/ash/wm/system_gesture_event_filter_unittest.cc index 47954a0..c46ce88 100644 --- a/ash/wm/system_gesture_event_filter_unittest.cc +++ b/ash/wm/system_gesture_event_filter_unittest.cc @@ -236,41 +236,6 @@ ui::GestureEvent* CreateGesture(ui::EventType type, ui::GestureEventDetails(type, delta_x, delta_y), 1 << touch_id); } -// Ensure that events targeted at the root window are consumed by the -// system event handler. -TEST_F(SystemGestureEventFilterTest, TapOutsideRootWindow) { - aura::RootWindow* root_window = Shell::GetPrimaryRootWindow(); - - test::ShellTestApi shell_test(Shell::GetInstance()); - - const int kTouchId = 5; - - // A touch outside the root window will be associated with the root window - ui::TouchEvent press(ui::ET_TOUCH_PRESSED, - gfx::Point(-10, -10), - kTouchId, - ui::EventTimeForNow()); - root_window->AsRootWindowHostDelegate()->OnHostTouchEvent(&press); - - scoped_ptr<ui::GestureEvent> event(CreateGesture( - ui::ET_GESTURE_TAP, -10, -10, 1, 0, kTouchId)); - bool consumed = root_window->DispatchGestureEvent(event.get()); - - EXPECT_TRUE(consumed); - - // Without the event filter, the touch shouldn't be consumed by the - // system event handler. - Shell::GetInstance()->RemovePreTargetHandler( - shell_test.system_gesture_event_filter()); - - scoped_ptr<ui::GestureEvent> event2(CreateGesture( - ui::ET_GESTURE_TAP, 0, 0, 1, 0, kTouchId)); - consumed = root_window->DispatchGestureEvent(event2.get()); - - // The event filter doesn't exist, so the touch won't be consumed. - EXPECT_FALSE(consumed); -} - void MoveToDeviceControlBezelStartPosition( aura::RootWindow* root_window, DelegatePercentTracker* delegate, |