pinned_mode_extension.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. // Copyright 2021 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 UI_PLATFORM_WINDOW_EXTENSIONS_PINNED_MODE_EXTENSION_H_
  5. #define UI_PLATFORM_WINDOW_EXTENSIONS_PINNED_MODE_EXTENSION_H_
  6. #include "base/component_export.h"
  7. namespace ui {
  8. class PlatformWindow;
  9. // A pinned mode extension that platforms can use to add support for pinned
  10. // mode operations which are used e.g. in EDU tests / quizzes.
  11. class COMPONENT_EXPORT(PLATFORM_WINDOW) PinnedModeExtension {
  12. public:
  13. // Pins/locks a window to the screen so that the user cannot do anything
  14. // else before the mode is released. If trusted is set, it is an invocation
  15. // from a trusted app like a school test mode app.
  16. virtual void Pin(bool trusted) const = 0;
  17. // Releases the pinned mode and allows the user to do other things again.
  18. virtual void Unpin() const = 0;
  19. protected:
  20. virtual ~PinnedModeExtension();
  21. // Sets the pointer to the extension as a property of the PlatformWindow.
  22. static void SetPinnedModeExtension(PlatformWindow* window,
  23. PinnedModeExtension* extension);
  24. };
  25. COMPONENT_EXPORT(PLATFORM_WINDOW)
  26. PinnedModeExtension* GetPinnedModeExtension(const PlatformWindow& window);
  27. } // namespace ui
  28. #endif // UI_PLATFORM_WINDOW_EXTENSIONS_PINNED_MODE_EXTENSION_H_