summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ash/drag_drop/drag_drop_controller.cc19
-rw-r--r--ash/drag_drop/drag_drop_controller.h2
-rw-r--r--ash/launcher/launcher_tooltip_manager.cc3
-rw-r--r--ash/launcher/launcher_tooltip_manager.h2
-rw-r--r--ash/launcher/launcher_tooltip_manager_unittest.cc8
-rw-r--r--ash/launcher/overflow_bubble.cc6
-rw-r--r--ash/magnifier/magnification_controller.cc12
-rw-r--r--ash/system/tray/tray_event_filter.cc9
-rw-r--r--ash/system/tray/tray_event_filter.h2
-rw-r--r--ash/tooltips/tooltip_controller.cc3
-rw-r--r--ash/tooltips/tooltip_controller.h2
-rw-r--r--ash/touch/touch_observer_hud.cc6
-rw-r--r--ash/touch/touch_observer_hud.h2
-rw-r--r--ash/wm/activation_controller.cc6
-rw-r--r--ash/wm/activation_controller.h4
-rw-r--r--ash/wm/system_gesture_event_filter.cc3
-rw-r--r--ash/wm/system_gesture_event_filter.h2
-rw-r--r--ash/wm/user_activity_detector.cc6
-rw-r--r--ash/wm/user_activity_detector.h4
-rw-r--r--ash/wm/user_activity_detector_unittest.cc3
-rw-r--r--ash/wm/window_modality_controller_unittest.cc4
-rw-r--r--ash/wm/workspace/workspace_cycler.cc10
-rw-r--r--ash/wm/workspace/workspace_cycler.h2
-rw-r--r--chrome/browser/ui/views/ash/tab_scrubber.cc10
-rw-r--r--chrome/browser/ui/views/ash/tab_scrubber.h2
-rw-r--r--content/browser/renderer_host/render_widget_host_view_aura.cc15
-rw-r--r--content/browser/renderer_host/render_widget_host_view_aura.h4
-rw-r--r--content/browser/renderer_host/render_widget_host_view_aura_unittest.cc43
-rw-r--r--ui/app_list/contents_view.cc6
-rw-r--r--ui/app_list/contents_view.h2
-rw-r--r--ui/aura/gestures/gesture_recognizer_unittest.cc12
-rw-r--r--ui/aura/root_window_unittest.cc6
-rw-r--r--ui/aura/test/test_event_handler.cc6
-rw-r--r--ui/aura/test/test_event_handler.h4
-rw-r--r--ui/aura/window_unittest.cc3
-rw-r--r--ui/base/events/event_dispatcher_unittest.cc12
-rw-r--r--ui/base/events/event_handler.cc10
-rw-r--r--ui/base/events/event_handler.h4
-rw-r--r--ui/base/events/event_target.cc11
-rw-r--r--ui/base/events/event_target.h4
-rw-r--r--ui/views/corewm/compound_event_filter.cc20
-rw-r--r--ui/views/corewm/compound_event_filter.h6
-rw-r--r--ui/views/corewm/focus_controller.cc6
-rw-r--r--ui/views/corewm/focus_controller.h4
-rw-r--r--ui/views/corewm/window_modality_controller.cc6
-rw-r--r--ui/views/corewm/window_modality_controller.h2
-rw-r--r--ui/views/view.cc10
-rw-r--r--ui/views/view.h9
-rw-r--r--ui/views/view_unittest.cc23
-rw-r--r--ui/views/widget/desktop_aura/desktop_activation_client.cc6
-rw-r--r--ui/views/widget/desktop_aura/desktop_activation_client.h4
-rw-r--r--ui/views/widget/desktop_aura/desktop_native_widget_aura.cc18
-rw-r--r--ui/views/widget/desktop_aura/desktop_native_widget_aura.h4
-rw-r--r--ui/views/widget/native_widget_aura.cc18
-rw-r--r--ui/views/widget/native_widget_aura.h4
-rw-r--r--ui/views/widget/native_widget_delegate.h4
-rw-r--r--ui/views/widget/root_view.cc34
-rw-r--r--ui/views/widget/root_view.h4
-rw-r--r--ui/views/widget/widget.cc8
-rw-r--r--ui/views/widget/widget.h4
60 files changed, 233 insertions, 235 deletions
diff --git a/ash/drag_drop/drag_drop_controller.cc b/ash/drag_drop/drag_drop_controller.cc
index 4248099..f3d0343 100644
--- a/ash/drag_drop/drag_drop_controller.cc
+++ b/ash/drag_drop/drag_drop_controller.cc
@@ -325,23 +325,20 @@ ui::EventResult DragDropController::OnMouseEvent(ui::MouseEvent* event) {
return ui::ER_CONSUMED;
}
-ui::EventResult DragDropController::OnTouchEvent(ui::TouchEvent* event) {
+void DragDropController::OnTouchEvent(ui::TouchEvent* event) {
if (!IsDragDropInProgress())
- return ui::ER_UNHANDLED;
+ return;
// If current drag session was not started by touch, dont process this touch
// event, but consume it so it does not interfere with current drag session.
if (current_drag_event_source_ != ui::DragDropTypes::DRAG_EVENT_SOURCE_TOUCH)
- return ui::ER_CONSUMED;
+ event->StopPropagation();
- switch (event->type()) {
- case ui::ET_TOUCH_CANCELLED:
- DragCancel();
- break;
- default:
- break;
- }
- return ui::ER_UNHANDLED;
+ if (event->handled())
+ return;
+
+ if (event->type() == ui::ET_TOUCH_CANCELLED)
+ DragCancel();
}
void DragDropController::OnGestureEvent(ui::GestureEvent* event) {
diff --git a/ash/drag_drop/drag_drop_controller.h b/ash/drag_drop/drag_drop_controller.h
index 6fe58a1..bef79a0 100644
--- a/ash/drag_drop/drag_drop_controller.h
+++ b/ash/drag_drop/drag_drop_controller.h
@@ -67,7 +67,7 @@ class ASH_EXPORT DragDropController
// Overridden from ui::EventHandler:
virtual ui::EventResult OnKeyEvent(ui::KeyEvent* event) OVERRIDE;
virtual ui::EventResult OnMouseEvent(ui::MouseEvent* event) OVERRIDE;
- virtual ui::EventResult OnTouchEvent(ui::TouchEvent* event) OVERRIDE;
+ virtual void OnTouchEvent(ui::TouchEvent* event) OVERRIDE;
virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE;
// Overridden from aura::WindowObserver.
diff --git a/ash/launcher/launcher_tooltip_manager.cc b/ash/launcher/launcher_tooltip_manager.cc
index f99e552..dfc2a4b 100644
--- a/ash/launcher/launcher_tooltip_manager.cc
+++ b/ash/launcher/launcher_tooltip_manager.cc
@@ -278,11 +278,10 @@ ui::EventResult LauncherTooltipManager::OnMouseEvent(ui::MouseEvent* event) {
return ui::ER_UNHANDLED;
}
-ui::EventResult LauncherTooltipManager::OnTouchEvent(ui::TouchEvent* event) {
+void LauncherTooltipManager::OnTouchEvent(ui::TouchEvent* event) {
aura::Window* target = static_cast<aura::Window*>(event->target());
if (widget_ && widget_->IsVisible() && widget_->GetNativeWindow() != target)
Close();
- return ui::ER_UNHANDLED;
}
void LauncherTooltipManager::OnGestureEvent(ui::GestureEvent* event) {
diff --git a/ash/launcher/launcher_tooltip_manager.h b/ash/launcher/launcher_tooltip_manager.h
index 8bb764f..a4e28c5 100644
--- a/ash/launcher/launcher_tooltip_manager.h
+++ b/ash/launcher/launcher_tooltip_manager.h
@@ -77,7 +77,7 @@ class ASH_EXPORT LauncherTooltipManager : public ui::EventHandler,
protected:
// ui::EventHandler overrides:
virtual ui::EventResult OnMouseEvent(ui::MouseEvent* event) OVERRIDE;
- virtual ui::EventResult OnTouchEvent(ui::TouchEvent* event) OVERRIDE;
+ virtual void OnTouchEvent(ui::TouchEvent* event) OVERRIDE;
virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE;
// SessionStateObserver override:
diff --git a/ash/launcher/launcher_tooltip_manager_unittest.cc b/ash/launcher/launcher_tooltip_manager_unittest.cc
index c6d81dd..e1464da 100644
--- a/ash/launcher/launcher_tooltip_manager_unittest.cc
+++ b/ash/launcher/launcher_tooltip_manager_unittest.cc
@@ -164,16 +164,16 @@ TEST_F(LauncherTooltipManagerTest, ShouldHideForEvents) {
ui::TouchEvent touch_event(
ui::ET_TOUCH_PRESSED, gfx::Point(), 0, base::TimeDelta());
SetEventTarget(root_window, &touch_event);
- EXPECT_EQ(ui::ER_UNHANDLED,
- event_handler->OnTouchEvent(&touch_event));
+ event_handler->OnTouchEvent(&touch_event);
+ EXPECT_FALSE(touch_event.handled());
EXPECT_FALSE(TooltipIsVisible());
// Shouldn't hide if the touch happens on the tooltip.
ShowImmediately();
views::Widget* tooltip_widget = GetTooltipWidget();
SetEventTarget(tooltip_widget->GetNativeWindow(), &touch_event);
- EXPECT_EQ(ui::ER_UNHANDLED,
- event_handler->OnTouchEvent(&touch_event));
+ event_handler->OnTouchEvent(&touch_event);
+ EXPECT_FALSE(touch_event.handled());
EXPECT_TRUE(TooltipIsVisible());
// Should hide for gesture events.
diff --git a/ash/launcher/overflow_bubble.cc b/ash/launcher/overflow_bubble.cc
index d2f889e..06a0f52 100644
--- a/ash/launcher/overflow_bubble.cc
+++ b/ash/launcher/overflow_bubble.cc
@@ -74,7 +74,7 @@ class OverflowBubbleView : public views::BubbleDelegateView {
virtual bool OnMouseWheel(const ui::MouseWheelEvent& event) OVERRIDE;
// ui::EventHandler overrides:
- virtual ui::EventResult OnScrollEvent(ui::ScrollEvent* event) OVERRIDE;
+ virtual void OnScrollEvent(ui::ScrollEvent* event) OVERRIDE;
// views::BubbleDelegate overrides:
virtual gfx::Rect GetBubbleBounds() OVERRIDE;
@@ -185,11 +185,11 @@ bool OverflowBubbleView::OnMouseWheel(const ui::MouseWheelEvent& event) {
return true;
}
-ui::EventResult OverflowBubbleView::OnScrollEvent(ui::ScrollEvent* event) {
+void OverflowBubbleView::OnScrollEvent(ui::ScrollEvent* event) {
ScrollByXOffset(-event->x_offset());
ScrollByYOffset(-event->y_offset());
Layout();
- return ui::ER_HANDLED;
+ event->SetHandled();
}
gfx::Rect OverflowBubbleView::GetBubbleBounds() {
diff --git a/ash/magnifier/magnification_controller.cc b/ash/magnifier/magnification_controller.cc
index b7e90c1..0912e37 100644
--- a/ash/magnifier/magnification_controller.cc
+++ b/ash/magnifier/magnification_controller.cc
@@ -115,7 +115,7 @@ class MagnificationControllerImpl : virtual public MagnificationController,
// ui::EventHandler overrides:
virtual ui::EventResult OnMouseEvent(ui::MouseEvent* event) OVERRIDE;
- virtual ui::EventResult OnScrollEvent(ui::ScrollEvent* event) OVERRIDE;
+ virtual void OnScrollEvent(ui::ScrollEvent* event) OVERRIDE;
aura::RootWindow* root_window_;
@@ -506,12 +506,13 @@ ui::EventResult MagnificationControllerImpl::OnMouseEvent(
return ui::ER_UNHANDLED;
}
-ui::EventResult MagnificationControllerImpl::OnScrollEvent(
+void MagnificationControllerImpl::OnScrollEvent(
ui::ScrollEvent* event) {
if (event->IsAltDown() && event->IsControlDown()) {
if (event->type() == ui::ET_SCROLL_FLING_START ||
event->type() == ui::ET_SCROLL_FLING_CANCEL) {
- return ui::ER_CONSUMED;
+ event->StopPropagation();
+ return;
}
if (event->type() == ui::ET_SCROLL) {
@@ -519,11 +520,10 @@ ui::EventResult MagnificationControllerImpl::OnScrollEvent(
float scale = GetScale();
scale += scroll_event->y_offset() * kScrollScaleChangeFactor;
SetScale(scale, true);
- return ui::ER_CONSUMED;
+ event->StopPropagation();
+ return;
}
}
-
- return ui::ER_UNHANDLED;
}
////////////////////////////////////////////////////////////////////////////////
diff --git a/ash/system/tray/tray_event_filter.cc b/ash/system/tray/tray_event_filter.cc
index 01a751b..e1a223c 100644
--- a/ash/system/tray/tray_event_filter.cc
+++ b/ash/system/tray/tray_event_filter.cc
@@ -36,12 +36,9 @@ ui::EventResult TrayEventFilter::OnMouseEvent(ui::MouseEvent* event) {
return ui::ER_UNHANDLED;
}
-ui::EventResult TrayEventFilter::OnTouchEvent(ui::TouchEvent* event) {
- if (event->type() == ui::ET_TOUCH_PRESSED &&
- ProcessLocatedEvent(event)) {
- return ui::ER_CONSUMED;
- }
- return ui::ER_UNHANDLED;
+void TrayEventFilter::OnTouchEvent(ui::TouchEvent* event) {
+ if (event->type() == ui::ET_TOUCH_PRESSED && ProcessLocatedEvent(event))
+ event->StopPropagation();
}
bool TrayEventFilter::ProcessLocatedEvent(ui::LocatedEvent* event) {
diff --git a/ash/system/tray/tray_event_filter.h b/ash/system/tray/tray_event_filter.h
index dd86f3b..65fec335 100644
--- a/ash/system/tray/tray_event_filter.h
+++ b/ash/system/tray/tray_event_filter.h
@@ -27,7 +27,7 @@ class TrayEventFilter : public ui::EventHandler {
// Overridden from ui::EventHandler.
virtual ui::EventResult OnMouseEvent(ui::MouseEvent* event) OVERRIDE;
- virtual ui::EventResult OnTouchEvent(ui::TouchEvent* event) OVERRIDE;
+ virtual void OnTouchEvent(ui::TouchEvent* event) OVERRIDE;
private:
// Returns true if the event is handled.
diff --git a/ash/tooltips/tooltip_controller.cc b/ash/tooltips/tooltip_controller.cc
index 1639419dd..21dcab5 100644
--- a/ash/tooltips/tooltip_controller.cc
+++ b/ash/tooltips/tooltip_controller.cc
@@ -302,7 +302,7 @@ ui::EventResult TooltipController::OnMouseEvent(ui::MouseEvent* event) {
return ui::ER_UNHANDLED;
}
-ui::EventResult TooltipController::OnTouchEvent(ui::TouchEvent* event) {
+void TooltipController::OnTouchEvent(ui::TouchEvent* event) {
// TODO(varunjain): need to properly implement tooltips for
// touch events.
// Hide the tooltip for touch events.
@@ -311,7 +311,6 @@ ui::EventResult TooltipController::OnTouchEvent(ui::TouchEvent* event) {
if (tooltip_window_)
tooltip_window_->RemoveObserver(this);
tooltip_window_ = NULL;
- return ui::ER_UNHANDLED;
}
void TooltipController::OnSessionStateEvent(
diff --git a/ash/tooltips/tooltip_controller.h b/ash/tooltips/tooltip_controller.h
index dc21527..d07f181 100644
--- a/ash/tooltips/tooltip_controller.h
+++ b/ash/tooltips/tooltip_controller.h
@@ -46,7 +46,7 @@ class ASH_EXPORT TooltipController : public aura::client::TooltipClient,
// Overridden from ui::EventHandler.
virtual ui::EventResult OnKeyEvent(ui::KeyEvent* event) OVERRIDE;
virtual ui::EventResult OnMouseEvent(ui::MouseEvent* event) OVERRIDE;
- virtual ui::EventResult OnTouchEvent(ui::TouchEvent* event) OVERRIDE;
+ virtual void OnTouchEvent(ui::TouchEvent* event) OVERRIDE;
// Overridden from SessionStateController.
virtual void OnSessionStateEvent(SessionStateObserver::EventType event)
diff --git a/ash/touch/touch_observer_hud.cc b/ash/touch/touch_observer_hud.cc
index 22dc029..176e52f 100644
--- a/ash/touch/touch_observer_hud.cc
+++ b/ash/touch/touch_observer_hud.cc
@@ -182,9 +182,9 @@ void TouchObserverHUD::UpdateTouchPointLabel(int index) {
touch_labels_[index]->SetText(UTF8ToUTF16(string));
}
-ui::EventResult TouchObserverHUD::OnTouchEvent(ui::TouchEvent* event) {
+void TouchObserverHUD::OnTouchEvent(ui::TouchEvent* event) {
if (event->touch_id() >= kMaxTouchPoints)
- return ui::ER_UNHANDLED;
+ return;
if (event->type() != ui::ET_TOUCH_CANCELLED)
touch_positions_[event->touch_id()] = event->root_location();
@@ -197,8 +197,6 @@ ui::EventResult TouchObserverHUD::OnTouchEvent(ui::TouchEvent* event) {
UpdateTouchPointLabel(event->touch_id());
widget_->SetSize(widget_->GetContentsView()->GetPreferredSize());
-
- return ui::ER_UNHANDLED;
}
void TouchObserverHUD::OnWidgetClosing(views::Widget* widget) {
diff --git a/ash/touch/touch_observer_hud.h b/ash/touch/touch_observer_hud.h
index 03c1bac..acee910 100644
--- a/ash/touch/touch_observer_hud.h
+++ b/ash/touch/touch_observer_hud.h
@@ -35,7 +35,7 @@ class TouchObserverHUD : public ui::EventHandler,
void UpdateTouchPointLabel(int index);
// Overriden from ui::EventHandler:
- virtual ui::EventResult OnTouchEvent(ui::TouchEvent* event) OVERRIDE;
+ virtual void OnTouchEvent(ui::TouchEvent* event) OVERRIDE;
// Overridden from views::WidgetObserver:
virtual void OnWidgetClosing(views::Widget* widget) OVERRIDE;
diff --git a/ash/wm/activation_controller.cc b/ash/wm/activation_controller.cc
index 274ab56..5544078 100644
--- a/ash/wm/activation_controller.cc
+++ b/ash/wm/activation_controller.cc
@@ -282,14 +282,12 @@ ui::EventResult ActivationController::OnMouseEvent(ui::MouseEvent* event) {
return ui::ER_UNHANDLED;
}
-ui::EventResult ActivationController::OnScrollEvent(ui::ScrollEvent* event) {
- return ui::ER_UNHANDLED;
+void ActivationController::OnScrollEvent(ui::ScrollEvent* event) {
}
-ui::EventResult ActivationController::OnTouchEvent(ui::TouchEvent* event) {
+void ActivationController::OnTouchEvent(ui::TouchEvent* event) {
if (event->type() == ui::ET_TOUCH_PRESSED)
FocusWindowWithEvent(event);
- return ui::ER_UNHANDLED;
}
void ActivationController::OnGestureEvent(ui::GestureEvent* event) {
diff --git a/ash/wm/activation_controller.h b/ash/wm/activation_controller.h
index 24bf0508..23fe737 100644
--- a/ash/wm/activation_controller.h
+++ b/ash/wm/activation_controller.h
@@ -77,8 +77,8 @@ class ASH_EXPORT ActivationController
// Overridden from ui::EventHandler:
virtual ui::EventResult OnKeyEvent(ui::KeyEvent* event) OVERRIDE;
virtual ui::EventResult OnMouseEvent(ui::MouseEvent* event) OVERRIDE;
- virtual ui::EventResult OnScrollEvent(ui::ScrollEvent* event) OVERRIDE;
- virtual ui::EventResult OnTouchEvent(ui::TouchEvent* event) OVERRIDE;
+ virtual void OnScrollEvent(ui::ScrollEvent* event) OVERRIDE;
+ virtual void OnTouchEvent(ui::TouchEvent* event) OVERRIDE;
virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE;
// Implementation of ActivateWindow() with an Event.
diff --git a/ash/wm/system_gesture_event_filter.cc b/ash/wm/system_gesture_event_filter.cc
index 57aecd4..019cf53 100644
--- a/ash/wm/system_gesture_event_filter.cc
+++ b/ash/wm/system_gesture_event_filter.cc
@@ -65,11 +65,10 @@ ui::EventResult SystemGestureEventFilter::OnMouseEvent(ui::MouseEvent* event) {
return ui::ER_UNHANDLED;
}
-ui::EventResult SystemGestureEventFilter::OnTouchEvent(ui::TouchEvent* event) {
+void SystemGestureEventFilter::OnTouchEvent(ui::TouchEvent* event) {
aura::Window* target = static_cast<aura::Window*>(event->target());
touch_uma_.RecordTouchEvent(target, *event);
long_press_affordance_->ProcessEvent(target, event, event->touch_id());
- return ui::ER_UNHANDLED;
}
void SystemGestureEventFilter::OnGestureEvent(ui::GestureEvent* event) {
diff --git a/ash/wm/system_gesture_event_filter.h b/ash/wm/system_gesture_event_filter.h
index 961929e..984604d 100644
--- a/ash/wm/system_gesture_event_filter.h
+++ b/ash/wm/system_gesture_event_filter.h
@@ -46,7 +46,7 @@ class SystemGestureEventFilter : public ui::EventHandler,
// Overridden from ui::EventHandler:
virtual ui::EventResult OnMouseEvent(ui::MouseEvent* event) OVERRIDE;
- virtual ui::EventResult OnTouchEvent(ui::TouchEvent* event) OVERRIDE;
+ virtual void OnTouchEvent(ui::TouchEvent* event) OVERRIDE;
virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE;
// Overridden from aura::WindowObserver.
diff --git a/ash/wm/user_activity_detector.cc b/ash/wm/user_activity_detector.cc
index ee6a2b7..4338acc 100644
--- a/ash/wm/user_activity_detector.cc
+++ b/ash/wm/user_activity_detector.cc
@@ -48,14 +48,12 @@ ui::EventResult UserActivityDetector::OnMouseEvent(ui::MouseEvent* event) {
return ui::ER_UNHANDLED;
}
-ui::EventResult UserActivityDetector::OnScrollEvent(ui::ScrollEvent* event) {
+void UserActivityDetector::OnScrollEvent(ui::ScrollEvent* event) {
MaybeNotify();
- return ui::ER_UNHANDLED;
}
-ui::EventResult UserActivityDetector::OnTouchEvent(ui::TouchEvent* event) {
+void UserActivityDetector::OnTouchEvent(ui::TouchEvent* event) {
MaybeNotify();
- return ui::ER_UNHANDLED;
}
void UserActivityDetector::OnGestureEvent(ui::GestureEvent* event) {
diff --git a/ash/wm/user_activity_detector.h b/ash/wm/user_activity_detector.h
index b28b9ec..89a2518 100644
--- a/ash/wm/user_activity_detector.h
+++ b/ash/wm/user_activity_detector.h
@@ -37,8 +37,8 @@ class ASH_EXPORT UserActivityDetector : public ui::EventHandler {
// ui::EventHandler implementation.
virtual ui::EventResult OnKeyEvent(ui::KeyEvent* event) OVERRIDE;
virtual ui::EventResult OnMouseEvent(ui::MouseEvent* event) OVERRIDE;
- virtual ui::EventResult OnScrollEvent(ui::ScrollEvent* event) OVERRIDE;
- virtual ui::EventResult OnTouchEvent(ui::TouchEvent* event) OVERRIDE;
+ virtual void OnScrollEvent(ui::ScrollEvent* event) OVERRIDE;
+ virtual void OnTouchEvent(ui::TouchEvent* event) OVERRIDE;
virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE;
private:
diff --git a/ash/wm/user_activity_detector_unittest.cc b/ash/wm/user_activity_detector_unittest.cc
index 2aa0ef5f..1e3105b 100644
--- a/ash/wm/user_activity_detector_unittest.cc
+++ b/ash/wm/user_activity_detector_unittest.cc
@@ -117,7 +117,8 @@ TEST_F(UserActivityDetectorTest, Basic) {
ui::TouchEvent touch_event(
ui::ET_TOUCH_PRESSED, gfx::Point(), 0, base::TimeDelta());
SetEventTarget(window.get(), &touch_event);
- EXPECT_EQ(ui::ER_UNHANDLED, detector_->OnTouchEvent(&touch_event));
+ detector_->OnTouchEvent(&touch_event);
+ EXPECT_FALSE(touch_event.handled());
EXPECT_EQ(1, observer_->num_invocations());
observer_->reset_stats();
diff --git a/ash/wm/window_modality_controller_unittest.cc b/ash/wm/window_modality_controller_unittest.cc
index 94a647c..65927af 100644
--- a/ash/wm/window_modality_controller_unittest.cc
+++ b/ash/wm/window_modality_controller_unittest.cc
@@ -298,9 +298,9 @@ class TouchTrackerWindowDelegate : public aura::test::TestWindowDelegate {
private:
// Overridden from aura::test::TestWindowDelegate.
- virtual ui::EventResult OnTouchEvent(ui::TouchEvent* event) OVERRIDE {
+ virtual void OnTouchEvent(ui::TouchEvent* event) OVERRIDE {
received_touch_ = true;
- return aura::test::TestWindowDelegate::OnTouchEvent(event);
+ aura::test::TestWindowDelegate::OnTouchEvent(event);
}
bool received_touch_;
diff --git a/ash/wm/workspace/workspace_cycler.cc b/ash/wm/workspace/workspace_cycler.cc
index 3e6878b..1080bb0 100644
--- a/ash/wm/workspace/workspace_cycler.cc
+++ b/ash/wm/workspace/workspace_cycler.cc
@@ -39,16 +39,16 @@ WorkspaceCycler::~WorkspaceCycler() {
ash::Shell::GetInstance()->RemovePreTargetHandler(this);
}
-ui::EventResult WorkspaceCycler::OnScrollEvent(ui::ScrollEvent* event) {
+void WorkspaceCycler::OnScrollEvent(ui::ScrollEvent* event) {
if (event->finger_count() != 3 ||
event->type() != ui::ET_SCROLL) {
scrubbing_ = false;
- return ui::ER_UNHANDLED;
+ return;
}
if (!IsScrubbingEnabled()) {
scrubbing_ = false;
- return ui::ER_UNHANDLED;
+ return;
}
if (!scrubbing_) {
@@ -73,7 +73,8 @@ ui::EventResult WorkspaceCycler::OnScrollEvent(ui::ScrollEvent* event) {
scroll_x_ = 0;
scroll_y_ = 0;
- return ui::ER_HANDLED;
+ event->SetHandled();
+ return;
}
if (std::abs(scroll_x_) > kWorkspaceStepSize) {
@@ -86,7 +87,6 @@ ui::EventResult WorkspaceCycler::OnScrollEvent(ui::ScrollEvent* event) {
}
// The active workspace was not changed, do not consume the event.
- return ui::ER_UNHANDLED;
}
} // namespace internal
diff --git a/ash/wm/workspace/workspace_cycler.h b/ash/wm/workspace/workspace_cycler.h
index e828006..032f54c 100644
--- a/ash/wm/workspace/workspace_cycler.h
+++ b/ash/wm/workspace/workspace_cycler.h
@@ -24,7 +24,7 @@ class ASH_EXPORT WorkspaceCycler : public ui::EventHandler {
private:
// ui::EventHandler overrides:
- virtual ui::EventResult OnScrollEvent(ui::ScrollEvent* event) OVERRIDE;
+ virtual void OnScrollEvent(ui::ScrollEvent* event) OVERRIDE;
WorkspaceManager* workspace_manager_;
diff --git a/chrome/browser/ui/views/ash/tab_scrubber.cc b/chrome/browser/ui/views/ash/tab_scrubber.cc
index f59f78e..6a92bf1 100644
--- a/chrome/browser/ui/views/ash/tab_scrubber.cc
+++ b/chrome/browser/ui/views/ash/tab_scrubber.cc
@@ -50,22 +50,22 @@ TabScrubber::TabScrubber()
TabScrubber::~TabScrubber() {
}
-ui::EventResult TabScrubber::OnScrollEvent(ui::ScrollEvent* event) {
+void TabScrubber::OnScrollEvent(ui::ScrollEvent* event) {
if (event->type() == ui::ET_SCROLL_FLING_CANCEL) {
if (scrubbing_)
StopScrubbing();
- return ui::ER_UNHANDLED;
+ return;
}
if (event->finger_count() != 3 ||
event->type() != ui::ET_SCROLL)
- return ui::ER_UNHANDLED;
+ return;
Browser* browser = GetActiveBrowser();
if (!browser || (browser_ && browser != browser_)) {
if (scrubbing_)
StopScrubbing();
- return ui::ER_UNHANDLED;
+ return;
}
BrowserView* browser_view =
@@ -106,7 +106,7 @@ ui::EventResult TabScrubber::OnScrollEvent(ui::ScrollEvent* event) {
browser->tab_strip_model()->ActivateTabAt(new_index, true);
}
- return ui::ER_CONSUMED;
+ event->StopPropagation();
}
void TabScrubber::Observe(int type,
diff --git a/chrome/browser/ui/views/ash/tab_scrubber.h b/chrome/browser/ui/views/ash/tab_scrubber.h
index 5280938..8ba03d5 100644
--- a/chrome/browser/ui/views/ash/tab_scrubber.h
+++ b/chrome/browser/ui/views/ash/tab_scrubber.h
@@ -26,7 +26,7 @@ class TabScrubber : public ui::EventHandler,
virtual ~TabScrubber();
// ui::EventHandler overrides:
- virtual ui::EventResult OnScrollEvent(ui::ScrollEvent* event) OVERRIDE;
+ virtual void OnScrollEvent(ui::ScrollEvent* event) OVERRIDE;
// content::NotificationObserver overrides:
virtual void Observe(int type,
diff --git a/content/browser/renderer_host/render_widget_host_view_aura.cc b/content/browser/renderer_host/render_widget_host_view_aura.cc
index 81ee608..aa07886 100644
--- a/content/browser/renderer_host/render_widget_host_view_aura.cc
+++ b/content/browser/renderer_host/render_widget_host_view_aura.cc
@@ -1585,8 +1585,7 @@ ui::EventResult RenderWidgetHostViewAura::OnMouseEvent(ui::MouseEvent* event) {
return ui::ER_HANDLED;
}
-ui::EventResult RenderWidgetHostViewAura::OnScrollEvent(
- ui::ScrollEvent* event) {
+void RenderWidgetHostViewAura::OnScrollEvent(ui::ScrollEvent* event) {
TRACE_EVENT0("browser", "RenderWidgetHostViewAura::OnScrollEvent");
if (event->type() == ui::ET_SCROLL) {
WebKit::WebGestureEvent gesture_event =
@@ -1604,10 +1603,11 @@ ui::EventResult RenderWidgetHostViewAura::OnScrollEvent(
if (event->type() == ui::ET_SCROLL_FLING_START)
RecordAction(UserMetricsAction("TrackpadScrollFling"));
}
- return ui::ER_HANDLED;
+
+ event->SetHandled();
}
-ui::EventResult RenderWidgetHostViewAura::OnTouchEvent(ui::TouchEvent* event) {
+void RenderWidgetHostViewAura::OnTouchEvent(ui::TouchEvent* event) {
TRACE_EVENT0("browser", "RenderWidgetHostViewAura::OnTouchEvent");
// Update the touch event first.
WebKit::WebTouchPoint* point = UpdateWebTouchEventFromUIEvent(*event,
@@ -1619,15 +1619,14 @@ ui::EventResult RenderWidgetHostViewAura::OnTouchEvent(ui::TouchEvent* event) {
// handler in the page, or some touch-event is already in the queue, even if
// no point has been updated, to make sure that this event does not get
// processed by the gesture recognizer before the events in the queue.
- ui::EventResult result = host_->ShouldForwardTouchEvent() ? ui::ER_CONSUMED :
- ui::ER_UNHANDLED;
+ if (host_->ShouldForwardTouchEvent())
+ event->StopPropagation();
+
if (point) {
if (host_->ShouldForwardTouchEvent())
host_->ForwardTouchEvent(touch_event_);
UpdateWebTouchEventAfterDispatch(&touch_event_, point);
}
-
- return result;
}
void RenderWidgetHostViewAura::OnGestureEvent(ui::GestureEvent* event) {
diff --git a/content/browser/renderer_host/render_widget_host_view_aura.h b/content/browser/renderer_host/render_widget_host_view_aura.h
index f50e918..710c5cf 100644
--- a/content/browser/renderer_host/render_widget_host_view_aura.h
+++ b/content/browser/renderer_host/render_widget_host_view_aura.h
@@ -198,8 +198,8 @@ class RenderWidgetHostViewAura
// Overridden from ui::EventHandler:
virtual ui::EventResult OnKeyEvent(ui::KeyEvent* event) OVERRIDE;
virtual ui::EventResult OnMouseEvent(ui::MouseEvent* event) OVERRIDE;
- virtual ui::EventResult OnScrollEvent(ui::ScrollEvent* event) OVERRIDE;
- virtual ui::EventResult OnTouchEvent(ui::TouchEvent* event) OVERRIDE;
+ virtual void OnScrollEvent(ui::ScrollEvent* event) OVERRIDE;
+ virtual void OnTouchEvent(ui::TouchEvent* event) OVERRIDE;
virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE;
// Overridden from aura::client::ActivationDelegate:
diff --git a/content/browser/renderer_host/render_widget_host_view_aura_unittest.cc b/content/browser/renderer_host/render_widget_host_view_aura_unittest.cc
index e4b6181..7c86610 100644
--- a/content/browser/renderer_host/render_widget_host_view_aura_unittest.cc
+++ b/content/browser/renderer_host/render_widget_host_view_aura_unittest.cc
@@ -180,19 +180,22 @@ TEST_F(RenderWidgetHostViewAuraTest, TouchEventState) {
ui::TouchEvent release(ui::ET_TOUCH_RELEASED, gfx::Point(20, 20), 0,
base::Time::NowFromSystemTime() - base::Time());
- EXPECT_EQ(ui::ER_UNHANDLED, view_->OnTouchEvent(&press));
+ view_->OnTouchEvent(&press);
+ EXPECT_FALSE(press.handled());
EXPECT_EQ(WebKit::WebInputEvent::TouchStart, view_->touch_event_.type);
EXPECT_EQ(1U, view_->touch_event_.touchesLength);
EXPECT_EQ(WebKit::WebTouchPoint::StatePressed,
view_->touch_event_.touches[0].state);
- EXPECT_EQ(ui::ER_UNHANDLED, view_->OnTouchEvent(&move));
+ view_->OnTouchEvent(&move);
+ EXPECT_FALSE(move.handled());
EXPECT_EQ(WebKit::WebInputEvent::TouchMove, view_->touch_event_.type);
EXPECT_EQ(1U, view_->touch_event_.touchesLength);
EXPECT_EQ(WebKit::WebTouchPoint::StateMoved,
view_->touch_event_.touches[0].state);
- EXPECT_EQ(ui::ER_UNHANDLED, view_->OnTouchEvent(&release));
+ view_->OnTouchEvent(&release);
+ EXPECT_FALSE(release.handled());
EXPECT_EQ(WebKit::WebInputEvent::TouchEnd, view_->touch_event_.type);
EXPECT_EQ(0U, view_->touch_event_.touchesLength);
@@ -202,24 +205,28 @@ TEST_F(RenderWidgetHostViewAuraTest, TouchEventState) {
widget_host_->OnMessageReceived(ViewHostMsg_HasTouchEventHandlers(0, true));
EXPECT_TRUE(widget_host_->ShouldForwardTouchEvent());
- EXPECT_EQ(ui::ER_CONSUMED, view_->OnTouchEvent(&press));
+ view_->OnTouchEvent(&press);
+ EXPECT_TRUE(press.stopped_propagation());
EXPECT_EQ(WebKit::WebInputEvent::TouchStart, view_->touch_event_.type);
EXPECT_EQ(1U, view_->touch_event_.touchesLength);
EXPECT_EQ(WebKit::WebTouchPoint::StatePressed,
view_->touch_event_.touches[0].state);
- EXPECT_EQ(ui::ER_CONSUMED, view_->OnTouchEvent(&move));
+ view_->OnTouchEvent(&move);
+ EXPECT_TRUE(move.stopped_propagation());
EXPECT_EQ(WebKit::WebInputEvent::TouchMove, view_->touch_event_.type);
EXPECT_EQ(1U, view_->touch_event_.touchesLength);
EXPECT_EQ(WebKit::WebTouchPoint::StateMoved,
view_->touch_event_.touches[0].state);
- EXPECT_EQ(ui::ER_CONSUMED, view_->OnTouchEvent(&release));
+ view_->OnTouchEvent(&release);
+ EXPECT_TRUE(release.stopped_propagation());
EXPECT_EQ(WebKit::WebInputEvent::TouchEnd, view_->touch_event_.type);
EXPECT_EQ(0U, view_->touch_event_.touchesLength);
// Now start a touch event, and remove the event-handlers before the release.
- EXPECT_EQ(ui::ER_CONSUMED, view_->OnTouchEvent(&press));
+ view_->OnTouchEvent(&press);
+ EXPECT_TRUE(press.stopped_propagation());
EXPECT_EQ(WebKit::WebInputEvent::TouchStart, view_->touch_event_.type);
EXPECT_EQ(1U, view_->touch_event_.touchesLength);
EXPECT_EQ(WebKit::WebTouchPoint::StatePressed,
@@ -228,13 +235,19 @@ TEST_F(RenderWidgetHostViewAuraTest, TouchEventState) {
widget_host_->OnMessageReceived(ViewHostMsg_HasTouchEventHandlers(0, false));
EXPECT_FALSE(widget_host_->ShouldForwardTouchEvent());
- EXPECT_EQ(ui::ER_UNHANDLED, view_->OnTouchEvent(&move));
+ ui::TouchEvent move2(ui::ET_TOUCH_MOVED, gfx::Point(20, 20), 0,
+ base::Time::NowFromSystemTime() - base::Time());
+ view_->OnTouchEvent(&move2);
+ EXPECT_FALSE(move2.handled());
EXPECT_EQ(WebKit::WebInputEvent::TouchMove, view_->touch_event_.type);
EXPECT_EQ(1U, view_->touch_event_.touchesLength);
EXPECT_EQ(WebKit::WebTouchPoint::StateMoved,
view_->touch_event_.touches[0].state);
- EXPECT_EQ(ui::ER_UNHANDLED, view_->OnTouchEvent(&release));
+ ui::TouchEvent release2(ui::ET_TOUCH_RELEASED, gfx::Point(20, 20), 0,
+ base::Time::NowFromSystemTime() - base::Time());
+ view_->OnTouchEvent(&release2);
+ EXPECT_FALSE(release2.handled());
EXPECT_EQ(WebKit::WebInputEvent::TouchEnd, view_->touch_event_.type);
EXPECT_EQ(0U, view_->touch_event_.touchesLength);
}
@@ -255,13 +268,15 @@ TEST_F(RenderWidgetHostViewAuraTest, TouchEventSyncAsync) {
ui::TouchEvent release(ui::ET_TOUCH_RELEASED, gfx::Point(20, 20), 0,
base::Time::NowFromSystemTime() - base::Time());
- EXPECT_EQ(ui::ER_CONSUMED, view_->OnTouchEvent(&press));
+ view_->OnTouchEvent(&press);
+ EXPECT_TRUE(press.stopped_propagation());
EXPECT_EQ(WebKit::WebInputEvent::TouchStart, view_->touch_event_.type);
EXPECT_EQ(1U, view_->touch_event_.touchesLength);
EXPECT_EQ(WebKit::WebTouchPoint::StatePressed,
view_->touch_event_.touches[0].state);
- EXPECT_EQ(ui::ER_CONSUMED, view_->OnTouchEvent(&move));
+ view_->OnTouchEvent(&move);
+ EXPECT_TRUE(move.stopped_propagation());
EXPECT_EQ(WebKit::WebInputEvent::TouchMove, view_->touch_event_.type);
EXPECT_EQ(1U, view_->touch_event_.touchesLength);
EXPECT_EQ(WebKit::WebTouchPoint::StateMoved,
@@ -269,13 +284,15 @@ TEST_F(RenderWidgetHostViewAuraTest, TouchEventSyncAsync) {
// Send the same move event. Since the point hasn't moved, it won't affect the
// queue. However, the view should consume the event.
- EXPECT_EQ(ui::ER_CONSUMED, view_->OnTouchEvent(&move));
+ view_->OnTouchEvent(&move);
+ EXPECT_TRUE(move.stopped_propagation());
EXPECT_EQ(WebKit::WebInputEvent::TouchMove, view_->touch_event_.type);
EXPECT_EQ(1U, view_->touch_event_.touchesLength);
EXPECT_EQ(WebKit::WebTouchPoint::StateMoved,
view_->touch_event_.touches[0].state);
- EXPECT_EQ(ui::ER_CONSUMED, view_->OnTouchEvent(&release));
+ view_->OnTouchEvent(&release);
+ EXPECT_TRUE(release.stopped_propagation());
EXPECT_EQ(WebKit::WebInputEvent::TouchEnd, view_->touch_event_.type);
EXPECT_EQ(0U, view_->touch_event_.touchesLength);
}
diff --git a/ui/app_list/contents_view.cc b/ui/app_list/contents_view.cc
index 6d9a2e8..28ab706 100644
--- a/ui/app_list/contents_view.cc
+++ b/ui/app_list/contents_view.cc
@@ -219,18 +219,18 @@ void ContentsView::OnGestureEvent(ui::GestureEvent* event) {
}
}
-ui::EventResult ContentsView::OnScrollEvent(ui::ScrollEvent* event) {
+void ContentsView::OnScrollEvent(ui::ScrollEvent* event) {
if (show_state_ != SHOW_APPS ||
event->type() == ui::ET_SCROLL_FLING_CANCEL ||
abs(event->x_offset()) < kMinScrollToSwitchPage) {
- return ui::ER_UNHANDLED;
+ return;
}
if (!pagination_model_->has_transition()) {
pagination_model_->SelectPageRelative(event->x_offset() > 0 ? -1 : 1,
true);
}
- return ui::ER_HANDLED;
+ event->SetHandled();
}
} // namespace app_list
diff --git a/ui/app_list/contents_view.h b/ui/app_list/contents_view.h
index 8c283d5..f91cd32 100644
--- a/ui/app_list/contents_view.h
+++ b/ui/app_list/contents_view.h
@@ -58,7 +58,7 @@ class ContentsView : public views::View {
// Overridden from ui::EventHandler:
virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE;
- virtual ui::EventResult OnScrollEvent(ui::ScrollEvent* event) OVERRIDE;
+ virtual void OnScrollEvent(ui::ScrollEvent* event) OVERRIDE;
ShowState show_state_;
PaginationModel* pagination_model_; // Owned by AppListController.
diff --git a/ui/aura/gestures/gesture_recognizer_unittest.cc b/ui/aura/gestures/gesture_recognizer_unittest.cc
index cf7cd77..59a2e75 100644
--- a/ui/aura/gestures/gesture_recognizer_unittest.cc
+++ b/ui/aura/gestures/gesture_recognizer_unittest.cc
@@ -310,12 +310,11 @@ class QueueTouchEventDelegate : public GestureEventConsumeDelegate {
}
virtual ~QueueTouchEventDelegate() {}
- virtual ui::EventResult OnTouchEvent(ui::TouchEvent* event) OVERRIDE {
+ virtual void OnTouchEvent(ui::TouchEvent* event) OVERRIDE {
if (queue_events_) {
queue_.push(new ui::TouchEvent(*event, window_, window_));
- return ui::ER_CONSUMED;
+ event->StopPropagation();
}
- return ui::ER_UNHANDLED;
}
void ReceivedAck() {
@@ -2637,10 +2636,11 @@ class ConsumesTouchMovesDelegate : public GestureEventConsumeDelegate {
void set_consume_touch_move(bool consume) { consume_touch_move_ = consume; }
private:
- virtual ui::EventResult OnTouchEvent(ui::TouchEvent* touch) OVERRIDE {
+ virtual void OnTouchEvent(ui::TouchEvent* touch) OVERRIDE {
if (consume_touch_move_ && touch->type() == ui::ET_TOUCH_MOVED)
- return ui::ER_HANDLED;
- return GestureEventConsumeDelegate::OnTouchEvent(touch);
+ touch->SetHandled();
+ else
+ GestureEventConsumeDelegate::OnTouchEvent(touch);
}
bool consume_touch_move_;
diff --git a/ui/aura/root_window_unittest.cc b/ui/aura/root_window_unittest.cc
index 5a6739a..e76c787c 100644
--- a/ui/aura/root_window_unittest.cc
+++ b/ui/aura/root_window_unittest.cc
@@ -451,14 +451,12 @@ class EventFilterRecorder : public ui::EventHandler {
return ui::ER_UNHANDLED;
}
- virtual ui::EventResult OnScrollEvent(ui::ScrollEvent* event) OVERRIDE {
+ virtual void OnScrollEvent(ui::ScrollEvent* event) OVERRIDE {
events_.push_back(event->type());
- return ui::ER_UNHANDLED;
}
- virtual ui::EventResult OnTouchEvent(ui::TouchEvent* event) OVERRIDE {
+ virtual void OnTouchEvent(ui::TouchEvent* event) OVERRIDE {
events_.push_back(event->type());
- return ui::ER_UNHANDLED;
}
virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE {
diff --git a/ui/aura/test/test_event_handler.cc b/ui/aura/test/test_event_handler.cc
index dac45cc..910b301 100644
--- a/ui/aura/test/test_event_handler.cc
+++ b/ui/aura/test/test_event_handler.cc
@@ -35,14 +35,12 @@ ui::EventResult TestEventHandler::OnMouseEvent(ui::MouseEvent* event) {
return ui::ER_UNHANDLED;
}
-ui::EventResult TestEventHandler::OnScrollEvent(ui::ScrollEvent* event) {
+void TestEventHandler::OnScrollEvent(ui::ScrollEvent* event) {
num_scroll_events_++;
- return ui::ER_UNHANDLED;
}
-ui::EventResult TestEventHandler::OnTouchEvent(ui::TouchEvent* event) {
+void TestEventHandler::OnTouchEvent(ui::TouchEvent* event) {
num_touch_events_++;
- return ui::ER_UNHANDLED;
}
void TestEventHandler::OnGestureEvent(ui::GestureEvent* event) {
diff --git a/ui/aura/test/test_event_handler.h b/ui/aura/test/test_event_handler.h
index 32ee250..c934136 100644
--- a/ui/aura/test/test_event_handler.h
+++ b/ui/aura/test/test_event_handler.h
@@ -30,8 +30,8 @@ class TestEventHandler : public ui::EventHandler {
// ui::EventHandler overrides:
virtual ui::EventResult OnKeyEvent(ui::KeyEvent* event) OVERRIDE;
virtual ui::EventResult OnMouseEvent(ui::MouseEvent* event) OVERRIDE;
- virtual ui::EventResult OnScrollEvent(ui::ScrollEvent* event) OVERRIDE;
- virtual ui::EventResult OnTouchEvent(ui::TouchEvent* event) OVERRIDE;
+ virtual void OnScrollEvent(ui::ScrollEvent* event) OVERRIDE;
+ virtual void OnTouchEvent(ui::TouchEvent* event) OVERRIDE;
virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE;
private:
diff --git a/ui/aura/window_unittest.cc b/ui/aura/window_unittest.cc
index f9f2134..6289000 100644
--- a/ui/aura/window_unittest.cc
+++ b/ui/aura/window_unittest.cc
@@ -177,9 +177,8 @@ class CaptureWindowDelegateImpl : public TestWindowDelegate {
mouse_event_count_++;
return ui::ER_UNHANDLED;
}
- virtual ui::EventResult OnTouchEvent(ui::TouchEvent* event) OVERRIDE {
+ virtual void OnTouchEvent(ui::TouchEvent* event) OVERRIDE {
touch_event_count_++;
- return ui::ER_UNHANDLED;
}
virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE {
gesture_event_count_++;
diff --git a/ui/base/events/event_dispatcher_unittest.cc b/ui/base/events/event_dispatcher_unittest.cc
index bf58891..1cc8ba6 100644
--- a/ui/base/events/event_dispatcher_unittest.cc
+++ b/ui/base/events/event_dispatcher_unittest.cc
@@ -90,18 +90,22 @@ class TestEventHandler : public EventHandler {
return event_result_;
}
- virtual EventResult OnScrollEvent(ScrollEvent* event) OVERRIDE {
+ virtual void OnScrollEvent(ScrollEvent* event) OVERRIDE {
ReceivedEvent(event);
- return event_result_;
+ SetStatusOnEvent(event);
}
- virtual EventResult OnTouchEvent(TouchEvent* event) OVERRIDE {
+ virtual void OnTouchEvent(TouchEvent* event) OVERRIDE {
ReceivedEvent(event);
- return event_result_;
+ SetStatusOnEvent(event);
}
virtual void OnGestureEvent(GestureEvent* event) OVERRIDE {
ReceivedEvent(event);
+ SetStatusOnEvent(event);
+ }
+
+ void SetStatusOnEvent(Event* event) {
if (event_result_ & ui::ER_CONSUMED)
event->StopPropagation();
if (event_result_ & ui::ER_HANDLED)
diff --git a/ui/base/events/event_handler.cc b/ui/base/events/event_handler.cc
index fef602a..df35e59 100644
--- a/ui/base/events/event_handler.cc
+++ b/ui/base/events/event_handler.cc
@@ -27,9 +27,9 @@ void EventHandler::OnEvent(Event* event) {
else if (event->IsMouseEvent())
result = OnMouseEvent(static_cast<MouseEvent*>(event));
else if (event->IsScrollEvent())
- result = OnScrollEvent(static_cast<ScrollEvent*>(event));
+ OnScrollEvent(static_cast<ScrollEvent*>(event));
else if (event->IsTouchEvent())
- result = OnTouchEvent(static_cast<TouchEvent*>(event));
+ OnTouchEvent(static_cast<TouchEvent*>(event));
else if (event->IsGestureEvent())
OnGestureEvent(static_cast<GestureEvent*>(event));
@@ -47,12 +47,10 @@ EventResult EventHandler::OnMouseEvent(MouseEvent* event) {
return ui::ER_UNHANDLED;
}
-EventResult EventHandler::OnScrollEvent(ScrollEvent* event) {
- return ui::ER_UNHANDLED;
+void EventHandler::OnScrollEvent(ScrollEvent* event) {
}
-EventResult EventHandler::OnTouchEvent(TouchEvent* event) {
- return ui::ER_UNHANDLED;
+void EventHandler::OnTouchEvent(TouchEvent* event) {
}
void EventHandler::OnGestureEvent(GestureEvent* event) {
diff --git a/ui/base/events/event_handler.h b/ui/base/events/event_handler.h
index e78590c..233b5cb 100644
--- a/ui/base/events/event_handler.h
+++ b/ui/base/events/event_handler.h
@@ -40,9 +40,9 @@ class UI_EXPORT EventHandler {
virtual EventResult OnMouseEvent(MouseEvent* event);
- virtual EventResult OnScrollEvent(ScrollEvent* event);
+ virtual void OnScrollEvent(ScrollEvent* event);
- virtual EventResult OnTouchEvent(TouchEvent* event);
+ virtual void OnTouchEvent(TouchEvent* event);
virtual void OnGestureEvent(GestureEvent* event);
diff --git a/ui/base/events/event_target.cc b/ui/base/events/event_target.cc
index a7d93dd..c587877 100644
--- a/ui/base/events/event_target.cc
+++ b/ui/base/events/event_target.cc
@@ -62,15 +62,16 @@ EventResult EventTarget::OnMouseEvent(MouseEvent* event) {
return target_handler_ ? target_handler_->OnMouseEvent(event) : ER_UNHANDLED;
}
-EventResult EventTarget::OnScrollEvent(ScrollEvent* event) {
+void EventTarget::OnScrollEvent(ScrollEvent* event) {
CHECK_EQ(this, event->target());
- return target_handler_ ? target_handler_->OnScrollEvent(event) : ER_UNHANDLED;
+ if (target_handler_)
+ target_handler_->OnScrollEvent(event);
}
-EventResult EventTarget::OnTouchEvent(TouchEvent* event) {
+void EventTarget::OnTouchEvent(TouchEvent* event) {
CHECK_EQ(this, event->target());
- return target_handler_ ? target_handler_->OnTouchEvent(event) :
- ER_UNHANDLED;
+ if (target_handler_)
+ target_handler_->OnTouchEvent(event);
}
void EventTarget::OnGestureEvent(GestureEvent* event) {
diff --git a/ui/base/events/event_target.h b/ui/base/events/event_target.h
index fa05d02..1bd5033 100644
--- a/ui/base/events/event_target.h
+++ b/ui/base/events/event_target.h
@@ -75,8 +75,8 @@ class UI_EXPORT EventTarget : public EventHandler {
virtual void OnEvent(Event* event) OVERRIDE;
virtual EventResult OnKeyEvent(KeyEvent* event) OVERRIDE;
virtual EventResult OnMouseEvent(MouseEvent* event) OVERRIDE;
- virtual EventResult OnScrollEvent(ScrollEvent* event) OVERRIDE;
- virtual EventResult OnTouchEvent(TouchEvent* event) OVERRIDE;
+ virtual void OnScrollEvent(ScrollEvent* event) OVERRIDE;
+ virtual void OnTouchEvent(TouchEvent* event) OVERRIDE;
virtual void OnGestureEvent(GestureEvent* event) OVERRIDE;
private:
diff --git a/ui/views/corewm/compound_event_filter.cc b/ui/views/corewm/compound_event_filter.cc
index fe83efd..9e857c6 100644
--- a/ui/views/corewm/compound_event_filter.cc
+++ b/ui/views/corewm/compound_event_filter.cc
@@ -161,16 +161,13 @@ ui::EventResult CompoundEventFilter::FilterMouseEvent(ui::MouseEvent* event) {
return static_cast<ui::EventResult>(result);
}
-ui::EventResult CompoundEventFilter::FilterTouchEvent(ui::TouchEvent* event) {
- int result = ui::ER_UNHANDLED;
+void CompoundEventFilter::FilterTouchEvent(ui::TouchEvent* event) {
if (handlers_.might_have_observers()) {
ObserverListBase<ui::EventHandler>::Iterator it(handlers_);
ui::EventHandler* handler;
- while (!(result & ui::ER_CONSUMED) && (handler = it.GetNext()) != NULL) {
- result |= handler->OnTouchEvent(event);
- }
+ while (!event->stopped_propagation() && (handler = it.GetNext()) != NULL)
+ handler->OnTouchEvent(event);
}
- return static_cast<ui::EventResult>(result);
}
void CompoundEventFilter::SetCursorVisibilityOnEvent(aura::Window* target,
@@ -228,18 +225,15 @@ ui::EventResult CompoundEventFilter::OnMouseEvent(ui::MouseEvent* event) {
return FilterMouseEvent(event);
}
-ui::EventResult CompoundEventFilter::OnScrollEvent(ui::ScrollEvent* event) {
- return ui::ER_UNHANDLED;
+void CompoundEventFilter::OnScrollEvent(ui::ScrollEvent* event) {
}
-ui::EventResult CompoundEventFilter::OnTouchEvent(ui::TouchEvent* event) {
- ui::EventResult result = FilterTouchEvent(event);
- if (result == ui::ER_UNHANDLED &&
- event->type() == ui::ET_TOUCH_PRESSED) {
+void CompoundEventFilter::OnTouchEvent(ui::TouchEvent* event) {
+ FilterTouchEvent(event);
+ if (!event->handled() && event->type() == ui::ET_TOUCH_PRESSED) {
SetCursorVisibilityOnEvent(
static_cast<aura::Window*>(event->target()), event, false);
}
- return result;
}
void CompoundEventFilter::OnGestureEvent(ui::GestureEvent* event) {
diff --git a/ui/views/corewm/compound_event_filter.h b/ui/views/corewm/compound_event_filter.h
index a995fb6..223b0b6 100644
--- a/ui/views/corewm/compound_event_filter.h
+++ b/ui/views/corewm/compound_event_filter.h
@@ -65,7 +65,7 @@ class VIEWS_EXPORT CompoundEventFilter : public ui::EventHandler {
// Dispatches event to additional filters.
ui::EventResult FilterKeyEvent(ui::KeyEvent* event);
ui::EventResult FilterMouseEvent(ui::MouseEvent* event);
- ui::EventResult FilterTouchEvent(ui::TouchEvent* event);
+ void FilterTouchEvent(ui::TouchEvent* event);
// Sets the visibility of the cursor if the event is not synthesized and
// 1) it's hiding (show=false) when the cursor is currently shown, or
@@ -80,8 +80,8 @@ class VIEWS_EXPORT CompoundEventFilter : public ui::EventHandler {
// Overridden from ui::EventHandler:
virtual ui::EventResult OnKeyEvent(ui::KeyEvent* event) OVERRIDE;
virtual ui::EventResult OnMouseEvent(ui::MouseEvent* event) OVERRIDE;
- virtual ui::EventResult OnScrollEvent(ui::ScrollEvent* event) OVERRIDE;
- virtual ui::EventResult OnTouchEvent(ui::TouchEvent* event) OVERRIDE;
+ virtual void OnScrollEvent(ui::ScrollEvent* event) OVERRIDE;
+ virtual void OnTouchEvent(ui::TouchEvent* event) OVERRIDE;
virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE;
// Additional pre-target event handlers.
diff --git a/ui/views/corewm/focus_controller.cc b/ui/views/corewm/focus_controller.cc
index cb6b278..4f273af 100644
--- a/ui/views/corewm/focus_controller.cc
+++ b/ui/views/corewm/focus_controller.cc
@@ -159,12 +159,10 @@ ui::EventResult FocusController::OnMouseEvent(ui::MouseEvent* event) {
return ui::ER_UNHANDLED;
}
-ui::EventResult FocusController::OnScrollEvent(ui::ScrollEvent* event) {
- return ui::ER_UNHANDLED;
+void FocusController::OnScrollEvent(ui::ScrollEvent* event) {
}
-ui::EventResult FocusController::OnTouchEvent(ui::TouchEvent* event) {
- return ui::ER_UNHANDLED;
+void FocusController::OnTouchEvent(ui::TouchEvent* event) {
}
void FocusController::OnGestureEvent(ui::GestureEvent* event) {
diff --git a/ui/views/corewm/focus_controller.h b/ui/views/corewm/focus_controller.h
index a870c7c..a14968a 100644
--- a/ui/views/corewm/focus_controller.h
+++ b/ui/views/corewm/focus_controller.h
@@ -73,8 +73,8 @@ class VIEWS_EXPORT FocusController : public aura::client::ActivationClient,
// Overridden from ui::EventHandler:
virtual ui::EventResult OnKeyEvent(ui::KeyEvent* event) OVERRIDE;
virtual ui::EventResult OnMouseEvent(ui::MouseEvent* event) OVERRIDE;
- virtual ui::EventResult OnScrollEvent(ui::ScrollEvent* event) OVERRIDE;
- virtual ui::EventResult OnTouchEvent(ui::TouchEvent* event) OVERRIDE;
+ virtual void OnScrollEvent(ui::ScrollEvent* event) OVERRIDE;
+ virtual void OnTouchEvent(ui::TouchEvent* event) OVERRIDE;
virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE;
// Overridden from aura::WindowObserver:
diff --git a/ui/views/corewm/window_modality_controller.cc b/ui/views/corewm/window_modality_controller.cc
index 907c823..dd91a20 100644
--- a/ui/views/corewm/window_modality_controller.cc
+++ b/ui/views/corewm/window_modality_controller.cc
@@ -114,10 +114,10 @@ ui::EventResult WindowModalityController::OnMouseEvent(ui::MouseEvent* event) {
ui::ER_UNHANDLED;
}
-ui::EventResult WindowModalityController::OnTouchEvent(ui::TouchEvent* event) {
+void WindowModalityController::OnTouchEvent(ui::TouchEvent* event) {
aura::Window* target = static_cast<aura::Window*>(event->target());
- return ProcessLocatedEvent(target, event) ? ui::ER_CONSUMED :
- ui::ER_UNHANDLED;
+ if (ProcessLocatedEvent(target, event))
+ event->StopPropagation();
}
////////////////////////////////////////////////////////////////////////////////
diff --git a/ui/views/corewm/window_modality_controller.h b/ui/views/corewm/window_modality_controller.h
index 449a894..d6efc02 100644
--- a/ui/views/corewm/window_modality_controller.h
+++ b/ui/views/corewm/window_modality_controller.h
@@ -40,7 +40,7 @@ class VIEWS_EXPORT WindowModalityController : public ui::EventHandler,
// Overridden from ui::EventHandler:
virtual ui::EventResult OnKeyEvent(ui::KeyEvent* event) OVERRIDE;
virtual ui::EventResult OnMouseEvent(ui::MouseEvent* event) OVERRIDE;
- virtual ui::EventResult OnTouchEvent(ui::TouchEvent* event) OVERRIDE;
+ virtual void OnTouchEvent(ui::TouchEvent* event) OVERRIDE;
// Overridden from aura::EnvObserver:
virtual void OnWindowInitialized(aura::Window* window) OVERRIDE;
diff --git a/ui/views/view.cc b/ui/views/view.cc
index ba0023c2..2fb4fdf 100644
--- a/ui/views/view.cc
+++ b/ui/views/view.cc
@@ -875,12 +875,10 @@ ui::EventResult View::OnMouseEvent(ui::MouseEvent* event) {
return ui::ER_UNHANDLED;
}
-ui::EventResult View::OnScrollEvent(ui::ScrollEvent* event) {
- return ui::ER_UNHANDLED;
+void View::OnScrollEvent(ui::ScrollEvent* event) {
}
-ui::EventResult View::OnTouchEvent(ui::TouchEvent* event) {
- return ui::ER_UNHANDLED;
+void View::OnTouchEvent(ui::TouchEvent* event) {
}
void View::OnGestureEvent(ui::GestureEvent* event) {
@@ -1994,8 +1992,8 @@ void View::ProcessMouseReleased(const ui::MouseEvent& event) {
// WARNING: we may have been deleted.
}
-ui::EventResult View::ProcessTouchEvent(ui::TouchEvent* event) {
- return OnTouchEvent(event);
+void View::ProcessTouchEvent(ui::TouchEvent* event) {
+ OnTouchEvent(event);
}
void View::ProcessGestureEvent(ui::GestureEvent* event) {
diff --git a/ui/views/view.h b/ui/views/view.h
index fee62b6..d19bec6 100644
--- a/ui/views/view.h
+++ b/ui/views/view.h
@@ -653,8 +653,8 @@ class VIEWS_EXPORT View : public ui::LayerDelegate,
// Overridden from ui::EventHandler:
virtual ui::EventResult OnKeyEvent(ui::KeyEvent* event) OVERRIDE;
virtual ui::EventResult OnMouseEvent(ui::MouseEvent* event) OVERRIDE;
- virtual ui::EventResult OnScrollEvent(ui::ScrollEvent* event) OVERRIDE;
- virtual ui::EventResult OnTouchEvent(ui::TouchEvent* event) OVERRIDE;
+ virtual void OnScrollEvent(ui::ScrollEvent* event) OVERRIDE;
+ virtual void OnTouchEvent(ui::TouchEvent* event) OVERRIDE;
virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE;
// Accelerators --------------------------------------------------------------
@@ -1296,9 +1296,8 @@ class VIEWS_EXPORT View : public ui::LayerDelegate,
bool ProcessMouseDragged(const ui::MouseEvent& event, DragInfo* drop_info);
void ProcessMouseReleased(const ui::MouseEvent& event);
- // RootView will invoke this with incoming TouchEvents. Returns the result
- // of OnTouchEvent.
- ui::EventResult ProcessTouchEvent(ui::TouchEvent* event);
+ // RootView will invoke this with incoming TouchEvents.
+ void ProcessTouchEvent(ui::TouchEvent* event);
// RootView will invoke this with incoming GestureEvents. This invokes
// OnGestureEvent.
diff --git a/ui/views/view_unittest.cc b/ui/views/view_unittest.cc
index b5165eb..e819d14 100644
--- a/ui/views/view_unittest.cc
+++ b/ui/views/view_unittest.cc
@@ -232,7 +232,7 @@ class TestView : public View {
virtual void OnMouseEntered(const ui::MouseEvent& event) OVERRIDE;
virtual void OnMouseExited(const ui::MouseEvent& event) OVERRIDE;
- virtual ui::EventResult OnTouchEvent(ui::TouchEvent* event) OVERRIDE;
+ virtual void OnTouchEvent(ui::TouchEvent* event) OVERRIDE;
// Ignores GestureEvent by default.
virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE;
@@ -277,7 +277,7 @@ class TestViewIgnoreTouch : public TestView {
virtual ~TestViewIgnoreTouch() {}
private:
- virtual ui::EventResult OnTouchEvent(ui::TouchEvent* event) OVERRIDE;
+ virtual void OnTouchEvent(ui::TouchEvent* event) OVERRIDE;
};
// A view subclass that consumes all Gesture events for testing purposes.
@@ -474,27 +474,30 @@ TEST_F(ViewTest, DeleteOnPressed) {
////////////////////////////////////////////////////////////////////////////////
// TouchEvent
////////////////////////////////////////////////////////////////////////////////
-ui::EventResult TestView::OnTouchEvent(ui::TouchEvent* event) {
+void TestView::OnTouchEvent(ui::TouchEvent* event) {
last_touch_event_type_ = event->type();
location_.SetPoint(event->x(), event->y());
if (!in_touch_sequence_) {
if (event->type() == ui::ET_TOUCH_PRESSED) {
in_touch_sequence_ = true;
- return ui::ER_CONSUMED;
+ event->StopPropagation();
+ return;
}
} else {
if (event->type() == ui::ET_TOUCH_RELEASED) {
in_touch_sequence_ = false;
- return ui::ER_HANDLED;
+ event->SetHandled();
+ return;
}
- return ui::ER_CONSUMED;
+ event->StopPropagation();
+ return;
}
- return last_touch_event_was_handled_ ? ui::ER_CONSUMED :
- ui::ER_UNHANDLED;
+
+ if (last_touch_event_was_handled_)
+ event->StopPropagation();
}
-ui::EventResult TestViewIgnoreTouch::OnTouchEvent(ui::TouchEvent* event) {
- return ui::ER_UNHANDLED;
+void TestViewIgnoreTouch::OnTouchEvent(ui::TouchEvent* event) {
}
TEST_F(ViewTest, TouchEvent) {
diff --git a/ui/views/widget/desktop_aura/desktop_activation_client.cc b/ui/views/widget/desktop_aura/desktop_activation_client.cc
index d2123a3..0581e1b 100644
--- a/ui/views/widget/desktop_aura/desktop_activation_client.cc
+++ b/ui/views/widget/desktop_aura/desktop_activation_client.cc
@@ -168,12 +168,10 @@ ui::EventResult DesktopActivationClient::OnMouseEvent(ui::MouseEvent* event) {
return ui::ER_UNHANDLED;
}
-ui::EventResult DesktopActivationClient::OnScrollEvent(ui::ScrollEvent* event) {
- return ui::ER_UNHANDLED;
+void DesktopActivationClient::OnScrollEvent(ui::ScrollEvent* event) {
}
-ui::EventResult DesktopActivationClient::OnTouchEvent(ui::TouchEvent* event) {
- return ui::ER_UNHANDLED;
+void DesktopActivationClient::OnTouchEvent(ui::TouchEvent* event) {
}
void DesktopActivationClient::OnGestureEvent(ui::GestureEvent* event) {
diff --git a/ui/views/widget/desktop_aura/desktop_activation_client.h b/ui/views/widget/desktop_aura/desktop_activation_client.h
index f397ee0..b4d5759 100644
--- a/ui/views/widget/desktop_aura/desktop_activation_client.h
+++ b/ui/views/widget/desktop_aura/desktop_activation_client.h
@@ -62,8 +62,8 @@ class VIEWS_EXPORT DesktopActivationClient
// Overridden from ui::EventHandler:
virtual ui::EventResult OnKeyEvent(ui::KeyEvent* event) OVERRIDE;
virtual ui::EventResult OnMouseEvent(ui::MouseEvent* event) OVERRIDE;
- virtual ui::EventResult OnScrollEvent(ui::ScrollEvent* event) OVERRIDE;
- virtual ui::EventResult OnTouchEvent(ui::TouchEvent* event) OVERRIDE;
+ virtual void OnScrollEvent(ui::ScrollEvent* event) OVERRIDE;
+ virtual void OnTouchEvent(ui::TouchEvent* event) OVERRIDE;
virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE;
private:
diff --git a/ui/views/widget/desktop_aura/desktop_native_widget_aura.cc b/ui/views/widget/desktop_aura/desktop_native_widget_aura.cc
index 1b9aaf2..9d706bc 100644
--- a/ui/views/widget/desktop_aura/desktop_native_widget_aura.cc
+++ b/ui/views/widget/desktop_aura/desktop_native_widget_aura.cc
@@ -578,23 +578,23 @@ ui::EventResult DesktopNativeWidgetAura::OnMouseEvent(ui::MouseEvent* event) {
ui::ER_HANDLED : ui::ER_UNHANDLED;
}
-ui::EventResult DesktopNativeWidgetAura::OnScrollEvent(ui::ScrollEvent* event) {
+void DesktopNativeWidgetAura::OnScrollEvent(ui::ScrollEvent* event) {
if (event->type() == ui::ET_SCROLL) {
- ui::EventResult status = native_widget_delegate_->OnScrollEvent(event);
- if (status != ui::ER_UNHANDLED)
- return status;
+ native_widget_delegate_->OnScrollEvent(event);
+ if (event->handled())
+ return;
// Convert unprocessed scroll events into wheel events.
ui::MouseWheelEvent mwe(*static_cast<ui::ScrollEvent*>(event));
- return native_widget_delegate_->OnMouseEvent(mwe) ?
- ui::ER_HANDLED : ui::ER_UNHANDLED;
+ if (native_widget_delegate_->OnMouseEvent(mwe))
+ event->SetHandled();
} else {
- return native_widget_delegate_->OnScrollEvent(event);
+ native_widget_delegate_->OnScrollEvent(event);
}
}
-ui::EventResult DesktopNativeWidgetAura::OnTouchEvent(ui::TouchEvent* event) {
- return native_widget_delegate_->OnTouchEvent(event);
+void DesktopNativeWidgetAura::OnTouchEvent(ui::TouchEvent* event) {
+ native_widget_delegate_->OnTouchEvent(event);
}
void DesktopNativeWidgetAura::OnGestureEvent(ui::GestureEvent* event) {
diff --git a/ui/views/widget/desktop_aura/desktop_native_widget_aura.h b/ui/views/widget/desktop_aura/desktop_native_widget_aura.h
index 1d50dfc..b81c77b 100644
--- a/ui/views/widget/desktop_aura/desktop_native_widget_aura.h
+++ b/ui/views/widget/desktop_aura/desktop_native_widget_aura.h
@@ -173,8 +173,8 @@ class VIEWS_EXPORT DesktopNativeWidgetAura
// Overridden from ui::EventHandler:
virtual ui::EventResult OnKeyEvent(ui::KeyEvent* event) OVERRIDE;
virtual ui::EventResult OnMouseEvent(ui::MouseEvent* event) OVERRIDE;
- virtual ui::EventResult OnScrollEvent(ui::ScrollEvent* event) OVERRIDE;
- virtual ui::EventResult OnTouchEvent(ui::TouchEvent* event) OVERRIDE;
+ virtual void OnScrollEvent(ui::ScrollEvent* event) OVERRIDE;
+ virtual void OnTouchEvent(ui::TouchEvent* event) OVERRIDE;
virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE;
// Overridden from aura::client::ActivationDelegate:
diff --git a/ui/views/widget/native_widget_aura.cc b/ui/views/widget/native_widget_aura.cc
index 3740dae..52c7748 100644
--- a/ui/views/widget/native_widget_aura.cc
+++ b/ui/views/widget/native_widget_aura.cc
@@ -794,22 +794,24 @@ ui::EventResult NativeWidgetAura::OnMouseEvent(ui::MouseEvent* event) {
return delegate_->OnMouseEvent(*event) ? ui::ER_HANDLED : ui::ER_UNHANDLED;
}
-ui::EventResult NativeWidgetAura::OnScrollEvent(ui::ScrollEvent* event) {
+void NativeWidgetAura::OnScrollEvent(ui::ScrollEvent* event) {
if (event->type() == ui::ET_SCROLL) {
- ui::EventResult status = delegate_->OnScrollEvent(event);
- if (status != ui::ER_UNHANDLED)
- return status;
+ delegate_->OnScrollEvent(event);
+ if (event->handled())
+ return;
// Convert unprocessed scroll events into wheel events.
ui::MouseWheelEvent mwe(*static_cast<ui::ScrollEvent*>(event));
- return delegate_->OnMouseEvent(mwe) ? ui::ER_HANDLED : ui::ER_UNHANDLED;
+ if (delegate_->OnMouseEvent(mwe))
+ event->SetHandled();
+ return;
}
- return delegate_->OnScrollEvent(event);
+ delegate_->OnScrollEvent(event);
}
-ui::EventResult NativeWidgetAura::OnTouchEvent(ui::TouchEvent* event) {
+void NativeWidgetAura::OnTouchEvent(ui::TouchEvent* event) {
DCHECK(window_->IsVisible());
- return delegate_->OnTouchEvent(event);
+ delegate_->OnTouchEvent(event);
}
void NativeWidgetAura::OnGestureEvent(ui::GestureEvent* event) {
diff --git a/ui/views/widget/native_widget_aura.h b/ui/views/widget/native_widget_aura.h
index 0aa4db5..3910f61 100644
--- a/ui/views/widget/native_widget_aura.h
+++ b/ui/views/widget/native_widget_aura.h
@@ -158,8 +158,8 @@ class VIEWS_EXPORT NativeWidgetAura
// Overridden from ui::EventHandler:
virtual ui::EventResult OnKeyEvent(ui::KeyEvent* event) OVERRIDE;
virtual ui::EventResult OnMouseEvent(ui::MouseEvent* event) OVERRIDE;
- virtual ui::EventResult OnScrollEvent(ui::ScrollEvent* event) OVERRIDE;
- virtual ui::EventResult OnTouchEvent(ui::TouchEvent* event) OVERRIDE;
+ virtual void OnScrollEvent(ui::ScrollEvent* event) OVERRIDE;
+ virtual void OnTouchEvent(ui::TouchEvent* event) OVERRIDE;
virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE;
// Overridden from aura::client::ActivationDelegate:
diff --git a/ui/views/widget/native_widget_delegate.h b/ui/views/widget/native_widget_delegate.h
index bc82cdc..e23a8d5 100644
--- a/ui/views/widget/native_widget_delegate.h
+++ b/ui/views/widget/native_widget_delegate.h
@@ -110,8 +110,8 @@ class VIEWS_EXPORT NativeWidgetDelegate {
virtual bool OnMouseEvent(const ui::MouseEvent& event) = 0;
virtual void OnMouseCaptureLost() = 0;
- virtual ui::EventResult OnTouchEvent(ui::TouchEvent* event) = 0;
- virtual ui::EventResult OnScrollEvent(ui::ScrollEvent* event) = 0;
+ virtual void OnTouchEvent(ui::TouchEvent* event) = 0;
+ virtual void OnScrollEvent(ui::ScrollEvent* event) = 0;
virtual void OnGestureEvent(ui::GestureEvent* event) = 0;
// Runs the specified native command. Returns true if the command is handled.
diff --git a/ui/views/widget/root_view.cc b/ui/views/widget/root_view.cc
index 3593424..03dc04a 100644
--- a/ui/views/widget/root_view.cc
+++ b/ui/views/widget/root_view.cc
@@ -132,15 +132,14 @@ ui::EventResult RootView::DispatchKeyEvent(const ui::KeyEvent& event) {
return consumed ? ui::ER_CONSUMED : ui::ER_UNHANDLED;
}
-ui::EventResult RootView::DispatchScrollEvent(ui::ScrollEvent* event) {
- int result = ui::ER_UNHANDLED;
+void RootView::DispatchScrollEvent(ui::ScrollEvent* event) {
for (View* v = GetEventHandlerForPoint(event->location());
- v && v != this && !(result & ui::ER_CONSUMED); v = v->parent())
- result |= v->OnScrollEvent(event);
- return static_cast<ui::EventResult>(result);
+ v && v != this && !event->stopped_propagation(); v = v->parent()) {
+ v->OnScrollEvent(event);
+ }
}
-ui::EventResult RootView::DispatchTouchEvent(ui::TouchEvent* event) {
+void RootView::DispatchTouchEvent(ui::TouchEvent* event) {
// TODO: this looks all wrong. On a TOUCH_PRESSED we should figure out the
// view and target that view with all touches with the same id until the
// release (or keep it if captured).
@@ -148,13 +147,16 @@ ui::EventResult RootView::DispatchTouchEvent(ui::TouchEvent* event) {
// If touch_pressed_handler_ is non null, we are currently processing
// a touch down on the screen situation. In that case we send the
// event to touch_pressed_handler_
- ui::EventResult status = ui::ER_UNHANDLED;
if (touch_pressed_handler_) {
ui::TouchEvent touch_event(*event, static_cast<View*>(this),
touch_pressed_handler_);
- status = touch_pressed_handler_->ProcessTouchEvent(&touch_event);
- return status;
+ touch_pressed_handler_->ProcessTouchEvent(&touch_event);
+ if (touch_event.handled())
+ event->SetHandled();
+ if (touch_event.stopped_propagation())
+ event->StopPropagation();
+ return;
}
// Walk up the tree until we find a view that wants the touch event.
@@ -169,7 +171,11 @@ ui::EventResult RootView::DispatchTouchEvent(ui::TouchEvent* event) {
// See if this view wants to handle the touch
ui::TouchEvent touch_event(*event, static_cast<View*>(this),
touch_pressed_handler_);
- status = touch_pressed_handler_->ProcessTouchEvent(&touch_event);
+ touch_pressed_handler_->ProcessTouchEvent(&touch_event);
+ if (touch_event.handled())
+ event->SetHandled();
+ if (touch_event.stopped_propagation())
+ event->StopPropagation();
// The view could have removed itself from the tree when handling
// OnTouchEvent(). So handle as per OnMousePressed. NB: we
@@ -179,21 +185,21 @@ ui::EventResult RootView::DispatchTouchEvent(ui::TouchEvent* event) {
// The touch event wasn't processed. Go up the view hierarchy and dispatch
// the touch event.
- if (status == ui::ER_UNHANDLED)
+ if (!event->handled())
continue;
// If a View consumed the event, that means future touch-events should go to
// that View. If the event wasn't consumed, then reset the handler.
- if (!(status & ui::ER_CONSUMED))
+ if (!event->stopped_propagation())
touch_pressed_handler_ = NULL;
- return status;
+ return;
}
// Reset touch_pressed_handler_ to indicate that no processing is occurring.
touch_pressed_handler_ = NULL;
- return status;
+ return;
}
void RootView::DispatchGestureEvent(ui::GestureEvent* event) {
diff --git a/ui/views/widget/root_view.h b/ui/views/widget/root_view.h
index c87692d..1ee1b26 100644
--- a/ui/views/widget/root_view.h
+++ b/ui/views/widget/root_view.h
@@ -62,8 +62,8 @@ class VIEWS_EXPORT RootView : public View, public FocusTraversable {
// path, and finally to the default keyboard handler, until someone consumes
// it. Returns whether anyone consumed the event.
ui::EventResult DispatchKeyEvent(const ui::KeyEvent& event);
- ui::EventResult DispatchScrollEvent(ui::ScrollEvent* event);
- ui::EventResult DispatchTouchEvent(ui::TouchEvent* event);
+ void DispatchScrollEvent(ui::ScrollEvent* event);
+ void DispatchTouchEvent(ui::TouchEvent* event);
virtual void DispatchGestureEvent(ui::GestureEvent* event);
// Focus ---------------------------------------------------------------------
diff --git a/ui/views/widget/widget.cc b/ui/views/widget/widget.cc
index 48d7f24..4ecf46b 100644
--- a/ui/views/widget/widget.cc
+++ b/ui/views/widget/widget.cc
@@ -1173,15 +1173,15 @@ void Widget::OnMouseCaptureLost() {
is_mouse_button_pressed_ = false;
}
-ui::EventResult Widget::OnTouchEvent(ui::TouchEvent* event) {
+void Widget::OnTouchEvent(ui::TouchEvent* event) {
ScopedEvent scoped(this, *event);
- return static_cast<internal::RootView*>(GetRootView())->
+ static_cast<internal::RootView*>(GetRootView())->
DispatchTouchEvent(event);
}
-ui::EventResult Widget::OnScrollEvent(ui::ScrollEvent* event) {
+void Widget::OnScrollEvent(ui::ScrollEvent* event) {
ScopedEvent scoped(this, *event);
- return static_cast<internal::RootView*>(GetRootView())->
+ static_cast<internal::RootView*>(GetRootView())->
DispatchScrollEvent(event);
}
diff --git a/ui/views/widget/widget.h b/ui/views/widget/widget.h
index ac7cf6d..93d258b 100644
--- a/ui/views/widget/widget.h
+++ b/ui/views/widget/widget.h
@@ -670,8 +670,8 @@ class VIEWS_EXPORT Widget : public internal::NativeWidgetDelegate,
virtual bool OnKeyEvent(const ui::KeyEvent& event) OVERRIDE;
virtual bool OnMouseEvent(const ui::MouseEvent& event) OVERRIDE;
virtual void OnMouseCaptureLost() OVERRIDE;
- virtual ui::EventResult OnTouchEvent(ui::TouchEvent* event) OVERRIDE;
- virtual ui::EventResult OnScrollEvent(ui::ScrollEvent* event) OVERRIDE;
+ virtual void OnTouchEvent(ui::TouchEvent* event) OVERRIDE;
+ virtual void OnScrollEvent(ui::ScrollEvent* event) OVERRIDE;
virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE;
virtual bool ExecuteCommand(int command_id) OVERRIDE;
virtual InputMethod* GetInputMethodDirect() OVERRIDE;