MD Downloads: prevent search text from overlapping with the cancel search (X)
[chromium-blink-merge.git] / ui / events / event_targeter.h
blobfbe7a0e0e7b0a8b7563c064244c6e4a0fd06bedf
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef UI_EVENTS_EVENT_TARGETER_H_
6 #define UI_EVENTS_EVENT_TARGETER_H_
8 #include "base/compiler_specific.h"
9 #include "ui/events/events_export.h"
11 namespace ui {
13 class Event;
14 class EventTarget;
16 class EVENTS_EXPORT EventTargeter {
17 public:
18 virtual ~EventTargeter() {}
20 // Returns the target |event| should be dispatched to. If there is no such
21 // target, return NULL. If |event| is a located event, the location of |event|
22 // is in the coordinate space of |root|. Furthermore, the targeter can mutate
23 // the event (e.g., by changing the location of the event to be in the
24 // returned target's coordinate space) so that it can be dispatched to the
25 // target without any further modification.
26 virtual EventTarget* FindTargetForEvent(EventTarget* root, Event* event) = 0;
28 // Returns the next best target for |event| as compared to |previous_target|.
29 // |event| is in the local coordinate space of |previous_target|.
30 // Also mutates |event| so that it can be dispatched to the returned target
31 // (e.g., by changing |event|'s location to be in the returned target's
32 // coordinate space).
33 virtual EventTarget* FindNextBestTarget(EventTarget* previous_target,
34 Event* event) = 0;
37 } // namespace ui
39 #endif // UI_EVENTS_EVENT_TARGETER_H_