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/host/root_window_transformer.h"
11 #include "ash/shell.h"
12 #include "ui/gfx/geometry/point.h"
17 const aura::WindowTreeHost
* MirrorWindowTestApi::GetHost() const {
18 aura::Window
* window
= Shell::GetInstance()
19 ->display_controller()
20 ->mirror_window_controller()
22 return window
? window
->GetHost() : NULL
;
25 int MirrorWindowTestApi::GetCurrentCursorType() const {
26 return Shell::GetInstance()->display_controller()->
27 cursor_window_controller()->cursor_type_
;
30 const gfx::Point
& MirrorWindowTestApi::GetCursorHotPoint() const {
31 return Shell::GetInstance()->display_controller()->
32 cursor_window_controller()->hot_point_
;
35 gfx::Point
MirrorWindowTestApi::GetCursorHotPointLocationInRootWindow() const {
36 return GetCursorWindow()->GetBoundsInRootWindow().origin() +
37 GetCursorHotPoint().OffsetFromOrigin();
40 const aura::Window
* MirrorWindowTestApi::GetCursorWindow() const {
41 return Shell::GetInstance()->display_controller()->
42 cursor_window_controller()->cursor_window_
.get();
45 gfx::Point
MirrorWindowTestApi::GetCursorLocation() const {
46 gfx::Point point
= GetCursorWindow()->GetBoundsInScreen().origin();
47 const gfx::Point hot_point
= GetCursorHotPoint();
48 point
.Offset(hot_point
.x(), hot_point
.y());
52 scoped_ptr
<RootWindowTransformer
>
53 MirrorWindowTestApi::CreateCurrentRootWindowTransformer() const {
54 return Shell::GetInstance()->display_controller()->
55 mirror_window_controller()->CreateRootWindowTransformer();