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/display_controller.h"
9 #include "ash/display/mirror_window_controller.h"
10 #include "ash/display/root_window_transformers.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 ->display_controller()
21 ->mirror_window_controller()
23 return window
? window
->GetHost() : NULL
;
26 int MirrorWindowTestApi::GetCurrentCursorType() const {
27 return Shell::GetInstance()->display_controller()->
28 cursor_window_controller()->cursor_type_
;
31 const gfx::Point
& MirrorWindowTestApi::GetCursorHotPoint() const {
32 return Shell::GetInstance()->display_controller()->
33 cursor_window_controller()->hot_point_
;
36 gfx::Point
MirrorWindowTestApi::GetCursorHotPointLocationInRootWindow() const {
37 return GetCursorWindow()->GetBoundsInRootWindow().origin() +
38 GetCursorHotPoint().OffsetFromOrigin();
41 const aura::Window
* MirrorWindowTestApi::GetCursorWindow() const {
42 return Shell::GetInstance()->display_controller()->
43 cursor_window_controller()->cursor_window_
.get();
46 gfx::Point
MirrorWindowTestApi::GetCursorLocation() const {
47 gfx::Point point
= GetCursorWindow()->GetBoundsInScreen().origin();
48 const gfx::Point hot_point
= GetCursorHotPoint();
49 point
.Offset(hot_point
.x(), hot_point
.y());