Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 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 | 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 #ifndef UI_AURA_WINDOW_TARGETER_H_ | 5 #ifndef UI_AURA_WINDOW_TARGETER_H_ |
| 6 #define UI_AURA_WINDOW_TARGETER_H_ | 6 #define UI_AURA_WINDOW_TARGETER_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "ui/aura/aura_export.h" | 9 #include "ui/aura/aura_export.h" |
| 10 #include "ui/events/event_targeter.h" | 10 #include "ui/events/event_targeter.h" |
| 11 | 11 |
| 12 namespace ui { | 12 namespace ui { |
| 13 class KeyEvent; | 13 class KeyEvent; |
| 14 class LocatedEvent; | 14 class LocatedEvent; |
| 15 } // namespace ui | 15 } // namespace ui |
| 16 | 16 |
| 17 namespace gfx { | |
| 18 class Point; | |
| 19 } // namespace gfx | |
| 20 | |
| 17 namespace aura { | 21 namespace aura { |
|
Lei Zhang
2016/08/18 20:30:57
nit: leave a blank line after the namespace like b
rbpotter
2016/08/19 01:59:09
Done.
| |
| 22 // Key for native window property that indicates if the window should have | |
| 23 // bounds independent of its modal parent. Only supported on ChromeOS. | |
| 24 AURA_EXPORT extern const char kHasIndependentBoundsKey[]; | |
| 18 | 25 |
| 19 class Window; | 26 class Window; |
| 20 | 27 |
| 21 class AURA_EXPORT WindowTargeter : public ui::EventTargeter { | 28 class AURA_EXPORT WindowTargeter : public ui::EventTargeter { |
| 22 public: | 29 public: |
| 23 WindowTargeter(); | 30 WindowTargeter(); |
| 24 ~WindowTargeter() override; | 31 ~WindowTargeter() override; |
| 25 | 32 |
| 26 // Returns true if |window| or one of its descendants can be a target of | 33 // Returns true if |window| or one of its descendants can be a target of |
| 27 // |event|. This requires that |window| and its descendants are not | 34 // |event|. This requires that |window| and its descendants are not |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 53 // parent's coordinate system. | 60 // parent's coordinate system. |
| 54 virtual bool EventLocationInsideBounds(Window* target, | 61 virtual bool EventLocationInsideBounds(Window* target, |
| 55 const ui::LocatedEvent& event) const; | 62 const ui::LocatedEvent& event) const; |
| 56 | 63 |
| 57 // ui::EventTargeter: | 64 // ui::EventTargeter: |
| 58 ui::EventTarget* FindTargetForEvent(ui::EventTarget* root, | 65 ui::EventTarget* FindTargetForEvent(ui::EventTarget* root, |
| 59 ui::Event* event) override; | 66 ui::Event* event) override; |
| 60 ui::EventTarget* FindNextBestTarget(ui::EventTarget* previous_target, | 67 ui::EventTarget* FindNextBestTarget(ui::EventTarget* previous_target, |
| 61 ui::Event* event) override; | 68 ui::Event* event) override; |
| 62 | 69 |
| 70 // Returns true if |child|'s bounds extend outside of |parent|'s bounds. | |
| 71 bool ChildHasBoundsOutsideParent(Window* parent, Window* child); | |
|
Lei Zhang
2016/08/18 20:30:57
static method since it doesn't depend on |this| at
rbpotter
2016/08/19 01:59:09
Done.
| |
| 72 | |
| 73 // Returns whether the location of the event is in an actionable region of | |
|
Lei Zhang
2016/08/18 20:30:58
s/the location of the event/|point|/
rbpotter
2016/08/19 01:59:10
Done.
| |
| 74 // |window| or of any of its children. Does not assume that children are | |
| 75 // restricted to the bounds of their modal parent windows if the | |
| 76 // kHasIndependentBounds property is set. If in_parent_coordinates is true | |
|
Lei Zhang
2016/08/18 20:30:57
nit: refer to variables as |var|
rbpotter
2016/08/19 01:59:09
Done.
| |
| 77 // |point| is in |window|'s parent's coordinate system, if false |point| is | |
| 78 // in |window|'s coordinate system. | |
| 79 bool HasIndependentChildWithEvent(Window* window, | |
| 80 gfx::Point point, | |
|
Lei Zhang
2016/08/18 20:30:57
Pass by const-ref
rbpotter
2016/08/19 01:59:10
Done.
| |
| 81 bool in_parent_coordinates); | |
| 82 | |
| 63 private: | 83 private: |
| 64 Window* FindTargetForKeyEvent(Window* root_window, const ui::KeyEvent& event); | 84 Window* FindTargetForKeyEvent(Window* root_window, const ui::KeyEvent& event); |
| 65 Window* FindTargetForNonKeyEvent(Window* root_window, ui::Event* event); | 85 Window* FindTargetForNonKeyEvent(Window* root_window, ui::Event* event); |
| 66 Window* FindTargetInRootWindow(Window* root_window, | 86 Window* FindTargetInRootWindow(Window* root_window, |
| 67 const ui::LocatedEvent& event); | 87 const ui::LocatedEvent& event); |
| 68 Window* FindTargetForLocatedEventRecursively(Window* root_window, | 88 Window* FindTargetForLocatedEventRecursively(Window* root_window, |
| 69 ui::LocatedEvent* event); | 89 ui::LocatedEvent* event); |
| 70 | 90 |
| 71 DISALLOW_COPY_AND_ASSIGN(WindowTargeter); | 91 DISALLOW_COPY_AND_ASSIGN(WindowTargeter); |
| 72 }; | 92 }; |
| 73 | 93 |
| 74 } // namespace aura | 94 } // namespace aura |
| 75 | 95 |
| 76 #endif // UI_AURA_WINDOW_TARGETER_H_ | 96 #endif // UI_AURA_WINDOW_TARGETER_H_ |
| OLD | NEW |