| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 SERVICES_WINDOW_MANAGER_VIEW_TARGET_H_ | 5 #ifndef SERVICES_WINDOW_MANAGER_VIEW_TARGET_H_ |
| 6 #define SERVICES_WINDOW_MANAGER_VIEW_TARGET_H_ | 6 #define SERVICES_WINDOW_MANAGER_VIEW_TARGET_H_ |
| 7 | 7 |
| 8 #include "ui/events/event_target.h" | 8 #include "ui/events/event_target.h" |
| 9 | 9 |
| 10 namespace gfx { | 10 namespace gfx { |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 const ViewTarget* target, | 48 const ViewTarget* target, |
| 49 gfx::Point* point); | 49 gfx::Point* point); |
| 50 | 50 |
| 51 mojo::View* view() { return view_; } | 51 mojo::View* view() { return view_; } |
| 52 | 52 |
| 53 // TODO(erg): Make this const once we've removed aura from the tree and it's | 53 // TODO(erg): Make this const once we've removed aura from the tree and it's |
| 54 // feasible to change all callers of the EventTargeter interface to pass and | 54 // feasible to change all callers of the EventTargeter interface to pass and |
| 55 // accept const objects. (When that gets done, re-const the | 55 // accept const objects. (When that gets done, re-const the |
| 56 // EventTargetIterator::GetNextTarget and EventTarget::GetChildIterator | 56 // EventTargetIterator::GetNextTarget and EventTarget::GetChildIterator |
| 57 // interfaces.) | 57 // interfaces.) |
| 58 std::vector<ViewTarget*> GetChildren(); | 58 std::vector<ViewTarget*> GetChildren() const; |
| 59 | 59 |
| 60 const ViewTarget* GetParent() const; | 60 const ViewTarget* GetParent() const; |
| 61 gfx::Rect GetBounds() const; | 61 gfx::Rect GetBounds() const; |
| 62 bool HasParent() const; | 62 bool HasParent() const; |
| 63 bool IsVisible() const; | 63 bool IsVisible() const; |
| 64 | 64 |
| 65 const ViewTarget* GetRoot() const; | 65 const ViewTarget* GetRoot() const; |
| 66 | 66 |
| 67 // Sets a new ViewTargeter for the view, and returns the previous | 67 // Sets a new ViewTargeter for the view, and returns the previous |
| 68 // ViewTargeter. | 68 // ViewTargeter. |
| 69 scoped_ptr<ViewTargeter> SetEventTargeter(scoped_ptr<ViewTargeter> targeter); | 69 scoped_ptr<ViewTargeter> SetEventTargeter(scoped_ptr<ViewTargeter> targeter); |
| 70 | 70 |
| 71 // Overridden from ui::EventTarget: | 71 // Overridden from ui::EventTarget: |
| 72 bool CanAcceptEvent(const ui::Event& event) override; | 72 bool CanAcceptEvent(const ui::Event& event) override; |
| 73 EventTarget* GetParentTarget() override; | 73 EventTarget* GetParentTarget() override; |
| 74 scoped_ptr<ui::EventTargetIterator> GetChildIterator() override; | 74 scoped_ptr<ui::EventTargetIterator> GetChildIterator() const override; |
| 75 ui::EventTargeter* GetEventTargeter() override; | 75 ui::EventTargeter* GetEventTargeter() override; |
| 76 void ConvertEventToTarget(ui::EventTarget* target, | 76 void ConvertEventToTarget(ui::EventTarget* target, |
| 77 ui::LocatedEvent* event) override; | 77 ui::LocatedEvent* event) override; |
| 78 | 78 |
| 79 private: | 79 private: |
| 80 friend class TestView; | 80 friend class TestView; |
| 81 explicit ViewTarget(mojo::View* view_to_wrap); | 81 explicit ViewTarget(mojo::View* view_to_wrap); |
| 82 | 82 |
| 83 bool ConvertPointForAncestor(const ViewTarget* ancestor, | 83 bool ConvertPointForAncestor(const ViewTarget* ancestor, |
| 84 gfx::Point* point) const; | 84 gfx::Point* point) const; |
| 85 bool ConvertPointFromAncestor(const ViewTarget* ancestor, | 85 bool ConvertPointFromAncestor(const ViewTarget* ancestor, |
| 86 gfx::Point* point) const; | 86 gfx::Point* point) const; |
| 87 bool GetTargetOffsetRelativeTo(const ViewTarget* ancestor, | 87 bool GetTargetOffsetRelativeTo(const ViewTarget* ancestor, |
| 88 gfx::Vector2d* offset) const; | 88 gfx::Vector2d* offset) const; |
| 89 | 89 |
| 90 // The mojo::View that we dispatch to. | 90 // The mojo::View that we dispatch to. |
| 91 mojo::View* view_; | 91 mojo::View* view_; |
| 92 | 92 |
| 93 scoped_ptr<ViewTargeter> targeter_; | 93 scoped_ptr<ViewTargeter> targeter_; |
| 94 | 94 |
| 95 DISALLOW_COPY_AND_ASSIGN(ViewTarget); | 95 DISALLOW_COPY_AND_ASSIGN(ViewTarget); |
| 96 }; | 96 }; |
| 97 | 97 |
| 98 } // namespace window_manager | 98 } // namespace window_manager |
| 99 | 99 |
| 100 #endif // SERVICES_WINDOW_MANAGER_VIEW_TARGET_H_ | 100 #endif // SERVICES_WINDOW_MANAGER_VIEW_TARGET_H_ |
| OLD | NEW |