Revert "Reland c91b178b07b0d - Delete dead signin code (SigninGlobalError)"
[chromium-blink-merge.git] / ash / display / mirror_window_controller.h
blobd46088598268e8bcbafeae29ea2ee68c8c60591f
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 <map>
9 #include <vector>
11 #include "ash/ash_export.h"
12 #include "ash/display/display_manager.h"
13 #include "base/compiler_specific.h"
14 #include "base/memory/ref_counted.h"
15 #include "base/memory/scoped_ptr.h"
16 #include "ui/aura/window.h"
17 #include "ui/aura/window_tree_host_observer.h"
18 #include "ui/gfx/geometry/size.h"
19 #include "ui/gfx/native_widget_types.h"
21 namespace aura {
22 class Window;
23 namespace client {
24 class ScreenPositionClient;
28 namespace gfx {
29 class Display;
32 namespace ui {
33 class Reflector;
36 namespace ash {
37 class AshWindowTreeHost;
38 class DisplayInfo;
39 class RootWindowTransformer;
41 namespace test{
42 class MirrorWindowTestApi;
45 // An object that copies the content of the primary root window to a
46 // mirror window. This also draws a mouse cursor as the mouse cursor
47 // is typically drawn by the window system.
48 class ASH_EXPORT MirrorWindowController : public aura::WindowTreeHostObserver {
49 public:
50 MirrorWindowController();
51 ~MirrorWindowController() override;
53 // Updates the root window's bounds using |display_info|.
54 // Creates the new root window if one doesn't exist.
55 void UpdateWindow(const std::vector<DisplayInfo>& display_info);
57 // Same as above, but using existing display info
58 // for the mirrored display.
59 void UpdateWindow();
61 // Close the mirror window if they're not necessary any longer.
62 void CloseIfNotNecessary();
64 // aura::WindowTreeHostObserver overrides:
65 void OnHostResized(const aura::WindowTreeHost* host) override;
67 // Return the root window used to mirror the content. NULL if the
68 // display is not mirrored by the compositor path.
69 aura::Window* GetWindow();
71 // Returns the gfx::Display for the mirroring root window.
72 gfx::Display GetDisplayForRootWindow(const aura::Window* root) const;
74 // Returns the AshWindwoTreeHost created for |display_id|.
75 AshWindowTreeHost* GetAshWindowTreeHostForDisplayId(int64 display_id);
77 // Returns all root windows hosting mirroring displays.
78 aura::Window::Windows GetAllRootWindows() const;
80 private:
81 friend class test::MirrorWindowTestApi;
83 struct MirroringHostInfo;
85 // Close the mirror window. When |delay_host_deletion| is true, the window
86 // tree host will be deleted in an another task on UI thread. This is
87 // necessary to safely delete the WTH that is currently handling input events.
88 void Close(bool delay_host_deletion);
90 void CloseAndDeleteHost(MirroringHostInfo* host_info,
91 bool delay_host_deletion);
93 typedef std::map<int64_t, MirroringHostInfo*> MirroringHostInfoMap;
94 MirroringHostInfoMap mirroring_host_info_map_;
96 DisplayManager::MultiDisplayMode multi_display_mode_;
98 scoped_ptr<aura::client::ScreenPositionClient> screen_position_client_;
100 scoped_ptr<ui::Reflector> reflector_;
102 DISALLOW_COPY_AND_ASSIGN(MirrorWindowController);
105 } // namespace ash
107 #endif // ASH_DISPLAY_MIRROR_WINDOW_CONTROLLER_H_