| 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> | 8 #include <map> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "ash/ash_export.h" | 11 #include "ash/ash_export.h" |
| 12 #include "ash/display/display_manager.h" |
| 12 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
| 13 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
| 14 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
| 15 #include "ui/aura/window.h" | 16 #include "ui/aura/window.h" |
| 16 #include "ui/aura/window_tree_host_observer.h" | 17 #include "ui/aura/window_tree_host_observer.h" |
| 17 #include "ui/gfx/geometry/size.h" | 18 #include "ui/gfx/geometry/size.h" |
| 18 #include "ui/gfx/native_widget_types.h" | 19 #include "ui/gfx/native_widget_types.h" |
| 19 | 20 |
| 20 namespace aura { | 21 namespace aura { |
| 21 class Window; | 22 class Window; |
| (...skipping 28 matching lines...) Expand all Loading... |
| 50 ~MirrorWindowController() override; | 51 ~MirrorWindowController() override; |
| 51 | 52 |
| 52 // Updates the root window's bounds using |display_info|. | 53 // Updates the root window's bounds using |display_info|. |
| 53 // Creates the new root window if one doesn't exist. | 54 // Creates the new root window if one doesn't exist. |
| 54 void UpdateWindow(const std::vector<DisplayInfo>& display_info); | 55 void UpdateWindow(const std::vector<DisplayInfo>& display_info); |
| 55 | 56 |
| 56 // Same as above, but using existing display info | 57 // Same as above, but using existing display info |
| 57 // for the mirrored display. | 58 // for the mirrored display. |
| 58 void UpdateWindow(); | 59 void UpdateWindow(); |
| 59 | 60 |
| 60 // Close the mirror window. | 61 // Close the mirror window if they're not necessary any longer. |
| 61 void Close(); | 62 void CloseIfNotNecessary(); |
| 62 | 63 |
| 63 // aura::WindowTreeHostObserver overrides: | 64 // aura::WindowTreeHostObserver overrides: |
| 64 void OnHostResized(const aura::WindowTreeHost* host) override; | 65 void OnHostResized(const aura::WindowTreeHost* host) override; |
| 65 | 66 |
| 66 // Return the root window used to mirror the content. NULL if the | 67 // Return the root window used to mirror the content. NULL if the |
| 67 // display is not mirrored by the compositor path. | 68 // display is not mirrored by the compositor path. |
| 68 aura::Window* GetWindow(); | 69 aura::Window* GetWindow(); |
| 69 | 70 |
| 70 // Returns the gfx::Display for the mirroring root window. | 71 // Returns the gfx::Display for the mirroring root window. |
| 71 gfx::Display GetDisplayForRootWindow(const aura::Window* root) const; | 72 gfx::Display GetDisplayForRootWindow(const aura::Window* root) const; |
| 72 | 73 |
| 73 // Returns the AshWindwoTreeHost created for |display_id|. | 74 // Returns the AshWindwoTreeHost created for |display_id|. |
| 74 AshWindowTreeHost* GetAshWindowTreeHostForDisplayId(int64 display_id); | 75 AshWindowTreeHost* GetAshWindowTreeHostForDisplayId(int64 display_id); |
| 75 | 76 |
| 76 // Returns all root windows hosting mirroring displays. | 77 // Returns all root windows hosting mirroring displays. |
| 77 aura::Window::Windows GetAllRootWindows() const; | 78 aura::Window::Windows GetAllRootWindows() const; |
| 78 | 79 |
| 79 private: | 80 private: |
| 80 friend class test::MirrorWindowTestApi; | 81 friend class test::MirrorWindowTestApi; |
| 81 | 82 |
| 82 struct MirroringHostInfo; | 83 struct MirroringHostInfo; |
| 83 | 84 |
| 84 void CloseAndDeleteHost(MirroringHostInfo* host_info); | 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); |
| 89 |
| 90 void CloseAndDeleteHost(MirroringHostInfo* host_info, |
| 91 bool delay_host_deletion); |
| 85 | 92 |
| 86 // Creates a RootWindowTransformer for current display | 93 // Creates a RootWindowTransformer for current display |
| 87 // configuration. | 94 // configuration. |
| 88 scoped_ptr<RootWindowTransformer> CreateRootWindowTransformer() const; | 95 scoped_ptr<RootWindowTransformer> CreateRootWindowTransformer() const; |
| 89 | 96 |
| 90 typedef std::map<int64_t, MirroringHostInfo*> MirroringHostInfoMap; | 97 typedef std::map<int64_t, MirroringHostInfo*> MirroringHostInfoMap; |
| 91 MirroringHostInfoMap mirroring_host_info_map_; | 98 MirroringHostInfoMap mirroring_host_info_map_; |
| 92 | 99 |
| 100 DisplayManager::MultiDisplayMode multi_display_mode_; |
| 101 |
| 93 scoped_ptr<aura::client::ScreenPositionClient> screen_position_client_; | 102 scoped_ptr<aura::client::ScreenPositionClient> screen_position_client_; |
| 94 | 103 |
| 95 scoped_ptr<ui::Reflector> reflector_; | 104 scoped_ptr<ui::Reflector> reflector_; |
| 96 | 105 |
| 97 DISALLOW_COPY_AND_ASSIGN(MirrorWindowController); | 106 DISALLOW_COPY_AND_ASSIGN(MirrorWindowController); |
| 98 }; | 107 }; |
| 99 | 108 |
| 100 } // namespace ash | 109 } // namespace ash |
| 101 | 110 |
| 102 #endif // ASH_DISPLAY_MIRROR_WINDOW_CONTROLLER_H_ | 111 #endif // ASH_DISPLAY_MIRROR_WINDOW_CONTROLLER_H_ |
| OLD | NEW |