190dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)// Copyright (c) 2013 The Chromium Authors. All rights reserved.
290dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be
390dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)// found in the LICENSE file.
490dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)
590dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)#include "ash/test/mirror_window_test_api.h"
690dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)
75d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#include "ash/display/cursor_window_controller.h"
87dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch#include "ash/display/display_controller.h"
990dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)#include "ash/display/mirror_window_controller.h"
10a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch#include "ash/host/root_window_transformer.h"
1190dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)#include "ash/shell.h"
1290dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)#include "ui/gfx/point.h"
1390dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)
1490dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)namespace ash {
1590dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)namespace test {
1690dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)
17a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)const aura::WindowTreeHost* MirrorWindowTestApi::GetHost() const {
18a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch  aura::Window* window = Shell::GetInstance()
19a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch                             ->display_controller()
20a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch                             ->mirror_window_controller()
21a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch                             ->GetWindow();
22a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch  return window ? window->GetHost() : NULL;
2390dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)}
2490dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)
2590dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)int MirrorWindowTestApi::GetCurrentCursorType() const {
267dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch  return Shell::GetInstance()->display_controller()->
275d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)      cursor_window_controller()->cursor_type_;
2890dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)}
2990dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)
3090dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)const gfx::Point& MirrorWindowTestApi::GetCursorHotPoint() const {
317dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch  return Shell::GetInstance()->display_controller()->
325d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)      cursor_window_controller()->hot_point_;
3390dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)}
3490dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)
3590dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)const aura::Window* MirrorWindowTestApi::GetCursorWindow() const {
367dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch  return Shell::GetInstance()->display_controller()->
375d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)      cursor_window_controller()->cursor_window_.get();
3890dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)}
3990dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)
40a02191e04bc25c4935f804f2c080ae28663d096dBen Murdochscoped_ptr<RootWindowTransformer>
417d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles)MirrorWindowTestApi::CreateCurrentRootWindowTransformer() const {
427dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch  return Shell::GetInstance()->display_controller()->
437dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch      mirror_window_controller()->CreateRootWindowTransformer();
447d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles)}
457d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles)
4690dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)}  // namespace test
4790dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)}  // namespace ash
48