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)#ifndef ASH_DISPLAY_MIRROR_WINDOW_CONTROLLER_H_ 690dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)#define ASH_DISPLAY_MIRROR_WINDOW_CONTROLLER_H_ 790dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) 890dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)#include "ash/ash_export.h" 990dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)#include "base/compiler_specific.h" 10868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)#include "base/memory/ref_counted.h" 1190dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)#include "base/memory/scoped_ptr.h" 12a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)#include "ui/aura/window_tree_host_observer.h" 1390dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)#include "ui/gfx/native_widget_types.h" 14868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)#include "ui/gfx/size.h" 1590dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) 1690dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)namespace aura { 1790dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)class Window; 1890dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)} 1990dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) 20868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)namespace ui { 21868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)class Reflector; 22868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)} 23868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) 2490dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)namespace ash { 25a02191e04bc25c4935f804f2c080ae28663d096dBen Murdochclass AshWindowTreeHost; 26c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdochclass DisplayInfo; 27a02191e04bc25c4935f804f2c080ae28663d096dBen Murdochclass RootWindowTransformer; 28c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch 2990dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)namespace test{ 3090dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)class MirrorWindowTestApi; 3190dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)} 3290dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) 3390dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)// An object that copies the content of the primary root window to a 3490dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)// mirror window. This also draws a mouse cursor as the mouse cursor 3590dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)// is typically drawn by the window system. 36a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)class ASH_EXPORT MirrorWindowController : public aura::WindowTreeHostObserver { 3790dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) public: 3890dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) MirrorWindowController(); 39868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) virtual ~MirrorWindowController(); 4090dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) 4190dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) // Updates the root window's bounds using |display_info|. 4290dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) // Creates the new root window if one doesn't exist. 4390dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) void UpdateWindow(const DisplayInfo& display_info); 4490dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) 45868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) // Same as above, but using existing display info 46868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) // for the mirrored display. 47868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) void UpdateWindow(); 48868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) 49868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) // Close the mirror window. 5090dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) void Close(); 5190dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) 52a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) // aura::WindowTreeHostObserver overrides: 53a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) virtual void OnHostResized(const aura::WindowTreeHost* host) OVERRIDE; 545d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) 55a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch // Return the root window used to mirror the content. NULL if the 56a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch // display is not mirrored by the compositor path. 57a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch aura::Window* GetWindow(); 58868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) 5990dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) private: 6090dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) friend class test::MirrorWindowTestApi; 6190dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) 627d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles) // Creates a RootWindowTransformer for current display 637d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles) // configuration. 64a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch scoped_ptr<RootWindowTransformer> CreateRootWindowTransformer() const; 657d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles) 66a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch scoped_ptr<AshWindowTreeHost> ash_host_; 67868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) gfx::Size mirror_window_host_size_; 68868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) scoped_refptr<ui::Reflector> reflector_; 6990dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) 7090dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) DISALLOW_COPY_AND_ASSIGN(MirrorWindowController); 7190dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)}; 7290dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) 7390dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)} // namespace ash 7490dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) 7590dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)#endif // ASH_DISPLAY_MIRROR_WINDOW_CONTROLLER_H_ 76