surface_observer.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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. #ifndef COMPONENTS_EXO_SURFACE_OBSERVER_H_
  5. #define COMPONENTS_EXO_SURFACE_OBSERVER_H_
  6. #include <cstdint>
  7. namespace exo {
  8. class Surface;
  9. // Observers can listen to various events on the Surfaces.
  10. class SurfaceObserver {
  11. public:
  12. // Called at the top of the surface's destructor, to give observers a
  13. // chance to remove themselves.
  14. virtual void OnSurfaceDestroying(Surface* surface) = 0;
  15. // Called when the occlusion of the aura window corresponding to |surface|
  16. // changes.
  17. virtual void OnWindowOcclusionChanged(Surface* surface) {}
  18. // Called when frame is locked to normal state or unlocked from
  19. // previously locked state.
  20. virtual void OnFrameLockingChanged(Surface* surface, bool lock) {}
  21. // Called on each commit.
  22. virtual void OnCommit(Surface* surface) {}
  23. // Called when the content size changes.
  24. virtual void OnContentSizeChanged(Surface* surface) {}
  25. // Called when desk state of the window changes.
  26. // |state| is the index of the desk which the window moved to,
  27. // or -1 for a window assigned to all desks.
  28. virtual void OnDeskChanged(Surface* surface, int state) {}
  29. // Called when the display of this surface has changed. Only called after
  30. // successfully updating sub-surfaces.
  31. virtual void OnDisplayChanged(Surface* surface,
  32. int64_t old_display,
  33. int64_t new_display) {}
  34. // Starts or ends throttling.
  35. virtual void ThrottleFrameRate(bool on) {}
  36. protected:
  37. virtual ~SurfaceObserver() {}
  38. };
  39. } // namespace exo
  40. #endif // COMPONENTS_EXO_SURFACE_OBSERVER_H_