Chromium Code Reviews| 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/threading/thread_task_runner_handle.h" | 7 #include "base/threading/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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 64 } | 64 } |
| 65 | 65 |
| 66 void WindowTreeHost::AddObserver(WindowTreeHostObserver* observer) { | 66 void WindowTreeHost::AddObserver(WindowTreeHostObserver* observer) { |
| 67 observers_.AddObserver(observer); | 67 observers_.AddObserver(observer); |
| 68 } | 68 } |
| 69 | 69 |
| 70 void WindowTreeHost::RemoveObserver(WindowTreeHostObserver* observer) { | 70 void WindowTreeHost::RemoveObserver(WindowTreeHostObserver* observer) { |
| 71 observers_.RemoveObserver(observer); | 71 observers_.RemoveObserver(observer); |
| 72 } | 72 } |
| 73 | 73 |
| 74 ui::EventProcessor* WindowTreeHost::event_processor() { | 74 ui::EventSink* WindowTreeHost::event_sink() { |
| 75 return dispatcher(); | 75 return dispatcher(); |
|
sky
2017/03/20 15:42:12
return dispatcher_.get;
Peng
2017/03/20 17:24:14
Done.
| |
| 76 } | 76 } |
| 77 | 77 |
| 78 gfx::Transform WindowTreeHost::GetRootTransform() const { | 78 gfx::Transform WindowTreeHost::GetRootTransform() const { |
| 79 float scale = ui::GetDeviceScaleFactor(window()->layer()); | 79 float scale = ui::GetDeviceScaleFactor(window()->layer()); |
| 80 gfx::Transform transform; | 80 gfx::Transform transform; |
| 81 transform.Scale(scale, scale); | 81 transform.Scale(scale, scale); |
| 82 transform *= window()->layer()->transform(); | 82 transform *= window()->layer()->transform(); |
| 83 return transform; | 83 return transform; |
| 84 } | 84 } |
| 85 | 85 |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 187 } | 187 } |
| 188 | 188 |
| 189 void WindowTreeHost::SetSharedInputMethod(ui::InputMethod* input_method) { | 189 void WindowTreeHost::SetSharedInputMethod(ui::InputMethod* input_method) { |
| 190 DCHECK(!input_method_); | 190 DCHECK(!input_method_); |
| 191 input_method_ = input_method; | 191 input_method_ = input_method; |
| 192 owned_input_method_ = false; | 192 owned_input_method_ = false; |
| 193 } | 193 } |
| 194 | 194 |
| 195 ui::EventDispatchDetails WindowTreeHost::DispatchKeyEventPostIME( | 195 ui::EventDispatchDetails WindowTreeHost::DispatchKeyEventPostIME( |
| 196 ui::KeyEvent* event) { | 196 ui::KeyEvent* event) { |
| 197 return SendEventToProcessor(event); | 197 return SendEventToSink(event); |
| 198 } | 198 } |
| 199 | 199 |
| 200 void WindowTreeHost::Show() { | 200 void WindowTreeHost::Show() { |
| 201 // Ensure that compositor has been properly initialized, see InitCompositor() | 201 // Ensure that compositor has been properly initialized, see InitCompositor() |
| 202 // and InitHost(). | 202 // and InitHost(). |
| 203 DCHECK(compositor()); | 203 DCHECK(compositor()); |
| 204 DCHECK_EQ(compositor()->root_layer(), window()->layer()); | 204 DCHECK_EQ(compositor()->root_layer(), window()->layer()); |
| 205 compositor()->SetVisible(true); | 205 compositor()->SetVisible(true); |
| 206 ShowImpl(); | 206 ShowImpl(); |
| 207 window()->Show(); | 207 window()->Show(); |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 322 if (capture_window && capture_window->GetRootWindow() == window()) | 322 if (capture_window && capture_window->GetRootWindow() == window()) |
| 323 capture_window->ReleaseCapture(); | 323 capture_window->ReleaseCapture(); |
| 324 } | 324 } |
| 325 | 325 |
| 326 gfx::ICCProfile WindowTreeHost::GetICCProfileForCurrentDisplay() { | 326 gfx::ICCProfile WindowTreeHost::GetICCProfileForCurrentDisplay() { |
| 327 // TODO(hubbe): Get the color space from the *current* monitor and | 327 // TODO(hubbe): Get the color space from the *current* monitor and |
| 328 // update it when window is moved or color space configuration changes. | 328 // update it when window is moved or color space configuration changes. |
| 329 return gfx::ICCProfile::FromBestMonitor(); | 329 return gfx::ICCProfile::FromBestMonitor(); |
| 330 } | 330 } |
| 331 | 331 |
| 332 ui::EventProcessor* WindowTreeHost::GetEventProcessor() { | 332 ui::EventSink* WindowTreeHost::GetEventSink() { |
| 333 return event_processor(); | 333 return event_sink(); |
|
sky
2017/03/20 15:42:12
return disptacher_.get();
Peng
2017/03/20 17:24:14
Done.
| |
| 334 } | 334 } |
| 335 | 335 |
| 336 //////////////////////////////////////////////////////////////////////////////// | 336 //////////////////////////////////////////////////////////////////////////////// |
| 337 // WindowTreeHost, private: | 337 // WindowTreeHost, private: |
| 338 | 338 |
| 339 void WindowTreeHost::MoveCursorToInternal(const gfx::Point& root_location, | 339 void WindowTreeHost::MoveCursorToInternal(const gfx::Point& root_location, |
| 340 const gfx::Point& host_location) { | 340 const gfx::Point& host_location) { |
| 341 last_cursor_request_position_in_host_ = host_location; | 341 last_cursor_request_position_in_host_ = host_location; |
| 342 MoveCursorToScreenLocationInPixels(host_location); | 342 MoveCursorToScreenLocationInPixels(host_location); |
| 343 client::CursorClient* cursor_client = client::GetCursorClient(window()); | 343 client::CursorClient* cursor_client = client::GetCursorClient(window()); |
| 344 if (cursor_client) { | 344 if (cursor_client) { |
| 345 const display::Display& display = | 345 const display::Display& display = |
| 346 display::Screen::GetScreen()->GetDisplayNearestWindow(window()); | 346 display::Screen::GetScreen()->GetDisplayNearestWindow(window()); |
| 347 cursor_client->SetDisplay(display); | 347 cursor_client->SetDisplay(display); |
| 348 } | 348 } |
| 349 dispatcher()->OnCursorMovedToRootLocation(root_location); | 349 dispatcher()->OnCursorMovedToRootLocation(root_location); |
| 350 } | 350 } |
| 351 | 351 |
| 352 } // namespace aura | 352 } // namespace aura |
| OLD | NEW |