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 #include "ui/aura/window_targeter.h" | 5 #include "ui/aura/window_targeter.h" |
6 | 6 |
7 #include "ui/aura/client/capture_client.h" | 7 #include "ui/aura/client/capture_client.h" |
8 #include "ui/aura/client/event_client.h" | 8 #include "ui/aura/client/event_client.h" |
9 #include "ui/aura/client/focus_client.h" | 9 #include "ui/aura/client/focus_client.h" |
10 #include "ui/aura/window.h" | 10 #include "ui/aura/window.h" |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 if (!root_window->bounds().Contains(event.location())) | 161 if (!root_window->bounds().Contains(event.location())) |
162 return root_window; | 162 return root_window; |
163 } | 163 } |
164 | 164 |
165 return nullptr; | 165 return nullptr; |
166 } | 166 } |
167 | 167 |
168 Window* WindowTargeter::FindTargetForLocatedEventRecursively( | 168 Window* WindowTargeter::FindTargetForLocatedEventRecursively( |
169 Window* root_window, | 169 Window* root_window, |
170 ui::LocatedEvent* event) { | 170 ui::LocatedEvent* event) { |
171 scoped_ptr<ui::EventTargetIterator> iter = root_window->GetChildIterator(); | 171 std::unique_ptr<ui::EventTargetIterator> iter = |
| 172 root_window->GetChildIterator(); |
172 if (iter) { | 173 if (iter) { |
173 ui::EventTarget* target = root_window; | 174 ui::EventTarget* target = root_window; |
174 for (ui::EventTarget* child = iter->GetNextTarget(); child; | 175 for (ui::EventTarget* child = iter->GetNextTarget(); child; |
175 child = iter->GetNextTarget()) { | 176 child = iter->GetNextTarget()) { |
176 WindowTargeter* targeter = | 177 WindowTargeter* targeter = |
177 static_cast<WindowTargeter*>(child->GetEventTargeter()); | 178 static_cast<WindowTargeter*>(child->GetEventTargeter()); |
178 if (!targeter) | 179 if (!targeter) |
179 targeter = this; | 180 targeter = this; |
180 if (!targeter->SubtreeShouldBeExploredForEvent( | 181 if (!targeter->SubtreeShouldBeExploredForEvent( |
181 static_cast<Window*>(child), *event)) { | 182 static_cast<Window*>(child), *event)) { |
182 continue; | 183 continue; |
183 } | 184 } |
184 target->ConvertEventToTarget(child, event); | 185 target->ConvertEventToTarget(child, event); |
185 target = child; | 186 target = child; |
186 Window* child_target_window = | 187 Window* child_target_window = |
187 static_cast<Window*>(targeter->FindTargetForEvent(child, event)); | 188 static_cast<Window*>(targeter->FindTargetForEvent(child, event)); |
188 if (child_target_window) | 189 if (child_target_window) |
189 return child_target_window; | 190 return child_target_window; |
190 } | 191 } |
191 target->ConvertEventToTarget(root_window, event); | 192 target->ConvertEventToTarget(root_window, event); |
192 } | 193 } |
193 return root_window->CanAcceptEvent(*event) ? root_window : nullptr; | 194 return root_window->CanAcceptEvent(*event) ? root_window : nullptr; |
194 } | 195 } |
195 | 196 |
196 } // namespace aura | 197 } // namespace aura |
OLD | NEW |