tablet_mode_observer.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. // Copyright 2017 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 ASH_PUBLIC_CPP_TABLET_MODE_OBSERVER_H_
  5. #define ASH_PUBLIC_CPP_TABLET_MODE_OBSERVER_H_
  6. #include "ash/public/cpp/ash_public_export.h"
  7. namespace ash {
  8. // Used to observe tablet mode changes inside ash. Exported for tests.
  9. class ASH_PUBLIC_EXPORT TabletModeObserver {
  10. public:
  11. // Called when the tablet mode is about to start.
  12. virtual void OnTabletModeStarting() {}
  13. // Called when the tablet mode has started. Windows might still be animating
  14. // though.
  15. virtual void OnTabletModeStarted() {}
  16. // Called when the tablet mode is about to end.
  17. virtual void OnTabletModeEnding() {}
  18. // Called when the tablet mode has ended. Windows may still be animating but
  19. // have been restored.
  20. virtual void OnTabletModeEnded() {}
  21. // Called when tablet mode blocks or unblocks events. This usually matches,
  22. // exiting or entering tablet mode, except when an external mouse is
  23. // connected.
  24. virtual void OnTabletModeEventsBlockingChanged() {}
  25. // Called when the tablet mode controller is destroyed, to help manage issues
  26. // with observers being destroyed after controllers.
  27. virtual void OnTabletControllerDestroyed() {}
  28. // Called when the tablet physical state of the device changes (e.g. due to
  29. // lid angle changes, device attached/detached from base, ... etc.). It's
  30. // called before any notifications of UI changes (such as OnTabletModeStarted,
  31. // OnTabletModeEnded, ... etc.) that are results of this physical state
  32. // change.
  33. virtual void OnTabletPhysicalStateChanged() {}
  34. protected:
  35. virtual ~TabletModeObserver() = default;
  36. };
  37. } // namespace ash
  38. #endif // ASH_PUBLIC_CPP_TABLET_MODE_OBSERVER_H_