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" |
| 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 compositor_->SetDisplayColorSpace( | |
| 73 gfx::ICCProfile::FromBestMonitor().GetColorSpace()); | |
|
sky
2016/09/07 20:15:58
What is FromBestMonitor? Shouldn't you pick the pr
hubbe1
2016/09/07 20:29:25
Yes we should, but we don't have the ability yet.
sky
2016/09/07 21:41:47
Yes please.
| |
| 71 } | 74 } |
| 72 | 75 |
| 73 void WindowTreeHost::AddObserver(WindowTreeHostObserver* observer) { | 76 void WindowTreeHost::AddObserver(WindowTreeHostObserver* observer) { |
| 74 observers_.AddObserver(observer); | 77 observers_.AddObserver(observer); |
| 75 } | 78 } |
| 76 | 79 |
| 77 void WindowTreeHost::RemoveObserver(WindowTreeHostObserver* observer) { | 80 void WindowTreeHost::RemoveObserver(WindowTreeHostObserver* observer) { |
| 78 observers_.RemoveObserver(observer); | 81 observers_.RemoveObserver(observer); |
| 79 } | 82 } |
| 80 | 83 |
| (...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 321 client::CursorClient* cursor_client = client::GetCursorClient(window()); | 324 client::CursorClient* cursor_client = client::GetCursorClient(window()); |
| 322 if (cursor_client) { | 325 if (cursor_client) { |
| 323 const display::Display& display = | 326 const display::Display& display = |
| 324 display::Screen::GetScreen()->GetDisplayNearestWindow(window()); | 327 display::Screen::GetScreen()->GetDisplayNearestWindow(window()); |
| 325 cursor_client->SetDisplay(display); | 328 cursor_client->SetDisplay(display); |
| 326 } | 329 } |
| 327 dispatcher()->OnCursorMovedToRootLocation(root_location); | 330 dispatcher()->OnCursorMovedToRootLocation(root_location); |
| 328 } | 331 } |
| 329 | 332 |
| 330 } // namespace aura | 333 } // namespace aura |
| OLD | NEW |