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
3 // found in the LICENSE file.
5 #include "ash/test/mirror_window_test_api.h"
7 #include "ash/display/cursor_window_controller.h"
8 #include "ash/display/mirror_window_controller.h"
9 #include "ash/display/root_window_transformers.h"
10 #include "ash/display/window_tree_host_manager.h"
11 #include "ash/host/root_window_transformer.h"
12 #include "ash/shell.h"
13 #include "ui/gfx/geometry/point.h"
18 const aura::WindowTreeHost
* MirrorWindowTestApi::GetHost() const {
19 aura::Window
* window
= Shell::GetInstance()
20 ->window_tree_host_manager()
21 ->mirror_window_controller()
23 return window
? window
->GetHost() : NULL
;
26 int MirrorWindowTestApi::GetCurrentCursorType() const {
27 return Shell::GetInstance()
28 ->window_tree_host_manager()
29 ->cursor_window_controller()
33 const gfx::Point
& MirrorWindowTestApi::GetCursorHotPoint() const {
34 return Shell::GetInstance()
35 ->window_tree_host_manager()
36 ->cursor_window_controller()
40 gfx::Point
MirrorWindowTestApi::GetCursorHotPointLocationInRootWindow() const {
41 return GetCursorWindow()->GetBoundsInRootWindow().origin() +
42 GetCursorHotPoint().OffsetFromOrigin();
45 const aura::Window
* MirrorWindowTestApi::GetCursorWindow() const {
46 return Shell::GetInstance()
47 ->window_tree_host_manager()
48 ->cursor_window_controller()
49 ->cursor_window_
.get();
52 gfx::Point
MirrorWindowTestApi::GetCursorLocation() const {
53 gfx::Point point
= GetCursorWindow()->GetBoundsInScreen().origin();
54 const gfx::Point hot_point
= GetCursorHotPoint();
55 point
.Offset(hot_point
.x(), hot_point
.y());