| 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_port.h" | 14 #include "ui/aura/window_port.h" |
| 15 #include "ui/aura/window_targeter.h" | 15 #include "ui/aura/window_targeter.h" |
| 16 #include "ui/aura/window_tree_host_observer.h" | 16 #include "ui/aura/window_tree_host_observer.h" |
| 17 #include "ui/base/ime/input_method.h" | 17 #include "ui/base/ime/input_method.h" |
| 18 #include "ui/base/ime/input_method_factory.h" | 18 #include "ui/base/ime/input_method_factory.h" |
| 19 #include "ui/base/layout.h" |
| 19 #include "ui/base/view_prop.h" | 20 #include "ui/base/view_prop.h" |
| 20 #include "ui/compositor/dip_util.h" | 21 #include "ui/compositor/dip_util.h" |
| 21 #include "ui/compositor/layer.h" | 22 #include "ui/compositor/layer.h" |
| 22 #include "ui/display/display.h" | 23 #include "ui/display/display.h" |
| 23 #include "ui/display/screen.h" | 24 #include "ui/display/screen.h" |
| 24 #include "ui/gfx/geometry/insets.h" | 25 #include "ui/gfx/geometry/insets.h" |
| 25 #include "ui/gfx/geometry/point.h" | 26 #include "ui/gfx/geometry/point.h" |
| 26 #include "ui/gfx/geometry/point3_f.h" | 27 #include "ui/gfx/geometry/point3_f.h" |
| 27 #include "ui/gfx/geometry/point_conversions.h" | 28 #include "ui/gfx/geometry/point_conversions.h" |
| 28 #include "ui/gfx/geometry/rect_conversions.h" | 29 #include "ui/gfx/geometry/rect_conversions.h" |
| 29 #include "ui/gfx/geometry/size_conversions.h" | 30 #include "ui/gfx/geometry/size_conversions.h" |
| 30 #include "ui/gfx/icc_profile.h" | 31 #include "ui/gfx/icc_profile.h" |
| 31 | 32 |
| 32 namespace aura { | 33 namespace aura { |
| 33 | 34 |
| 34 const char kWindowTreeHostForAcceleratedWidget[] = | 35 const char kWindowTreeHostForAcceleratedWidget[] = |
| 35 "__AURA_WINDOW_TREE_HOST_ACCELERATED_WIDGET__"; | 36 "__AURA_WINDOW_TREE_HOST_ACCELERATED_WIDGET__"; |
| 36 | 37 |
| 37 float GetDeviceScaleFactorFromDisplay(Window* window) { | 38 float GetDeviceScaleFactorFromDisplay(Window* window) { |
| 38 display::Display display = | 39 return ui::GetScaleFactorForNativeView(window); |
| 39 display::Screen::GetScreen()->GetDisplayNearestWindow(window); | |
| 40 DCHECK(display.is_valid()); | |
| 41 return display.device_scale_factor(); | |
| 42 } | 40 } |
| 43 | 41 |
| 44 //////////////////////////////////////////////////////////////////////////////// | 42 //////////////////////////////////////////////////////////////////////////////// |
| 45 // WindowTreeHost, public: | 43 // WindowTreeHost, public: |
| 46 | 44 |
| 47 WindowTreeHost::~WindowTreeHost() { | 45 WindowTreeHost::~WindowTreeHost() { |
| 48 DCHECK(!compositor_) << "compositor must be destroyed before root window"; | 46 DCHECK(!compositor_) << "compositor must be destroyed before root window"; |
| 49 if (owned_input_method_) { | 47 if (owned_input_method_) { |
| 50 delete input_method_; | 48 delete input_method_; |
| 51 input_method_ = nullptr; | 49 input_method_ = nullptr; |
| (...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 345 client::CursorClient* cursor_client = client::GetCursorClient(window()); | 343 client::CursorClient* cursor_client = client::GetCursorClient(window()); |
| 346 if (cursor_client) { | 344 if (cursor_client) { |
| 347 const display::Display& display = | 345 const display::Display& display = |
| 348 display::Screen::GetScreen()->GetDisplayNearestWindow(window()); | 346 display::Screen::GetScreen()->GetDisplayNearestWindow(window()); |
| 349 cursor_client->SetDisplay(display); | 347 cursor_client->SetDisplay(display); |
| 350 } | 348 } |
| 351 dispatcher()->OnCursorMovedToRootLocation(root_location); | 349 dispatcher()->OnCursorMovedToRootLocation(root_location); |
| 352 } | 350 } |
| 353 | 351 |
| 354 } // namespace aura | 352 } // namespace aura |
| OLD | NEW |