| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/views/mus/pointer_watcher_event_router.h" | 5 #include "ui/views/mus/pointer_watcher_event_router.h" |
| 6 | 6 |
| 7 #include "ui/aura/client/capture_client.h" | 7 #include "ui/aura/client/capture_client.h" |
| 8 #include "ui/aura/mus/window_tree_client.h" | 8 #include "ui/aura/mus/window_tree_client.h" |
| 9 #include "ui/aura/window.h" | 9 #include "ui/aura/window.h" |
| 10 #include "ui/display/screen.h" | 10 #include "ui/display/screen.h" |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 return EventTypes::MOVE_EVENTS; | 145 return EventTypes::MOVE_EVENTS; |
| 146 | 146 |
| 147 if (HasPointerWatcher(&non_move_watchers_)) | 147 if (HasPointerWatcher(&non_move_watchers_)) |
| 148 return EventTypes::NON_MOVE_EVENTS; | 148 return EventTypes::NON_MOVE_EVENTS; |
| 149 | 149 |
| 150 return EventTypes::NONE; | 150 return EventTypes::NONE; |
| 151 } | 151 } |
| 152 | 152 |
| 153 void PointerWatcherEventRouter::OnCaptureChanged(aura::Window* lost_capture, | 153 void PointerWatcherEventRouter::OnCaptureChanged(aura::Window* lost_capture, |
| 154 aura::Window* gained_capture) { | 154 aura::Window* gained_capture) { |
| 155 const ui::MouseEvent mouse_event(ui::ET_MOUSE_CAPTURE_CHANGED, gfx::Point(), | 155 const ui::MouseEvent mouse_event( |
| 156 gfx::Point(), ui::EventTimeForNow(), 0, 0); | 156 ui::ET_MOUSE_CAPTURE_CHANGED, gfx::Point(), gfx::Point(), |
| 157 ui::EventTimeForNow(), 0, 0, |
| 158 ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_MOUSE, |
| 159 ui::PointerEvent::kMousePointerId)); |
| 157 const ui::PointerEvent event(mouse_event); | 160 const ui::PointerEvent event(mouse_event); |
| 158 gfx::Point location_in_screen = | 161 gfx::Point location_in_screen = |
| 159 display::Screen::GetScreen()->GetCursorScreenPoint(); | 162 display::Screen::GetScreen()->GetCursorScreenPoint(); |
| 160 for (PointerWatcher& observer : move_watchers_) | 163 for (PointerWatcher& observer : move_watchers_) |
| 161 observer.OnPointerEventObserved(event, location_in_screen, nullptr); | 164 observer.OnPointerEventObserved(event, location_in_screen, nullptr); |
| 162 for (PointerWatcher& observer : non_move_watchers_) | 165 for (PointerWatcher& observer : non_move_watchers_) |
| 163 observer.OnPointerEventObserved(event, location_in_screen, nullptr); | 166 observer.OnPointerEventObserved(event, location_in_screen, nullptr); |
| 164 } | 167 } |
| 165 | 168 |
| 166 void PointerWatcherEventRouter::OnWillDestroyClient( | 169 void PointerWatcherEventRouter::OnWillDestroyClient( |
| 167 aura::WindowTreeClient* client) { | 170 aura::WindowTreeClient* client) { |
| 168 // We expect that all observers have been removed by this time. | 171 // We expect that all observers have been removed by this time. |
| 169 DCHECK_EQ(event_types_, EventTypes::NONE); | 172 DCHECK_EQ(event_types_, EventTypes::NONE); |
| 170 DCHECK_EQ(client, window_tree_client_); | 173 DCHECK_EQ(client, window_tree_client_); |
| 171 window_tree_client_->RemoveObserver(this); | 174 window_tree_client_->RemoveObserver(this); |
| 172 window_tree_client_ = nullptr; | 175 window_tree_client_ = nullptr; |
| 173 } | 176 } |
| 174 | 177 |
| 175 } // namespace views | 178 } // namespace views |
| OLD | NEW |