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

Side by Side Diff: ash/sticky_keys/sticky_keys_controller.cc

Issue 147203004: aura: Remove event-dispatch methods from WindowTreeHostDelegate interface. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: win Created 6 years, 10 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ash/sticky_keys/sticky_keys_controller.h" 5 #include "ash/sticky_keys/sticky_keys_controller.h"
6 6
7 #if defined(USE_X11) 7 #if defined(USE_X11)
8 #include <X11/extensions/XInput2.h> 8 #include <X11/extensions/XInput2.h>
9 #include <X11/Xlib.h> 9 #include <X11/Xlib.h>
10 #undef RootWindow 10 #undef RootWindow
(...skipping 29 matching lines...) Expand all
40 // StickyKeysHandlerDelegate overrides. 40 // StickyKeysHandlerDelegate overrides.
41 virtual void DispatchKeyEvent(ui::KeyEvent* event, 41 virtual void DispatchKeyEvent(ui::KeyEvent* event,
42 aura::Window* target) OVERRIDE; 42 aura::Window* target) OVERRIDE;
43 43
44 virtual void DispatchMouseEvent(ui::MouseEvent* event, 44 virtual void DispatchMouseEvent(ui::MouseEvent* event,
45 aura::Window* target) OVERRIDE; 45 aura::Window* target) OVERRIDE;
46 46
47 virtual void DispatchScrollEvent(ui::ScrollEvent* event, 47 virtual void DispatchScrollEvent(ui::ScrollEvent* event,
48 aura::Window* target) OVERRIDE; 48 aura::Window* target) OVERRIDE;
49 private: 49 private:
50 void DispatchEvent(ui::Event* event, aura::Window* target);
51
50 DISALLOW_COPY_AND_ASSIGN(StickyKeysHandlerDelegateImpl); 52 DISALLOW_COPY_AND_ASSIGN(StickyKeysHandlerDelegateImpl);
51 }; 53 };
52 54
53 StickyKeysHandlerDelegateImpl::StickyKeysHandlerDelegateImpl() { 55 StickyKeysHandlerDelegateImpl::StickyKeysHandlerDelegateImpl() {
54 } 56 }
55 57
56 StickyKeysHandlerDelegateImpl::~StickyKeysHandlerDelegateImpl() { 58 StickyKeysHandlerDelegateImpl::~StickyKeysHandlerDelegateImpl() {
57 } 59 }
58 60
59 void StickyKeysHandlerDelegateImpl::DispatchKeyEvent(ui::KeyEvent* event, 61 void StickyKeysHandlerDelegateImpl::DispatchKeyEvent(ui::KeyEvent* event,
60 aura::Window* target) { 62 aura::Window* target) {
61 DCHECK(target); 63 DispatchEvent(event, target);
62 target->GetDispatcher()->AsWindowTreeHostDelegate()->OnHostKeyEvent(event);
63 } 64 }
64 65
65 void StickyKeysHandlerDelegateImpl::DispatchMouseEvent(ui::MouseEvent* event, 66 void StickyKeysHandlerDelegateImpl::DispatchMouseEvent(ui::MouseEvent* event,
66 aura::Window* target) { 67 aura::Window* target) {
67 DCHECK(target); 68 DCHECK(target);
68 // We need to send a new, untransformed mouse event to the host. 69 // We need to send a new, untransformed mouse event to the host.
69 if (event->IsMouseWheelEvent()) { 70 if (event->IsMouseWheelEvent()) {
70 ui::MouseWheelEvent new_event(*static_cast<ui::MouseWheelEvent*>(event)); 71 ui::MouseWheelEvent new_event(*static_cast<ui::MouseWheelEvent*>(event));
71 target->GetDispatcher()->AsWindowTreeHostDelegate() 72 DispatchEvent(&new_event, target);
72 ->OnHostMouseEvent(&new_event);
73 } else { 73 } else {
74 ui::MouseEvent new_event(*event, target, target->GetRootWindow()); 74 ui::MouseEvent new_event(*event, target, target->GetRootWindow());
75 target->GetDispatcher()->AsWindowTreeHostDelegate() 75 DispatchEvent(&new_event, target);
76 ->OnHostMouseEvent(&new_event);
77 } 76 }
78 } 77 }
79 78
80 void StickyKeysHandlerDelegateImpl::DispatchScrollEvent( 79 void StickyKeysHandlerDelegateImpl::DispatchScrollEvent(
81 ui::ScrollEvent* event, 80 ui::ScrollEvent* event,
82 aura::Window* target) { 81 aura::Window* target) {
82 DispatchEvent(event, target);
83 }
84
85 void StickyKeysHandlerDelegateImpl::DispatchEvent(ui::Event* event,
86 aura::Window* target) {
83 DCHECK(target); 87 DCHECK(target);
84 target->GetDispatcher()->AsWindowTreeHostDelegate() 88 ui::EventDispatchDetails details =
85 ->OnHostScrollEvent(event); 89 target->GetDispatcher()->OnEventFromSource(event);
90 if (details.dispatcher_destroyed)
91 return;
86 } 92 }
87 93
88 } // namespace 94 } // namespace
89 95
90 /////////////////////////////////////////////////////////////////////////////// 96 ///////////////////////////////////////////////////////////////////////////////
91 // StickyKeys 97 // StickyKeys
92 StickyKeysController::StickyKeysController() 98 StickyKeysController::StickyKeysController()
93 : enabled_(false) { 99 : enabled_(false) {
94 } 100 }
95 101
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after
466 &xievent->mods.effective)); 472 &xievent->mods.effective));
467 } 473 }
468 } 474 }
469 #elif defined(USE_OZONE) 475 #elif defined(USE_OZONE)
470 NOTIMPLEMENTED() << "Modifier key is not handled"; 476 NOTIMPLEMENTED() << "Modifier key is not handled";
471 #endif 477 #endif
472 event->set_flags(event->flags() | modifier_flag_); 478 event->set_flags(event->flags() | modifier_flag_);
473 } 479 }
474 480
475 } // namespace ash 481 } // namespace ash
OLDNEW
« no previous file with comments | « ash/drag_drop/drag_drop_controller_unittest.cc ('k') | ash/sticky_keys/sticky_keys_overlay_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698