workspace_extension.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. // Copyright 2019 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_WORKSPACE_EXTENSION_H_
  5. #define UI_PLATFORM_WINDOW_EXTENSIONS_WORKSPACE_EXTENSION_H_
  6. #include <string>
  7. #include "base/component_export.h"
  8. namespace ui {
  9. class PlatformWindow;
  10. class WorkspaceExtensionDelegate;
  11. // A workspace extension that platforms can use to add support for workspaces.
  12. // This is intended to be used only in conjunction with a PlatformWindow and
  13. // owned by a PlatformWindow owner. To avoid casts from the PlatformWindow to
  14. // the WorkspaceExtension, a pointer to this interface must be set through
  15. // "SetWorkspaceExtension".
  16. class COMPONENT_EXPORT(PLATFORM_WINDOW) WorkspaceExtension {
  17. public:
  18. // Returns the workspace the PlatformWindow is located in.
  19. virtual std::string GetWorkspace() const = 0;
  20. // Sets the PlatformWindow to be visible on all workspaces.
  21. virtual void SetVisibleOnAllWorkspaces(bool always_visible) = 0;
  22. // Returns true if the PlatformWindow is visible on all
  23. // workspaces.
  24. virtual bool IsVisibleOnAllWorkspaces() const = 0;
  25. // Sets the delegate that is notified if the window has changed the workspace
  26. // it's located in.
  27. virtual void SetWorkspaceExtensionDelegate(
  28. WorkspaceExtensionDelegate* delegate) = 0;
  29. protected:
  30. virtual ~WorkspaceExtension();
  31. // Sets the pointer to the extension as a property of the PlatformWindow.
  32. void SetWorkspaceExtension(PlatformWindow* platform_window,
  33. WorkspaceExtension* workspace_extension);
  34. };
  35. COMPONENT_EXPORT(PLATFORM_WINDOW)
  36. WorkspaceExtension* GetWorkspaceExtension(
  37. const PlatformWindow& platform_window);
  38. } // namespace ui
  39. #endif // UI_PLATFORM_WINDOW_EXTENSIONS_WORKSPACE_EXTENSION_H_