| 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_SERVER_WINDOW_SURFACE_MANAGER_H_ | 5 #ifndef COMPONENTS_MUS_WS_SERVER_WINDOW_SURFACE_MANAGER_H_ |
| 6 #define COMPONENTS_MUS_WS_SERVER_WINDOW_SURFACE_MANAGER_H_ | 6 #define COMPONENTS_MUS_WS_SERVER_WINDOW_SURFACE_MANAGER_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "cc/surfaces/surface_factory.h" | 11 #include "cc/surfaces/surface_factory.h" |
| 12 #include "cc/surfaces/surface_id.h" | 12 #include "cc/surfaces/surface_id.h" |
| 13 #include "cc/surfaces/surface_id_allocator.h" | 13 #include "cc/surfaces/surface_id_allocator.h" |
| 14 #include "components/mus/public/interfaces/compositor_frame.mojom.h" | 14 #include "components/mus/public/interfaces/compositor_frame.mojom.h" |
| 15 #include "components/mus/public/interfaces/window_tree.mojom.h" | 15 #include "components/mus/public/interfaces/window_tree.mojom.h" |
| 16 #include "mojo/public/cpp/bindings/binding.h" | 16 #include "mojo/public/cpp/bindings/binding.h" |
| 17 | 17 |
| 18 namespace mus { | 18 namespace mus { |
| 19 namespace ws { | 19 namespace ws { |
| 20 | 20 |
| 21 class ServerWindow; | 21 class ServerWindow; |
| 22 class ServerWindowSurface; | 22 class ServerWindowSurface; |
| 23 class ServerWindowSurfaceManagerTestApi; |
| 23 | 24 |
| 24 // ServerWindowSurfaceManager tracks the surfaces associated with a | 25 // ServerWindowSurfaceManager tracks the surfaces associated with a |
| 25 // ServerWindow. | 26 // ServerWindow. |
| 26 class ServerWindowSurfaceManager { | 27 class ServerWindowSurfaceManager { |
| 27 public: | 28 public: |
| 28 explicit ServerWindowSurfaceManager(ServerWindow* window); | 29 explicit ServerWindowSurfaceManager(ServerWindow* window); |
| 29 ~ServerWindowSurfaceManager(); | 30 ~ServerWindowSurfaceManager(); |
| 30 | 31 |
| 31 // Creates a new surface of the specified type, replacing the existing one of | 32 // Creates a new surface of the specified type, replacing the existing one of |
| 32 // the specified type. | 33 // the specified type. |
| 33 void CreateSurface(mojom::SurfaceType surface_type, | 34 void CreateSurface(mojom::SurfaceType surface_type, |
| 34 mojo::InterfaceRequest<mojom::Surface> request, | 35 mojo::InterfaceRequest<mojom::Surface> request, |
| 35 mojom::SurfaceClientPtr client); | 36 mojom::SurfaceClientPtr client); |
| 36 | 37 |
| 37 ServerWindow* window() { return window_; } | 38 ServerWindow* window() { return window_; } |
| 38 | 39 |
| 39 ServerWindowSurface* GetDefaultSurface(); | 40 ServerWindowSurface* GetDefaultSurface(); |
| 40 ServerWindowSurface* GetUnderlaySurface(); | 41 ServerWindowSurface* GetUnderlaySurface(); |
| 41 ServerWindowSurface* GetSurfaceByType(mojom::SurfaceType type); | 42 ServerWindowSurface* GetSurfaceByType(mojom::SurfaceType type); |
| 43 bool HasSurfaceOfType(mojom::SurfaceType type); |
| 42 | 44 |
| 43 private: | 45 private: |
| 46 friend class ServerWindowSurfaceManagerTestApi; |
| 44 friend class ServerWindowSurface; | 47 friend class ServerWindowSurface; |
| 45 | 48 |
| 46 cc::SurfaceId GenerateId(); | 49 cc::SurfaceId GenerateId(); |
| 47 | 50 |
| 48 ServerWindow* window_; | 51 ServerWindow* window_; |
| 49 | 52 |
| 50 cc::SurfaceIdAllocator surface_id_allocator_; | 53 cc::SurfaceIdAllocator surface_id_allocator_; |
| 51 | 54 |
| 52 using TypeToSurfaceMap = | 55 using TypeToSurfaceMap = |
| 53 std::map<mojom::SurfaceType, scoped_ptr<ServerWindowSurface>>; | 56 std::map<mojom::SurfaceType, scoped_ptr<ServerWindowSurface>>; |
| 54 | 57 |
| 55 TypeToSurfaceMap type_to_surface_map_; | 58 TypeToSurfaceMap type_to_surface_map_; |
| 56 | 59 |
| 57 DISALLOW_COPY_AND_ASSIGN(ServerWindowSurfaceManager); | 60 DISALLOW_COPY_AND_ASSIGN(ServerWindowSurfaceManager); |
| 58 }; | 61 }; |
| 59 | 62 |
| 60 } // namespace ws | 63 } // namespace ws |
| 61 } // namespace mus | 64 } // namespace mus |
| 62 | 65 |
| 63 #endif // COMPONENTS_MUS_WS_SERVER_WINDOW_SURFACE_MANAGER_H_ | 66 #endif // COMPONENTS_MUS_WS_SERVER_WINDOW_SURFACE_MANAGER_H_ |
| OLD | NEW |