| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 SERVICES_UI_PUBLIC_CPP_SURFACE_ID_HANDLER_H_ | 5 #ifndef SERVICES_UI_PUBLIC_CPP_SURFACE_ID_HANDLER_H_ |
| 6 #define SERVICES_UI_PUBLIC_CPP_SURFACE_ID_HANDLER_H_ | 6 #define SERVICES_UI_PUBLIC_CPP_SURFACE_ID_HANDLER_H_ |
| 7 | 7 |
| 8 #include "cc/surfaces/surface_id.h" | 8 #include "cc/surfaces/surface_id.h" |
| 9 #include "ui/gfx/geometry/size.h" | 9 #include "ui/gfx/geometry/size.h" |
| 10 | 10 |
| 11 namespace cc { |
| 12 class SurfaceInfo; |
| 13 } |
| 14 |
| 11 namespace ui { | 15 namespace ui { |
| 12 | 16 |
| 13 class Window; | 17 class Window; |
| 14 | 18 |
| 15 // Holds information about the current surface held by a Window. | |
| 16 // |surface_id| uniquely identifies the surface in the display | |
| 17 // compositor. | |
| 18 // |frame_size| is the size of the frame held by the surface. | |
| 19 // |device_scale_factor| is the scale factor that the frame was | |
| 20 // renderered for. | |
| 21 struct SurfaceInfo { | |
| 22 cc::SurfaceId surface_id; | |
| 23 gfx::Size frame_size; | |
| 24 float device_scale_factor; | |
| 25 }; | |
| 26 | |
| 27 class SurfaceIdHandler { | 19 class SurfaceIdHandler { |
| 28 public: | 20 public: |
| 29 // Called when a child window allocates a new surface ID. | 21 // Called when a child window allocates a new surface ID. |
| 30 // If the handler wishes to retain ownership of the |surface_info|, | 22 // If the handler wishes to retain ownership of the |surface_info|, |
| 31 // it can move it. If a child's surface has been cleared then | 23 // it can move it. If a child's surface has been cleared then |
| 32 // |surface_info| will refer to a null pointer. | 24 // |surface_info| will refer to a null pointer. |
| 33 virtual void OnChildWindowSurfaceChanged( | 25 virtual void OnChildWindowSurfaceChanged( |
| 34 Window* window, | 26 Window* window, |
| 35 std::unique_ptr<SurfaceInfo>* surface_info) = 0; | 27 const cc::SurfaceInfo& surface_info) = 0; |
| 36 }; | 28 }; |
| 37 | 29 |
| 38 } // namespace ui | 30 } // namespace ui |
| 39 | 31 |
| 40 #endif // SERVICES_UI_PUBLIC_CPP_SURFACE_ID_HANDLER_H_ | 32 #endif // SERVICES_UI_PUBLIC_CPP_SURFACE_ID_HANDLER_H_ |
| OLD | NEW |