Chromium Code Reviews| 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 "services/ui/public/cpp/window.h" | 7 #include "services/ui/public/cpp/window.h" |
| 8 #include "services/ui/public/cpp/window_tree_client.h" | 8 #include "services/ui/public/cpp/window_tree_client.h" |
| 9 #include "ui/events/base_event_utils.h" | 9 #include "ui/events/base_event_utils.h" |
| 10 #include "ui/events/event.h" | 10 #include "ui/events/event.h" |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 40 if (!had_watcher) { | 40 if (!had_watcher) { |
| 41 // First PointerWatcher added, start the watcher on the window server. | 41 // First PointerWatcher added, start the watcher on the window server. |
| 42 window_tree_client_->StartPointerWatcher(want_moves); | 42 window_tree_client_->StartPointerWatcher(want_moves); |
| 43 } | 43 } |
| 44 } | 44 } |
| 45 | 45 |
| 46 void PointerWatcherEventRouter::RemovePointerWatcher(PointerWatcher* watcher) { | 46 void PointerWatcherEventRouter::RemovePointerWatcher(PointerWatcher* watcher) { |
| 47 pointer_watchers_.RemoveObserver(watcher); | 47 pointer_watchers_.RemoveObserver(watcher); |
| 48 if (!HasPointerWatcher()) { | 48 if (!HasPointerWatcher()) { |
| 49 // Last PointerWatcher removed, stop the watcher on the window server. | 49 // Last PointerWatcher removed, stop the watcher on the window server. |
| 50 window_tree_client_->StopPointerWatcher(); | 50 if (window_tree_client_) |
|
James Cook
2016/08/17 03:29:39
Where are we tearing down the window tree client b
msw
2016/08/17 17:45:44
The WindowTreeClient dtor (1) calls OnWillDestroyC
| |
| 51 window_tree_client_->StopPointerWatcher(); | |
| 51 pointer_watcher_want_moves_ = false; | 52 pointer_watcher_want_moves_ = false; |
| 52 } | 53 } |
| 53 } | 54 } |
| 54 | 55 |
| 55 void PointerWatcherEventRouter::OnPointerEventObserved( | 56 void PointerWatcherEventRouter::OnPointerEventObserved( |
| 56 const ui::PointerEvent& event, | 57 const ui::PointerEvent& event, |
| 57 ui::Window* target) { | 58 ui::Window* target) { |
| 58 Widget* target_widget = nullptr; | 59 Widget* target_widget = nullptr; |
| 59 if (target) { | 60 if (target) { |
| 60 ui::Window* window = target; | 61 ui::Window* window = target; |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 88 } | 89 } |
| 89 | 90 |
| 90 void PointerWatcherEventRouter::OnWillDestroyClient( | 91 void PointerWatcherEventRouter::OnWillDestroyClient( |
| 91 ui::WindowTreeClient* client) { | 92 ui::WindowTreeClient* client) { |
| 92 DCHECK_EQ(client, window_tree_client_); | 93 DCHECK_EQ(client, window_tree_client_); |
| 93 window_tree_client_->RemoveObserver(this); | 94 window_tree_client_->RemoveObserver(this); |
| 94 window_tree_client_ = nullptr; | 95 window_tree_client_ = nullptr; |
| 95 } | 96 } |
| 96 | 97 |
| 97 } // namespace views | 98 } // namespace views |
| OLD | NEW |