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

Unified Diff: ui/views/widget/native_widget_aura.cc

Issue 10908127: events: Move EventTarget into Event. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/views/widget/native_widget_aura.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/widget/native_widget_aura.cc
diff --git a/ui/views/widget/native_widget_aura.cc b/ui/views/widget/native_widget_aura.cc
index 764334c0a52a8856296c9d5200ac845e452bd5e1..f730a996bd66d6d0b37511d1a8bb7194f466ed5f 100644
--- a/ui/views/widget/native_widget_aura.cc
+++ b/ui/views/widget/native_widget_aura.cc
@@ -743,22 +743,6 @@ void NativeWidgetAura::OnBlur() {
delegate_->OnNativeBlur(window_->GetFocusManager()->GetFocusedWindow());
}
-bool NativeWidgetAura::OnKeyEvent(ui::KeyEvent* event) {
- if (event->is_char()) {
- // If a ui::InputMethod object is attached to the root window, character
- // events are handled inside the object and are not passed to this function.
- // If such object is not attached, character events might be sent (e.g. on
- // Windows). In this case, we just skip these.
- return false;
- }
- // Renderer may send a key event back to us if the key event wasn't handled,
- // and the window may be invisible by that time.
- if (!window_->IsVisible())
- return false;
- GetWidget()->GetInputMethod()->DispatchKeyEvent(*event);
- return true;
-}
-
gfx::NativeCursor NativeWidgetAura::GetCursor(const gfx::Point& point) {
return cursor_;
}
@@ -802,35 +786,6 @@ bool NativeWidgetAura::ShouldDescendIntoChildForEventHandling(
return true;
}
-bool NativeWidgetAura::OnMouseEvent(ui::MouseEvent* event) {
- DCHECK(window_->IsVisible());
- if (event->type() == ui::ET_MOUSEWHEEL)
- return delegate_->OnMouseEvent(*event);
-
- if (event->type() == ui::ET_SCROLL) {
- if (delegate_->OnMouseEvent(*event))
- return true;
-
- // Convert unprocessed scroll events into wheel events.
- ui::MouseWheelEvent mwe(*static_cast<ui::ScrollEvent*>(event));
- return delegate_->OnMouseEvent(mwe);
- }
- if (tooltip_manager_.get())
- tooltip_manager_->UpdateTooltip();
- return delegate_->OnMouseEvent(*event);
-}
-
-ui::TouchStatus NativeWidgetAura::OnTouchEvent(ui::TouchEvent* event) {
- DCHECK(window_->IsVisible());
- return delegate_->OnTouchEvent(*event);
-}
-
-ui::EventResult NativeWidgetAura::OnGestureEvent(
- ui::GestureEvent* event) {
- DCHECK(window_->IsVisible());
- return delegate_->OnGestureEvent(*event);
-}
-
bool NativeWidgetAura::CanFocus() {
return can_activate_;
}
@@ -876,6 +831,53 @@ void NativeWidgetAura::GetHitTestMask(gfx::Path* mask) const {
}
////////////////////////////////////////////////////////////////////////////////
+// NativeWidgetAura, ui::EventHandler implementation:
+
+ui::EventResult NativeWidgetAura::OnKeyEvent(ui::KeyEvent* event) {
+ if (event->is_char()) {
+ // If a ui::InputMethod object is attached to the root window, character
+ // events are handled inside the object and are not passed to this function.
+ // If such object is not attached, character events might be sent (e.g. on
+ // Windows). In this case, we just skip these.
+ return ui::ER_UNHANDLED;
+ }
+ // Renderer may send a key event back to us if the key event wasn't handled,
+ // and the window may be invisible by that time.
+ if (!window_->IsVisible())
+ return ui::ER_UNHANDLED;
+ GetWidget()->GetInputMethod()->DispatchKeyEvent(*event);
+ return ui::ER_HANDLED;
+}
+
+ui::EventResult NativeWidgetAura::OnMouseEvent(ui::MouseEvent* event) {
+ DCHECK(window_->IsVisible());
+ if (event->type() == ui::ET_MOUSEWHEEL)
+ return delegate_->OnMouseEvent(*event) ? ui::ER_HANDLED : ui::ER_UNHANDLED;
+
+ if (event->type() == ui::ET_SCROLL) {
+ if (delegate_->OnMouseEvent(*event))
+ return ui::ER_HANDLED;
+
+ // 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 (tooltip_manager_.get())
+ tooltip_manager_->UpdateTooltip();
+ return delegate_->OnMouseEvent(*event) ? ui::ER_HANDLED : ui::ER_UNHANDLED;
+}
+
+ui::TouchStatus NativeWidgetAura::OnTouchEvent(ui::TouchEvent* event) {
+ DCHECK(window_->IsVisible());
+ return delegate_->OnTouchEvent(*event);
+}
+
+ui::EventResult NativeWidgetAura::OnGestureEvent(ui::GestureEvent* event) {
+ DCHECK(window_->IsVisible());
+ return delegate_->OnGestureEvent(*event);
+}
+
+////////////////////////////////////////////////////////////////////////////////
// NativeWidgetAura, aura::ActivationDelegate implementation:
bool NativeWidgetAura::ShouldActivate(const ui::Event* event) {
« no previous file with comments | « ui/views/widget/native_widget_aura.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698