Upstream version 5.34.104.0
[platform/framework/web/crosswalk.git] / src / ash / display / mirror_window_controller.h
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.
4
5 #ifndef ASH_DISPLAY_MIRROR_WINDOW_CONTROLLER_H_
6 #define ASH_DISPLAY_MIRROR_WINDOW_CONTROLLER_H_
7
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"
17
18 namespace aura {
19 class RootWindow;
20 class RootWindowTransformer;
21 class Window;
22 }
23
24 namespace ui {
25 class Reflector;
26 }
27
28 namespace ash {
29 namespace test{
30 class MirrorWindowTestApi;
31 }
32
33 namespace internal {
34 class DisplayInfo;
35
36 // An object that copies the content of the primary root window to a
37 // mirror window. This also draws a mouse cursor as the mouse cursor
38 // is typically drawn by the window system.
39 class ASH_EXPORT MirrorWindowController : public aura::RootWindowObserver {
40  public:
41   MirrorWindowController();
42   virtual ~MirrorWindowController();
43
44   // Updates the root window's bounds using |display_info|.
45   // Creates the new root window if one doesn't exist.
46   void UpdateWindow(const DisplayInfo& display_info);
47
48   // Same as above, but using existing display info
49   // for the mirrored display.
50   void UpdateWindow();
51
52   // Close the mirror window.
53   void Close();
54
55   // aura::RootWindowObserver overrides:
56   virtual void OnWindowTreeHostResized(const aura::RootWindow* root) OVERRIDE;
57
58   // Returns the mirror root window.
59   aura::RootWindow* root_window() const { return root_window_.get(); }
60
61  private:
62   friend class test::MirrorWindowTestApi;
63
64   // Creates a RootWindowTransformer for current display
65   // configuration.
66   scoped_ptr<aura::RootWindowTransformer> CreateRootWindowTransformer() const;
67
68   scoped_ptr<aura::RootWindow> root_window_;
69   gfx::Size mirror_window_host_size_;
70   scoped_refptr<ui::Reflector> reflector_;
71
72   DISALLOW_COPY_AND_ASSIGN(MirrorWindowController);
73 };
74
75 }  // namespace internal
76 }  // namespace ash
77
78 #endif  // ASH_DISPLAY_MIRROR_WINDOW_CONTROLLER_H_