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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 InitCompositor(); | 62 InitCompositor(); |
63 UpdateRootWindowSize(GetBounds().size()); | 63 UpdateRootWindowSize(GetBounds().size()); |
64 Env::GetInstance()->NotifyHostInitialized(this); | 64 Env::GetInstance()->NotifyHostInitialized(this); |
65 window()->Show(); | 65 window()->Show(); |
66 } | 66 } |
67 | 67 |
68 void WindowTreeHost::InitCompositor() { | 68 void WindowTreeHost::InitCompositor() { |
69 compositor_->SetScaleAndSize(GetDeviceScaleFactorFromDisplay(window()), | 69 compositor_->SetScaleAndSize(GetDeviceScaleFactorFromDisplay(window()), |
70 GetBounds().size()); | 70 GetBounds().size()); |
71 compositor_->SetRootLayer(window()->layer()); | 71 compositor_->SetRootLayer(window()->layer()); |
72 | |
73 // TODO(hubbe): Get the color space from the *current* monitor and | |
74 // update it when window is moved or color space configuration changes. | |
75 compositor_->SetDisplayColorSpace( | 72 compositor_->SetDisplayColorSpace( |
76 gfx::ICCProfile::FromBestMonitor().GetColorSpace()); | 73 GetICCProfileForCurrentDisplay().GetColorSpace()); |
77 } | 74 } |
78 | 75 |
79 void WindowTreeHost::AddObserver(WindowTreeHostObserver* observer) { | 76 void WindowTreeHost::AddObserver(WindowTreeHostObserver* observer) { |
80 observers_.AddObserver(observer); | 77 observers_.AddObserver(observer); |
81 } | 78 } |
82 | 79 |
83 void WindowTreeHost::RemoveObserver(WindowTreeHostObserver* observer) { | 80 void WindowTreeHost::RemoveObserver(WindowTreeHostObserver* observer) { |
84 observers_.RemoveObserver(observer); | 81 observers_.RemoveObserver(observer); |
85 } | 82 } |
86 | 83 |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
313 capture_window->ReleaseCapture(); | 310 capture_window->ReleaseCapture(); |
314 } | 311 } |
315 | 312 |
316 ui::EventProcessor* WindowTreeHost::GetEventProcessor() { | 313 ui::EventProcessor* WindowTreeHost::GetEventProcessor() { |
317 return event_processor(); | 314 return event_processor(); |
318 } | 315 } |
319 | 316 |
320 //////////////////////////////////////////////////////////////////////////////// | 317 //////////////////////////////////////////////////////////////////////////////// |
321 // WindowTreeHost, private: | 318 // WindowTreeHost, private: |
322 | 319 |
| 320 gfx::ICCProfile WindowTreeHost::GetICCProfileForCurrentDisplay() { |
| 321 // TODO(hubbe): Get the color space from the *current* monitor and |
| 322 // update it when window is moved or color space configuration changes. |
| 323 return gfx::ICCProfile::FromBestMonitor(); |
| 324 } |
| 325 |
323 void WindowTreeHost::MoveCursorToInternal(const gfx::Point& root_location, | 326 void WindowTreeHost::MoveCursorToInternal(const gfx::Point& root_location, |
324 const gfx::Point& host_location) { | 327 const gfx::Point& host_location) { |
325 last_cursor_request_position_in_host_ = host_location; | 328 last_cursor_request_position_in_host_ = host_location; |
326 MoveCursorToNative(host_location); | 329 MoveCursorToNative(host_location); |
327 client::CursorClient* cursor_client = client::GetCursorClient(window()); | 330 client::CursorClient* cursor_client = client::GetCursorClient(window()); |
328 if (cursor_client) { | 331 if (cursor_client) { |
329 const display::Display& display = | 332 const display::Display& display = |
330 display::Screen::GetScreen()->GetDisplayNearestWindow(window()); | 333 display::Screen::GetScreen()->GetDisplayNearestWindow(window()); |
331 cursor_client->SetDisplay(display); | 334 cursor_client->SetDisplay(display); |
332 } | 335 } |
333 dispatcher()->OnCursorMovedToRootLocation(root_location); | 336 dispatcher()->OnCursorMovedToRootLocation(root_location); |
334 } | 337 } |
335 | 338 |
336 } // namespace aura | 339 } // namespace aura |
OLD | NEW |