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 #ifndef ASH_DISPLAY_MIRROR_WINDOW_CONTROLLER_H_
6 #define ASH_DISPLAY_MIRROR_WINDOW_CONTROLLER_H_
8 #include "ash/ash_export.h"
9 #include "base/compiler_specific.h"
10 #include "base/memory/ref_counted.h"
11 #include "base/memory/scoped_ptr.h"
12 #include "ui/aura/root_window_observer.h"
13 #include "ui/gfx/display.h"
14 #include "ui/gfx/native_widget_types.h"
15 #include "ui/gfx/point.h"
16 #include "ui/gfx/size.h"
20 class RootWindowTransformer;
30 class MirrorWindowTestApi;
35 class CursorWindowDelegate;
37 // An object that copies the content of the primary root window to a
38 // mirror window. This also draws a mouse cursor as the mouse cursor
39 // is typically drawn by the window system.
40 class ASH_EXPORT MirrorWindowController : public aura::RootWindowObserver {
42 MirrorWindowController();
43 virtual ~MirrorWindowController();
45 // Updates the root window's bounds using |display_info|.
46 // Creates the new root window if one doesn't exist.
47 void UpdateWindow(const DisplayInfo& display_info);
49 // Same as above, but using existing display info
50 // for the mirrored display.
53 // Close the mirror window.
56 // Updates the mirrored cursor location,shape and
58 void UpdateCursorLocation();
59 void SetMirroredCursor(gfx::NativeCursor cursor);
60 void SetMirroredCursorVisibility(bool visible);
62 // aura::RootWindowObserver overrides:
63 virtual void OnRootWindowHostResized(const aura::RootWindow* root) OVERRIDE;
66 friend class test::MirrorWindowTestApi;
68 // Creates a RootWindowTransformer for current display
70 scoped_ptr<aura::RootWindowTransformer> CreateRootWindowTransformer() const;
72 int current_cursor_type_;
73 gfx::Display::Rotation current_cursor_rotation_;
74 aura::Window* cursor_window_; // owned by root window.
75 scoped_ptr<aura::RootWindow> root_window_;
76 scoped_ptr<CursorWindowDelegate> cursor_window_delegate_;
77 gfx::Point hot_point_;
78 gfx::Size mirror_window_host_size_;
79 scoped_refptr<ui::Reflector> reflector_;
81 DISALLOW_COPY_AND_ASSIGN(MirrorWindowController);
84 } // namespace internal
87 #endif // ASH_DISPLAY_MIRROR_WINDOW_CONTROLLER_H_