2014-10-31 11:17:05 -07:00
|
|
|
// Copyright (c) 2014 GitHub, Inc.
|
2014-07-10 13:06:41 +08:00
|
|
|
// Use of this source code is governed by the MIT license that can be
|
|
|
|
// found in the LICENSE file.
|
|
|
|
|
2019-06-19 13:56:58 -07:00
|
|
|
#ifndef SHELL_BROWSER_UI_TRAY_ICON_GTK_H_
|
|
|
|
#define SHELL_BROWSER_UI_TRAY_ICON_GTK_H_
|
2014-07-10 13:06:41 +08:00
|
|
|
|
2018-09-12 19:25:56 -05:00
|
|
|
#include <memory>
|
2014-07-10 13:06:41 +08:00
|
|
|
#include <string>
|
|
|
|
|
2019-06-19 13:46:59 -07:00
|
|
|
#include "shell/browser/ui/tray_icon.h"
|
2014-07-10 13:06:41 +08:00
|
|
|
#include "ui/views/linux_ui/status_icon_linux.h"
|
|
|
|
|
|
|
|
namespace views {
|
|
|
|
class StatusIconLinux;
|
|
|
|
}
|
|
|
|
|
2019-06-19 14:23:04 -07:00
|
|
|
namespace electron {
|
2014-07-10 13:06:41 +08:00
|
|
|
|
2018-04-17 21:44:10 -04:00
|
|
|
class TrayIconGtk : public TrayIcon, public views::StatusIconLinux::Delegate {
|
2014-07-10 13:06:41 +08:00
|
|
|
public:
|
|
|
|
TrayIconGtk();
|
2018-05-16 12:12:45 -07:00
|
|
|
~TrayIconGtk() override;
|
2014-07-10 13:06:41 +08:00
|
|
|
|
|
|
|
// TrayIcon:
|
2015-01-09 17:24:36 -08:00
|
|
|
void SetImage(const gfx::Image& image) override;
|
|
|
|
void SetToolTip(const std::string& tool_tip) override;
|
2020-02-04 12:19:40 -08:00
|
|
|
void SetContextMenu(ElectronMenuModel* menu_model) override;
|
2014-07-10 13:06:41 +08:00
|
|
|
|
2019-07-02 18:22:09 -07:00
|
|
|
// views::StatusIconLinux::Delegate
|
2015-01-09 17:24:36 -08:00
|
|
|
void OnClick() override;
|
|
|
|
bool HasClickAction() override;
|
2019-07-02 18:22:09 -07:00
|
|
|
// The following four methods are only used by StatusIconLinuxDbus, which we
|
|
|
|
// aren't yet using, so they are given stub implementations.
|
|
|
|
const gfx::ImageSkia& GetImage() const override;
|
2021-03-16 12:18:45 -04:00
|
|
|
const std::u16string& GetToolTip() const override;
|
2019-07-02 18:22:09 -07:00
|
|
|
ui::MenuModel* GetMenuModel() const override;
|
|
|
|
void OnImplInitializationFailed() override;
|
2014-07-10 13:06:41 +08:00
|
|
|
|
2019-07-02 18:22:09 -07:00
|
|
|
private:
|
2020-06-02 17:00:20 -07:00
|
|
|
std::unique_ptr<views::StatusIconLinux> icon_;
|
2019-10-18 15:57:34 -04:00
|
|
|
gfx::ImageSkia image_;
|
2021-03-16 12:18:45 -04:00
|
|
|
std::u16string tool_tip_;
|
2019-10-18 15:57:34 -04:00
|
|
|
ui::MenuModel* menu_model_;
|
2019-07-02 18:22:09 -07:00
|
|
|
|
2014-07-10 13:06:41 +08:00
|
|
|
DISALLOW_COPY_AND_ASSIGN(TrayIconGtk);
|
|
|
|
};
|
|
|
|
|
2019-06-19 14:23:04 -07:00
|
|
|
} // namespace electron
|
2014-07-10 13:06:41 +08:00
|
|
|
|
2019-06-19 13:56:58 -07:00
|
|
|
#endif // SHELL_BROWSER_UI_TRAY_ICON_GTK_H_
|