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

Unified Diff: ui/views/widget/desktop_aura/desktop_native_widget_aura.cc

Issue 11570012: events: Update key-event handlers to not return EventResult. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: tot-merge-for-landing Created 8 years 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/desktop_aura/desktop_native_widget_aura.h ('k') | ui/views/widget/native_widget_aura.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/widget/desktop_aura/desktop_native_widget_aura.cc
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 9d706bc49f8a7054671b53a3de4da9e50be02efe..36c4fba392b4363df8225cca3b4beebf735bc6dc 100644
--- a/ui/views/widget/desktop_aura/desktop_native_widget_aura.cc
+++ b/ui/views/widget/desktop_aura/desktop_native_widget_aura.cc
@@ -544,27 +544,26 @@ scoped_refptr<ui::Texture> DesktopNativeWidgetAura::CopyTexture() {
////////////////////////////////////////////////////////////////////////////////
// DesktopNativeWidgetAura, ui::EventHandler implementation:
-ui::EventResult DesktopNativeWidgetAura::OnKeyEvent(ui::KeyEvent* event) {
+void DesktopNativeWidgetAura::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;
+ return;
}
// 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;
+ return;
- if (native_widget_delegate_->OnKeyEvent(*event))
- return ui::ER_HANDLED;
+ native_widget_delegate_->OnKeyEvent(event);
+ if (event->handled())
+ return;
if (GetWidget()->HasFocusManager() &&
!GetWidget()->GetFocusManager()->OnKeyEvent(*event))
- return ui::ER_HANDLED;
-
- return ui::ER_UNHANDLED;
+ event->SetHandled();
}
ui::EventResult DesktopNativeWidgetAura::OnMouseEvent(ui::MouseEvent* event) {
@@ -671,7 +670,8 @@ void DesktopNativeWidgetAura::OnWindowFocused(aura::Window* gained_focus,
void DesktopNativeWidgetAura::DispatchKeyEventPostIME(const ui::KeyEvent& key) {
FocusManager* focus_manager =
native_widget_delegate_->AsWidget()->GetFocusManager();
- if (native_widget_delegate_->OnKeyEvent(key) || !focus_manager)
+ native_widget_delegate_->OnKeyEvent(const_cast<ui::KeyEvent*>(&key));
+ if (key.handled() || !focus_manager)
return;
focus_manager->OnKeyEvent(key);
}
« no previous file with comments | « ui/views/widget/desktop_aura/desktop_native_widget_aura.h ('k') | ui/views/widget/native_widget_aura.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698