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

Unified Diff: ui/aura/root_window.cc

Issue 10960015: aura: Start converting event-filters 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/aura/root_window.h ('k') | ui/aura/shared/compound_event_filter.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/aura/root_window.cc
diff --git a/ui/aura/root_window.cc b/ui/aura/root_window.cc
index 8ac31e76f47df6b693badcdfd21e7dbc53534c80..ac8e7bdc408f60240005d7d28c11c32faa02d51d 100644
--- a/ui/aura/root_window.cc
+++ b/ui/aura/root_window.cc
@@ -64,8 +64,6 @@ void GetEventFiltersToNotify(Window* target, EventFilters* filters) {
filters->push_back(target->event_filter());
target = target->parent();
}
- if (Env::GetInstance()->event_filter())
- filters->push_back(Env::GetInstance()->event_filter());
}
float GetDeviceScaleFactorFromDisplay(const Window* window) {
@@ -476,6 +474,13 @@ void RootWindow::SetTransform(const ui::Transform& transform) {
}
////////////////////////////////////////////////////////////////////////////////
+// RootWindow, ui::EventTarget implementation:
+
+ui::EventTarget* RootWindow::GetParentTarget() {
+ return Env::GetInstance();
+}
+
+////////////////////////////////////////////////////////////////////////////////
// RootWindow, ui::CompositorDelegate implementation:
void RootWindow::ScheduleDraw() {
@@ -664,6 +669,22 @@ ui::TouchStatus RootWindow::ProcessTouchEvent(Window* target,
if (!target->IsVisible())
return ui::TOUCH_STATUS_UNKNOWN;
+ ui::Event::DispatcherApi dispatch_helper(event);
+ dispatch_helper.set_target(target);
+
+ // It is necessary to dispatch the event to the event-handlers on env first.
+ // TODO(sad): Fix touch-event handling so it can use the same
+ // event-dispatching code used for other events.
+ ui::EventTarget::DispatcherApi dispatch_target_helper(Env::GetInstance());
+ const ui::EventHandlerList& pre_target =
+ dispatch_target_helper.pre_target_list();
+ for (ui::EventHandlerList::const_iterator iter = pre_target.begin();
+ iter != pre_target.end(); ++iter) {
+ ui::TouchStatus status = (*iter)->OnTouchEvent(event);
+ if (status != ui::TOUCH_STATUS_UNKNOWN)
+ return status;
+ }
+
EventFilters filters;
if (target == this)
GetEventFiltersToNotify(target, &filters);
@@ -674,8 +695,6 @@ ui::TouchStatus RootWindow::ProcessTouchEvent(Window* target,
WindowTracker tracker;
tracker.Add(target);
- ui::Event::DispatcherApi dispatcher(event);
- dispatcher.set_target(target);
for (EventFilters::const_reverse_iterator it = filters.rbegin(),
rend = filters.rend();
it != rend; ++it) {
@@ -791,12 +810,9 @@ bool RootWindow::CanDispatchToTarget(ui::EventTarget* target) {
}
void RootWindow::ProcessPreTargetList(ui::EventHandlerList* list) {
- if (Env::GetInstance()->event_filter())
- list->insert(list->begin(), Env::GetInstance()->event_filter());
}
void RootWindow::ProcessPostTargetList(ui::EventHandlerList* list) {
Ben Goodger (Google) 2012/09/21 18:09:18 seems like you could also nix this api now, since
sadrul 2012/09/21 19:05:36 Good point. But I am going to keep this for now si
- // TODO(sad):
}
bool RootWindow::DispatchLongPressGestureEvent(ui::GestureEvent* event) {
« no previous file with comments | « ui/aura/root_window.h ('k') | ui/aura/shared/compound_event_filter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698