tooltip_manager_mac.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  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 UI_VIEWS_COCOA_TOOLTIP_MANAGER_MAC_H_
  5. #define UI_VIEWS_COCOA_TOOLTIP_MANAGER_MAC_H_
  6. #include "base/memory/raw_ptr.h"
  7. #include "ui/views/widget/tooltip_manager.h"
  8. namespace remote_cocoa {
  9. namespace mojom {
  10. class NativeWidgetNSWindow;
  11. } // namespace mojom
  12. } // namespace remote_cocoa
  13. namespace views {
  14. // Manages native Cocoa tooltips for the given NativeWidgetNSWindowHostImpl.
  15. class TooltipManagerMac : public TooltipManager {
  16. public:
  17. explicit TooltipManagerMac(remote_cocoa::mojom::NativeWidgetNSWindow* bridge);
  18. TooltipManagerMac(const TooltipManagerMac&) = delete;
  19. TooltipManagerMac& operator=(const TooltipManagerMac&) = delete;
  20. ~TooltipManagerMac() override;
  21. // TooltipManager:
  22. int GetMaxWidth(const gfx::Point& location) const override;
  23. const gfx::FontList& GetFontList() const override;
  24. void UpdateTooltip() override;
  25. void TooltipTextChanged(View* view) override;
  26. private:
  27. raw_ptr<remote_cocoa::mojom::NativeWidgetNSWindow>
  28. bridge_; // Weak. Owned by the owner of this.
  29. };
  30. } // namespace views
  31. #endif // UI_VIEWS_COCOA_TOOLTIP_MANAGER_MAC_H_