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/thread_task_runner_handle.h" | 7 #include "base/thread_task_runner_handle.h" |
8 #include "base/trace_event/trace_event.h" | 8 #include "base/trace_event/trace_event.h" |
9 #include "ui/aura/client/capture_client.h" | 9 #include "ui/aura/client/capture_client.h" |
10 #include "ui/aura/client/cursor_client.h" | 10 #include "ui/aura/client/cursor_client.h" |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 DCHECK(!input_method_); | 195 DCHECK(!input_method_); |
196 input_method_ = input_method; | 196 input_method_ = input_method; |
197 owned_input_method_ = false; | 197 owned_input_method_ = false; |
198 } | 198 } |
199 | 199 |
200 bool WindowTreeHost::DispatchKeyEventPostIME(const ui::KeyEvent& event) { | 200 bool WindowTreeHost::DispatchKeyEventPostIME(const ui::KeyEvent& event) { |
201 ui::KeyEvent copied_event(event); | 201 ui::KeyEvent copied_event(event); |
202 ui::EventDispatchDetails details = | 202 ui::EventDispatchDetails details = |
203 event_processor()->OnEventFromSource(&copied_event); | 203 event_processor()->OnEventFromSource(&copied_event); |
204 DCHECK(!details.dispatcher_destroyed); | 204 DCHECK(!details.dispatcher_destroyed); |
205 return copied_event.handled(); | 205 return copied_event.stopped_propagation(); |
206 } | 206 } |
207 | 207 |
208 void WindowTreeHost::Show() { | 208 void WindowTreeHost::Show() { |
209 if (compositor()) | 209 if (compositor()) |
210 compositor()->SetVisible(true); | 210 compositor()->SetVisible(true); |
211 ShowImpl(); | 211 ShowImpl(); |
212 } | 212 } |
213 | 213 |
214 void WindowTreeHost::Hide() { | 214 void WindowTreeHost::Hide() { |
215 HideImpl(); | 215 HideImpl(); |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
306 capture_window->ReleaseCapture(); | 306 capture_window->ReleaseCapture(); |
307 } | 307 } |
308 | 308 |
309 ui::EventProcessor* WindowTreeHost::GetEventProcessor() { | 309 ui::EventProcessor* WindowTreeHost::GetEventProcessor() { |
310 return event_processor(); | 310 return event_processor(); |
311 } | 311 } |
312 | 312 |
313 ui::EventDispatchDetails WindowTreeHost::DeliverEventToProcessor( | 313 ui::EventDispatchDetails WindowTreeHost::DeliverEventToProcessor( |
314 ui::Event* event) { | 314 ui::Event* event) { |
315 if (event->IsKeyEvent()) { | 315 if (event->IsKeyEvent()) { |
316 if (GetInputMethod()->DispatchKeyEvent( | 316 GetInputMethod()->DispatchKeyEvent(*static_cast<ui::KeyEvent*>(event)); |
317 *static_cast<ui::KeyEvent*>(event))) { | 317 event->StopPropagation(); |
318 event->StopPropagation(); | 318 // TODO(shuchen): pass around the EventDispatchDetails from |
319 // TODO(shuchen): pass around the EventDispatchDetails from | 319 // DispatchKeyEventPostIME instead of creating new from here. |
320 // DispatchKeyEventPostIME instead of creating new from here. | 320 return ui::EventDispatchDetails(); |
321 return ui::EventDispatchDetails(); | |
322 } | |
323 } | 321 } |
324 return ui::EventSource::DeliverEventToProcessor(event); | 322 return ui::EventSource::DeliverEventToProcessor(event); |
325 } | 323 } |
326 | 324 |
327 //////////////////////////////////////////////////////////////////////////////// | 325 //////////////////////////////////////////////////////////////////////////////// |
328 // WindowTreeHost, private: | 326 // WindowTreeHost, private: |
329 | 327 |
330 void WindowTreeHost::MoveCursorToInternal(const gfx::Point& root_location, | 328 void WindowTreeHost::MoveCursorToInternal(const gfx::Point& root_location, |
331 const gfx::Point& host_location) { | 329 const gfx::Point& host_location) { |
332 last_cursor_request_position_in_host_ = host_location; | 330 last_cursor_request_position_in_host_ = host_location; |
333 MoveCursorToNative(host_location); | 331 MoveCursorToNative(host_location); |
334 client::CursorClient* cursor_client = client::GetCursorClient(window()); | 332 client::CursorClient* cursor_client = client::GetCursorClient(window()); |
335 if (cursor_client) { | 333 if (cursor_client) { |
336 const gfx::Display& display = | 334 const gfx::Display& display = |
337 gfx::Screen::GetScreenFor(window())->GetDisplayNearestWindow(window()); | 335 gfx::Screen::GetScreenFor(window())->GetDisplayNearestWindow(window()); |
338 cursor_client->SetDisplay(display); | 336 cursor_client->SetDisplay(display); |
339 } | 337 } |
340 dispatcher()->OnCursorMovedToRootLocation(root_location); | 338 dispatcher()->OnCursorMovedToRootLocation(root_location); |
341 } | 339 } |
342 | 340 |
343 } // namespace aura | 341 } // namespace aura |
OLD | NEW |