tray_icon_gtk.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. // Copyright (c) 2014 GitHub, Inc.
  2. // Use of this source code is governed by the MIT license that can be
  3. // found in the LICENSE file.
  4. #ifndef SHELL_BROWSER_UI_TRAY_ICON_GTK_H_
  5. #define SHELL_BROWSER_UI_TRAY_ICON_GTK_H_
  6. #include <memory>
  7. #include <string>
  8. #include "shell/browser/ui/tray_icon.h"
  9. #include "ui/views/linux_ui/status_icon_linux.h"
  10. namespace electron {
  11. class TrayIconGtk : public TrayIcon, public views::StatusIconLinux::Delegate {
  12. public:
  13. TrayIconGtk();
  14. ~TrayIconGtk() override;
  15. // TrayIcon:
  16. void SetImage(const gfx::Image& image) override;
  17. void SetToolTip(const std::string& tool_tip) override;
  18. void SetContextMenu(ElectronMenuModel* menu_model) override;
  19. // views::StatusIconLinux::Delegate
  20. void OnClick() override;
  21. bool HasClickAction() override;
  22. // The following four methods are only used by StatusIconLinuxDbus, which we
  23. // aren't yet using, so they are given stub implementations.
  24. const gfx::ImageSkia& GetImage() const override;
  25. const std::u16string& GetToolTip() const override;
  26. ui::MenuModel* GetMenuModel() const override;
  27. void OnImplInitializationFailed() override;
  28. private:
  29. std::unique_ptr<views::StatusIconLinux> icon_;
  30. gfx::ImageSkia image_;
  31. std::u16string tool_tip_;
  32. ui::MenuModel* menu_model_;
  33. DISALLOW_COPY_AND_ASSIGN(TrayIconGtk);
  34. };
  35. } // namespace electron
  36. #endif // SHELL_BROWSER_UI_TRAY_ICON_GTK_H_