| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 COMPONENTS_MUS_WS_DISPLAY_H_ | 5 #ifndef COMPONENTS_MUS_WS_DISPLAY_H_ |
| 6 #define COMPONENTS_MUS_WS_DISPLAY_H_ | 6 #define COMPONENTS_MUS_WS_DISPLAY_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| 11 #include <memory> |
| 11 #include <queue> | 12 #include <queue> |
| 12 | 13 |
| 13 #include "base/macros.h" | 14 #include "base/macros.h" |
| 14 #include "base/memory/scoped_ptr.h" | |
| 15 #include "base/memory/weak_ptr.h" | 15 #include "base/memory/weak_ptr.h" |
| 16 #include "components/mus/common/types.h" | 16 #include "components/mus/common/types.h" |
| 17 #include "components/mus/public/interfaces/window_manager_constants.mojom.h" | 17 #include "components/mus/public/interfaces/window_manager_constants.mojom.h" |
| 18 #include "components/mus/public/interfaces/window_tree_host.mojom.h" | 18 #include "components/mus/public/interfaces/window_tree_host.mojom.h" |
| 19 #include "components/mus/ws/focus_controller_delegate.h" | 19 #include "components/mus/ws/focus_controller_delegate.h" |
| 20 #include "components/mus/ws/focus_controller_observer.h" | 20 #include "components/mus/ws/focus_controller_observer.h" |
| 21 #include "components/mus/ws/platform_display.h" | 21 #include "components/mus/ws/platform_display.h" |
| 22 #include "components/mus/ws/server_window.h" | 22 #include "components/mus/ws/server_window.h" |
| 23 #include "components/mus/ws/server_window_observer.h" | 23 #include "components/mus/ws/server_window_observer.h" |
| 24 #include "components/mus/ws/server_window_tracker.h" | 24 #include "components/mus/ws/server_window_tracker.h" |
| (...skipping 30 matching lines...) Expand all Loading... |
| 55 public FocusControllerDelegate, | 55 public FocusControllerDelegate, |
| 56 public ServerWindowObserver, | 56 public ServerWindowObserver, |
| 57 public UserIdTrackerObserver, | 57 public UserIdTrackerObserver, |
| 58 public WindowManagerFactoryRegistryObserver { | 58 public WindowManagerFactoryRegistryObserver { |
| 59 public: | 59 public: |
| 60 Display(WindowServer* window_server, | 60 Display(WindowServer* window_server, |
| 61 const PlatformDisplayInitParams& platform_display_init_params); | 61 const PlatformDisplayInitParams& platform_display_init_params); |
| 62 ~Display() override; | 62 ~Display() override; |
| 63 | 63 |
| 64 // Initializes state that depends on the existence of a Display. | 64 // Initializes state that depends on the existence of a Display. |
| 65 void Init(scoped_ptr<DisplayBinding> binding); | 65 void Init(std::unique_ptr<DisplayBinding> binding); |
| 66 | 66 |
| 67 uint32_t id() const { return id_; } | 67 uint32_t id() const { return id_; } |
| 68 | 68 |
| 69 DisplayManager* display_manager(); | 69 DisplayManager* display_manager(); |
| 70 const DisplayManager* display_manager() const; | 70 const DisplayManager* display_manager() const; |
| 71 | 71 |
| 72 // Returns a mojom::Display for the specified display. WindowManager specific | 72 // Returns a mojom::Display for the specified display. WindowManager specific |
| 73 // values are not set. In general you should use | 73 // values are not set. In general you should use |
| 74 // WindowManagerState::ToMojomDisplay(). | 74 // WindowManagerState::ToMojomDisplay(). |
| 75 mojom::DisplayPtr ToMojomDisplay() const; | 75 mojom::DisplayPtr ToMojomDisplay() const; |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 void MaybeChangeCursorOnWindowTreeChange(); | 146 void MaybeChangeCursorOnWindowTreeChange(); |
| 147 | 147 |
| 148 // mojom::WindowTreeHost: | 148 // mojom::WindowTreeHost: |
| 149 void SetSize(mojo::SizePtr size) override; | 149 void SetSize(mojo::SizePtr size) override; |
| 150 void SetTitle(const mojo::String& title) override; | 150 void SetTitle(const mojo::String& title) override; |
| 151 | 151 |
| 152 private: | 152 private: |
| 153 friend class test::DisplayTestApi; | 153 friend class test::DisplayTestApi; |
| 154 | 154 |
| 155 using WindowManagerStateMap = | 155 using WindowManagerStateMap = |
| 156 std::map<UserId, scoped_ptr<WindowManagerState>>; | 156 std::map<UserId, std::unique_ptr<WindowManagerState>>; |
| 157 | 157 |
| 158 // Inits the necessary state once the display is ready. | 158 // Inits the necessary state once the display is ready. |
| 159 void InitWindowManagersIfNecessary(); | 159 void InitWindowManagersIfNecessary(); |
| 160 | 160 |
| 161 // Creates the set of WindowManagerStates from the | 161 // Creates the set of WindowManagerStates from the |
| 162 // WindowManagerFactoryRegistry. | 162 // WindowManagerFactoryRegistry. |
| 163 void CreateWindowManagerStatesFromRegistry(); | 163 void CreateWindowManagerStatesFromRegistry(); |
| 164 | 164 |
| 165 void CreateWindowManagerStateFromService( | 165 void CreateWindowManagerStateFromService( |
| 166 WindowManagerFactoryService* service); | 166 WindowManagerFactoryService* service); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 192 // UserIdTrackerObserver: | 192 // UserIdTrackerObserver: |
| 193 void OnActiveUserIdChanged(const UserId& previously_active_id, | 193 void OnActiveUserIdChanged(const UserId& previously_active_id, |
| 194 const UserId& active_id) override; | 194 const UserId& active_id) override; |
| 195 void OnUserIdAdded(const UserId& id) override; | 195 void OnUserIdAdded(const UserId& id) override; |
| 196 void OnUserIdRemoved(const UserId& id) override; | 196 void OnUserIdRemoved(const UserId& id) override; |
| 197 | 197 |
| 198 // WindowManagerFactoryRegistryObserver: | 198 // WindowManagerFactoryRegistryObserver: |
| 199 void OnWindowManagerFactorySet(WindowManagerFactoryService* service) override; | 199 void OnWindowManagerFactorySet(WindowManagerFactoryService* service) override; |
| 200 | 200 |
| 201 const uint32_t id_; | 201 const uint32_t id_; |
| 202 scoped_ptr<DisplayBinding> binding_; | 202 std::unique_ptr<DisplayBinding> binding_; |
| 203 // Set once Init() has been called. | 203 // Set once Init() has been called. |
| 204 bool init_called_ = false; | 204 bool init_called_ = false; |
| 205 WindowServer* const window_server_; | 205 WindowServer* const window_server_; |
| 206 scoped_ptr<ServerWindow> root_; | 206 std::unique_ptr<ServerWindow> root_; |
| 207 scoped_ptr<PlatformDisplay> platform_display_; | 207 std::unique_ptr<PlatformDisplay> platform_display_; |
| 208 scoped_ptr<FocusController> focus_controller_; | 208 std::unique_ptr<FocusController> focus_controller_; |
| 209 | 209 |
| 210 // The last cursor set. Used to track whether we need to change the cursor. | 210 // The last cursor set. Used to track whether we need to change the cursor. |
| 211 int32_t last_cursor_; | 211 int32_t last_cursor_; |
| 212 | 212 |
| 213 ServerWindowTracker activation_parents_; | 213 ServerWindowTracker activation_parents_; |
| 214 | 214 |
| 215 // Set of windows with surfaces that need to be destroyed once the frame | 215 // Set of windows with surfaces that need to be destroyed once the frame |
| 216 // draws. | 216 // draws. |
| 217 std::set<ServerWindow*> windows_needing_frame_destruction_; | 217 std::set<ServerWindow*> windows_needing_frame_destruction_; |
| 218 | 218 |
| 219 WindowManagerStateMap window_manager_state_map_; | 219 WindowManagerStateMap window_manager_state_map_; |
| 220 | 220 |
| 221 cc::SurfaceId top_level_surface_id_; | 221 cc::SurfaceId top_level_surface_id_; |
| 222 | 222 |
| 223 DISALLOW_COPY_AND_ASSIGN(Display); | 223 DISALLOW_COPY_AND_ASSIGN(Display); |
| 224 }; | 224 }; |
| 225 | 225 |
| 226 } // namespace ws | 226 } // namespace ws |
| 227 } // namespace mus | 227 } // namespace mus |
| 228 | 228 |
| 229 #endif // COMPONENTS_MUS_WS_DISPLAY_H_ | 229 #endif // COMPONENTS_MUS_WS_DISPLAY_H_ |
| OLD | NEW |