OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef COMPONENTS_EXO_SUB_SURFACE_H_ |
| 6 #define COMPONENTS_EXO_SUB_SURFACE_H_ |
| 7 |
| 8 #include "base/macros.h" |
| 9 #include "base/memory/ref_counted.h" |
| 10 #include "components/exo/surface_delegate.h" |
| 11 #include "components/exo/surface_observer.h" |
| 12 #include "ui/gfx/geometry/point.h" |
| 13 |
| 14 namespace base { |
| 15 namespace trace_event { |
| 16 class TracedValue; |
| 17 } |
| 18 } |
| 19 |
| 20 namespace exo { |
| 21 class Surface; |
| 22 |
| 23 // This class provides functions for treating a surface as a sub-surface. A |
| 24 // sub-surface has one parent surface. |
| 25 class SubSurface : public SurfaceDelegate, public SurfaceObserver { |
| 26 public: |
| 27 SubSurface(Surface* surface, Surface* parent); |
| 28 ~SubSurface() override; |
| 29 |
| 30 // This schedules a sub-surface position change. The sub-surface will be |
| 31 // moved so, that its origin (top-left corner pixel) will be at the |position| |
| 32 // of the parent surface coordinate system. |
| 33 void SetPosition(const gfx::Point& position); |
| 34 |
| 35 // This removes sub-surface from the stack, and puts it back just above the |
| 36 // reference surface, changing the z-order of the sub-surfaces. The reference |
| 37 // surface must be one of the sibling surfaces, or the parent surface. |
| 38 void PlaceAbove(Surface* reference); |
| 39 |
| 40 // This removes sub-surface from the stack, and puts it back just below the |
| 41 // sibling surface. |
| 42 void PlaceBelow(Surface* sibiling); |
| 43 |
| 44 // Change the commit behaviour of the sub-surface. |
| 45 void SetCommitBehavior(bool synchronized); |
| 46 |
| 47 // Returns a trace value representing the state of the surface. |
| 48 scoped_refptr<base::trace_event::TracedValue> AsTracedValue() const; |
| 49 |
| 50 // Overridden from SurfaceDelegate: |
| 51 void OnSurfaceCommit() override; |
| 52 bool IsSurfaceSynchronized() const override; |
| 53 |
| 54 // Overridden from SurfaceObserver: |
| 55 void OnSurfaceDestroying(Surface* surface) override; |
| 56 |
| 57 private: |
| 58 Surface* surface_; |
| 59 Surface* parent_; |
| 60 bool is_synchronized_; |
| 61 |
| 62 DISALLOW_COPY_AND_ASSIGN(SubSurface); |
| 63 }; |
| 64 |
| 65 } // namespace exo |
| 66 |
| 67 #endif // COMPONENTS_EXO_SUB_SURFACE_H_ |
OLD | NEW |