| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef ASH_DISPLAY_MIRROR_WINDOW_CONTROLLER_H_ | 5 #ifndef ASH_DISPLAY_MIRROR_WINDOW_CONTROLLER_H_ |
| 6 #define ASH_DISPLAY_MIRROR_WINDOW_CONTROLLER_H_ | 6 #define ASH_DISPLAY_MIRROR_WINDOW_CONTROLLER_H_ |
| 7 | 7 |
| 8 #include <map> |
| 9 #include <vector> |
| 10 |
| 8 #include "ash/ash_export.h" | 11 #include "ash/ash_export.h" |
| 9 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
| 10 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
| 11 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
| 12 #include "ui/aura/window_tree_host_observer.h" | 15 #include "ui/aura/window_tree_host_observer.h" |
| 13 #include "ui/gfx/geometry/size.h" | 16 #include "ui/gfx/geometry/size.h" |
| 14 #include "ui/gfx/native_widget_types.h" | 17 #include "ui/gfx/native_widget_types.h" |
| 15 | 18 |
| 16 namespace aura { | 19 namespace aura { |
| 17 class Window; | 20 class Window; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 33 // An object that copies the content of the primary root window to a | 36 // An object that copies the content of the primary root window to a |
| 34 // mirror window. This also draws a mouse cursor as the mouse cursor | 37 // mirror window. This also draws a mouse cursor as the mouse cursor |
| 35 // is typically drawn by the window system. | 38 // is typically drawn by the window system. |
| 36 class ASH_EXPORT MirrorWindowController : public aura::WindowTreeHostObserver { | 39 class ASH_EXPORT MirrorWindowController : public aura::WindowTreeHostObserver { |
| 37 public: | 40 public: |
| 38 MirrorWindowController(); | 41 MirrorWindowController(); |
| 39 ~MirrorWindowController() override; | 42 ~MirrorWindowController() override; |
| 40 | 43 |
| 41 // Updates the root window's bounds using |display_info|. | 44 // Updates the root window's bounds using |display_info|. |
| 42 // Creates the new root window if one doesn't exist. | 45 // Creates the new root window if one doesn't exist. |
| 43 void UpdateWindow(const DisplayInfo& display_info); | 46 void UpdateWindow(const std::vector<DisplayInfo>& display_info); |
| 44 | 47 |
| 45 // Same as above, but using existing display info | 48 // Same as above, but using existing display info |
| 46 // for the mirrored display. | 49 // for the mirrored display. |
| 47 void UpdateWindow(); | 50 void UpdateWindow(); |
| 48 | 51 |
| 49 // Close the mirror window. | 52 // Close the mirror window. |
| 50 void Close(); | 53 void Close(); |
| 51 | 54 |
| 52 // aura::WindowTreeHostObserver overrides: | 55 // aura::WindowTreeHostObserver overrides: |
| 53 void OnHostResized(const aura::WindowTreeHost* host) override; | 56 void OnHostResized(const aura::WindowTreeHost* host) override; |
| 54 | 57 |
| 55 // Return the root window used to mirror the content. NULL if the | 58 // Return the root window used to mirror the content. NULL if the |
| 56 // display is not mirrored by the compositor path. | 59 // display is not mirrored by the compositor path. |
| 57 aura::Window* GetWindow(); | 60 aura::Window* GetWindow(); |
| 58 | 61 |
| 59 private: | 62 private: |
| 60 friend class test::MirrorWindowTestApi; | 63 friend class test::MirrorWindowTestApi; |
| 61 | 64 |
| 65 struct MirroringHostInfo { |
| 66 MirroringHostInfo(); |
| 67 ~MirroringHostInfo(); |
| 68 scoped_ptr<AshWindowTreeHost> ash_host; |
| 69 gfx::Size mirror_window_host_size; |
| 70 aura::Window* mirror_window = nullptr; |
| 71 }; |
| 72 |
| 73 void CloseHost(MirroringHostInfo* host_info); |
| 74 |
| 62 // Creates a RootWindowTransformer for current display | 75 // Creates a RootWindowTransformer for current display |
| 63 // configuration. | 76 // configuration. |
| 64 scoped_ptr<RootWindowTransformer> CreateRootWindowTransformer() const; | 77 scoped_ptr<RootWindowTransformer> CreateRootWindowTransformer() const; |
| 65 | 78 |
| 66 scoped_ptr<AshWindowTreeHost> ash_host_; | 79 typedef std::map<int64_t, MirroringHostInfo*> MirroringHostInfoMap; |
| 67 gfx::Size mirror_window_host_size_; | 80 MirroringHostInfoMap mirroring_host_info_map_; |
| 81 |
| 68 scoped_ptr<ui::Reflector> reflector_; | 82 scoped_ptr<ui::Reflector> reflector_; |
| 69 | 83 |
| 70 DISALLOW_COPY_AND_ASSIGN(MirrorWindowController); | 84 DISALLOW_COPY_AND_ASSIGN(MirrorWindowController); |
| 71 }; | 85 }; |
| 72 | 86 |
| 73 } // namespace ash | 87 } // namespace ash |
| 74 | 88 |
| 75 #endif // ASH_DISPLAY_MIRROR_WINDOW_CONTROLLER_H_ | 89 #endif // ASH_DISPLAY_MIRROR_WINDOW_CONTROLLER_H_ |
| OLD | NEW |