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

Side by Side Diff: ui/base/events/event_target.cc

Issue 10916221: Make ToplevelWindowEventFilter and WorkspaceEventFilter into event handlers. (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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ui/base/events/event_target.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "ui/base/events/event_target.h" 5 #include "ui/base/events/event_target.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "ui/base/events/event.h" 10 #include "ui/base/events/event.h"
(...skipping 22 matching lines...) Expand all
33 33
34 void EventTarget::RemovePostTargetHandler(EventHandler* handler) { 34 void EventTarget::RemovePostTargetHandler(EventHandler* handler) {
35 post_target_list_.erase(std::remove(post_target_list_.begin(), 35 post_target_list_.erase(std::remove(post_target_list_.begin(),
36 post_target_list_.end(), handler)); 36 post_target_list_.end(), handler));
37 } 37 }
38 38
39 void EventTarget::GetPreTargetHandlers(EventHandlerList* list) { 39 void EventTarget::GetPreTargetHandlers(EventHandlerList* list) {
40 EventTarget* target = this; 40 EventTarget* target = this;
41 while (target) { 41 while (target) {
42 EventHandlerList::reverse_iterator it, rend; 42 EventHandlerList::reverse_iterator it, rend;
43 for (it = target->pre_target_list().rbegin(), 43 for (it = target->pre_target_list_.rbegin(),
44 rend = target->pre_target_list().rend(); 44 rend = target->pre_target_list_.rend();
45 it != rend; 45 it != rend;
46 ++it) { 46 ++it) {
47 list->insert(list->begin(), *it); 47 list->insert(list->begin(), *it);
48 } 48 }
49 target = target->GetParentTarget(); 49 target = target->GetParentTarget();
50 } 50 }
51 } 51 }
52 52
53 void EventTarget::GetPostTargetHandlers(EventHandlerList* list) { 53 void EventTarget::GetPostTargetHandlers(EventHandlerList* list) {
54 EventTarget* target = this; 54 EventTarget* target = this;
55 while (target) { 55 while (target) {
56 for (EventHandlerList::iterator it = target->post_target_list().begin(), 56 for (EventHandlerList::iterator it = target->post_target_list_.begin(),
57 end = target->post_target_list().end(); it != end; ++it) { 57 end = target->post_target_list_.end(); it != end; ++it) {
58 list->push_back(*it); 58 list->push_back(*it);
59 } 59 }
60 target = target->GetParentTarget(); 60 target = target->GetParentTarget();
61 } 61 }
62 } 62 }
63 63
64 EventResult EventTarget::OnKeyEvent(KeyEvent* event) { 64 EventResult EventTarget::OnKeyEvent(KeyEvent* event) {
65 CHECK_EQ(this, event->target()); 65 CHECK_EQ(this, event->target());
66 return target_handler_ ? target_handler_->OnKeyEvent(event) : ER_UNHANDLED; 66 return target_handler_ ? target_handler_->OnKeyEvent(event) : ER_UNHANDLED;
67 } 67 }
(...skipping 14 matching lines...) Expand all
82 TOUCH_STATUS_UNKNOWN; 82 TOUCH_STATUS_UNKNOWN;
83 } 83 }
84 84
85 EventResult EventTarget::OnGestureEvent(GestureEvent* event) { 85 EventResult EventTarget::OnGestureEvent(GestureEvent* event) {
86 CHECK_EQ(this, event->target()); 86 CHECK_EQ(this, event->target());
87 return target_handler_ ? target_handler_->OnGestureEvent(event) : 87 return target_handler_ ? target_handler_->OnGestureEvent(event) :
88 ER_UNHANDLED; 88 ER_UNHANDLED;
89 } 89 }
90 90
91 } // namespace ui 91 } // namespace ui
OLDNEW
« no previous file with comments | « ui/base/events/event_target.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698