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" |
11 #include "ui/aura/env.h" | 11 #include "ui/aura/env.h" |
12 #include "ui/aura/window.h" | 12 #include "ui/aura/window.h" |
13 #include "ui/aura/window_event_dispatcher.h" | 13 #include "ui/aura/window_event_dispatcher.h" |
14 #include "ui/aura/window_targeter.h" | 14 #include "ui/aura/window_targeter.h" |
15 #include "ui/aura/window_tree_host_observer.h" | 15 #include "ui/aura/window_tree_host_observer.h" |
16 #include "ui/base/ime/input_method.h" | 16 #include "ui/base/ime/input_method.h" |
17 #include "ui/base/ime/input_method_factory.h" | 17 #include "ui/base/ime/input_method_factory.h" |
18 #include "ui/base/view_prop.h" | 18 #include "ui/base/view_prop.h" |
19 #include "ui/compositor/dip_util.h" | 19 #include "ui/compositor/dip_util.h" |
20 #include "ui/compositor/layer.h" | 20 #include "ui/compositor/layer.h" |
21 #include "ui/display/display.h" | 21 #include "ui/display/display.h" |
22 #include "ui/display/screen.h" | 22 #include "ui/display/screen.h" |
23 #include "ui/gfx/geometry/insets.h" | 23 #include "ui/gfx/geometry/insets.h" |
24 #include "ui/gfx/geometry/point.h" | 24 #include "ui/gfx/geometry/point.h" |
25 #include "ui/gfx/geometry/point3_f.h" | 25 #include "ui/gfx/geometry/point3_f.h" |
26 #include "ui/gfx/geometry/point_conversions.h" | 26 #include "ui/gfx/geometry/point_conversions.h" |
27 #include "ui/gfx/geometry/rect_conversions.h" | 27 #include "ui/gfx/geometry/rect_conversions.h" |
28 #include "ui/gfx/geometry/size_conversions.h" | 28 #include "ui/gfx/geometry/size_conversions.h" |
| 29 #include "ui/gfx/icc_profile.h" |
29 | 30 |
30 namespace aura { | 31 namespace aura { |
31 | 32 |
32 const char kWindowTreeHostForAcceleratedWidget[] = | 33 const char kWindowTreeHostForAcceleratedWidget[] = |
33 "__AURA_WINDOW_TREE_HOST_ACCELERATED_WIDGET__"; | 34 "__AURA_WINDOW_TREE_HOST_ACCELERATED_WIDGET__"; |
34 | 35 |
35 float GetDeviceScaleFactorFromDisplay(Window* window) { | 36 float GetDeviceScaleFactorFromDisplay(Window* window) { |
36 display::Display display = | 37 display::Display display = |
37 display::Screen::GetScreen()->GetDisplayNearestWindow(window); | 38 display::Screen::GetScreen()->GetDisplayNearestWindow(window); |
38 DCHECK(display.is_valid()); | 39 DCHECK(display.is_valid()); |
(...skipping 22 matching lines...) Expand all Loading... |
61 InitCompositor(); | 62 InitCompositor(); |
62 UpdateRootWindowSize(GetBounds().size()); | 63 UpdateRootWindowSize(GetBounds().size()); |
63 Env::GetInstance()->NotifyHostInitialized(this); | 64 Env::GetInstance()->NotifyHostInitialized(this); |
64 window()->Show(); | 65 window()->Show(); |
65 } | 66 } |
66 | 67 |
67 void WindowTreeHost::InitCompositor() { | 68 void WindowTreeHost::InitCompositor() { |
68 compositor_->SetScaleAndSize(GetDeviceScaleFactorFromDisplay(window()), | 69 compositor_->SetScaleAndSize(GetDeviceScaleFactorFromDisplay(window()), |
69 GetBounds().size()); | 70 GetBounds().size()); |
70 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( |
| 76 gfx::ICCProfile::FromBestMonitor().GetColorSpace()); |
71 } | 77 } |
72 | 78 |
73 void WindowTreeHost::AddObserver(WindowTreeHostObserver* observer) { | 79 void WindowTreeHost::AddObserver(WindowTreeHostObserver* observer) { |
74 observers_.AddObserver(observer); | 80 observers_.AddObserver(observer); |
75 } | 81 } |
76 | 82 |
77 void WindowTreeHost::RemoveObserver(WindowTreeHostObserver* observer) { | 83 void WindowTreeHost::RemoveObserver(WindowTreeHostObserver* observer) { |
78 observers_.RemoveObserver(observer); | 84 observers_.RemoveObserver(observer); |
79 } | 85 } |
80 | 86 |
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
321 client::CursorClient* cursor_client = client::GetCursorClient(window()); | 327 client::CursorClient* cursor_client = client::GetCursorClient(window()); |
322 if (cursor_client) { | 328 if (cursor_client) { |
323 const display::Display& display = | 329 const display::Display& display = |
324 display::Screen::GetScreen()->GetDisplayNearestWindow(window()); | 330 display::Screen::GetScreen()->GetDisplayNearestWindow(window()); |
325 cursor_client->SetDisplay(display); | 331 cursor_client->SetDisplay(display); |
326 } | 332 } |
327 dispatcher()->OnCursorMovedToRootLocation(root_location); | 333 dispatcher()->OnCursorMovedToRootLocation(root_location); |
328 } | 334 } |
329 | 335 |
330 } // namespace aura | 336 } // namespace aura |
OLD | NEW |