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_tree_host.h" | 5 #include "ui/aura/window_tree_host.h" |
6 | 6 |
7 #include "base/debug/trace_event.h" | 7 #include "base/debug/trace_event.h" |
8 #include "ui/aura/client/capture_client.h" | 8 #include "ui/aura/client/capture_client.h" |
9 #include "ui/aura/client/cursor_client.h" | 9 #include "ui/aura/client/cursor_client.h" |
10 #include "ui/aura/env.h" | 10 #include "ui/aura/env.h" |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 // so just pass everything along to the host. | 143 // so just pass everything along to the host. |
144 SetCursorNative(cursor); | 144 SetCursorNative(cursor); |
145 } | 145 } |
146 | 146 |
147 void WindowTreeHost::OnCursorVisibilityChanged(bool show) { | 147 void WindowTreeHost::OnCursorVisibilityChanged(bool show) { |
148 // Clear any existing mouse hover effects when the cursor becomes invisible. | 148 // Clear any existing mouse hover effects when the cursor becomes invisible. |
149 // Note we do not need to dispatch a mouse enter when the cursor becomes | 149 // Note we do not need to dispatch a mouse enter when the cursor becomes |
150 // visible because that can only happen in response to a mouse event, which | 150 // visible because that can only happen in response to a mouse event, which |
151 // will trigger its own mouse enter. | 151 // will trigger its own mouse enter. |
152 if (!show) { | 152 if (!show) { |
153 dispatcher()->DispatchMouseExitAtPoint( | 153 ui::EventDispatchDetails details = dispatcher()->DispatchMouseExitAtPoint( |
154 dispatcher()->GetLastMouseLocationInRoot()); | 154 dispatcher()->GetLastMouseLocationInRoot()); |
| 155 if (details.dispatcher_destroyed) |
| 156 return; |
155 } | 157 } |
156 | 158 |
157 OnCursorVisibilityChangedNative(show); | 159 OnCursorVisibilityChangedNative(show); |
158 } | 160 } |
159 | 161 |
160 void WindowTreeHost::MoveCursorTo(const gfx::Point& location_in_dip) { | 162 void WindowTreeHost::MoveCursorTo(const gfx::Point& location_in_dip) { |
161 gfx::Point host_location(location_in_dip); | 163 gfx::Point host_location(location_in_dip); |
162 ConvertPointToHost(&host_location); | 164 ConvertPointToHost(&host_location); |
163 MoveCursorToInternal(location_in_dip, host_location); | 165 MoveCursorToInternal(location_in_dip, host_location); |
164 } | 166 } |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 client::CursorClient* cursor_client = client::GetCursorClient(window()); | 266 client::CursorClient* cursor_client = client::GetCursorClient(window()); |
265 if (cursor_client) { | 267 if (cursor_client) { |
266 const gfx::Display& display = | 268 const gfx::Display& display = |
267 gfx::Screen::GetScreenFor(window())->GetDisplayNearestWindow(window()); | 269 gfx::Screen::GetScreenFor(window())->GetDisplayNearestWindow(window()); |
268 cursor_client->SetDisplay(display); | 270 cursor_client->SetDisplay(display); |
269 } | 271 } |
270 dispatcher()->OnCursorMovedToRootLocation(root_location); | 272 dispatcher()->OnCursorMovedToRootLocation(root_location); |
271 } | 273 } |
272 | 274 |
273 } // namespace aura | 275 } // namespace aura |
OLD | NEW |