tray_icon_gtk.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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 views {
  11. class StatusIconLinux;
  12. }
  13. namespace electron {
  14. class TrayIconGtk : public TrayIcon, public views::StatusIconLinux::Delegate {
  15. public:
  16. TrayIconGtk();
  17. ~TrayIconGtk() override;
  18. // TrayIcon:
  19. void SetImage(const gfx::Image& image) override;
  20. void SetToolTip(const std::string& tool_tip) override;
  21. void SetContextMenu(AtomMenuModel* menu_model) override;
  22. // views::StatusIconLinux::Delegate
  23. void OnClick() override;
  24. bool HasClickAction() override;
  25. // The following four methods are only used by StatusIconLinuxDbus, which we
  26. // aren't yet using, so they are given stub implementations.
  27. const gfx::ImageSkia& GetImage() const override;
  28. const base::string16& GetToolTip() const override;
  29. ui::MenuModel* GetMenuModel() const override;
  30. void OnImplInitializationFailed() override;
  31. private:
  32. std::unique_ptr<views::StatusIconLinux> icon_;
  33. gfx::ImageSkia dummy_image_;
  34. base::string16 dummy_string_;
  35. DISALLOW_COPY_AND_ASSIGN(TrayIconGtk);
  36. };
  37. } // namespace electron
  38. #endif // SHELL_BROWSER_UI_TRAY_ICON_GTK_H_