2014-10-31 11:17:05 -07:00
|
|
|
// Copyright (c) 2014 GitHub, Inc.
|
2014-05-30 10:31:27 +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:46:59 -07:00
|
|
|
#include "shell/browser/ui/tray_icon.h"
|
2014-05-30 10:31:27 +08:00
|
|
|
|
|
|
|
namespace electron {
|
|
|
|
|
2019-08-08 23:43:33 +02:00
|
|
|
TrayIcon::BalloonOptions::BalloonOptions() = default;
|
|
|
|
|
2019-09-16 18:12:00 -04:00
|
|
|
TrayIcon::TrayIcon() = default;
|
2014-05-30 10:31:27 +08:00
|
|
|
|
2019-09-16 18:12:00 -04:00
|
|
|
TrayIcon::~TrayIcon() = default;
|
2014-05-30 10:31:27 +08:00
|
|
|
|
2016-06-21 15:40:30 +09:00
|
|
|
gfx::Rect TrayIcon::GetBounds() {
|
2024-11-26 18:41:46 -06:00
|
|
|
return {};
|
2016-06-21 15:40:30 +09:00
|
|
|
}
|
|
|
|
|
2017-10-05 11:49:26 +09:00
|
|
|
void TrayIcon::NotifyClicked(const gfx::Rect& bounds,
|
|
|
|
const gfx::Point& location,
|
|
|
|
int modifiers) {
|
2025-05-02 07:51:05 -05:00
|
|
|
observers_.Notify(&TrayIconObserver::OnClicked, bounds, location, modifiers);
|
2014-06-02 11:08:29 +08:00
|
|
|
}
|
|
|
|
|
2015-07-27 03:15:51 -07:00
|
|
|
void TrayIcon::NotifyDoubleClicked(const gfx::Rect& bounds, int modifiers) {
|
2025-05-02 07:51:05 -05:00
|
|
|
observers_.Notify(&TrayIconObserver::OnDoubleClicked, bounds, modifiers);
|
2014-09-09 19:45:21 +08:00
|
|
|
}
|
|
|
|
|
2023-09-27 20:21:15 +02:00
|
|
|
void TrayIcon::NotifyMiddleClicked(const gfx::Rect& bounds, int modifiers) {
|
2025-05-02 07:51:05 -05:00
|
|
|
observers_.Notify(&TrayIconObserver::OnMiddleClicked, bounds, modifiers);
|
2023-09-27 20:21:15 +02:00
|
|
|
}
|
|
|
|
|
2014-11-28 19:42:57 +08:00
|
|
|
void TrayIcon::NotifyBalloonShow() {
|
2025-05-02 07:51:05 -05:00
|
|
|
observers_.Notify(&TrayIconObserver::OnBalloonShow);
|
2014-11-28 19:42:57 +08:00
|
|
|
}
|
|
|
|
|
2014-11-28 18:50:31 +08:00
|
|
|
void TrayIcon::NotifyBalloonClicked() {
|
2025-05-02 07:51:05 -05:00
|
|
|
observers_.Notify(&TrayIconObserver::OnBalloonClicked);
|
2014-11-28 18:50:31 +08:00
|
|
|
}
|
|
|
|
|
2014-11-28 19:42:57 +08:00
|
|
|
void TrayIcon::NotifyBalloonClosed() {
|
2025-05-02 07:51:05 -05:00
|
|
|
observers_.Notify(&TrayIconObserver::OnBalloonClosed);
|
2014-11-28 19:42:57 +08:00
|
|
|
}
|
|
|
|
|
2015-07-27 03:15:51 -07:00
|
|
|
void TrayIcon::NotifyRightClicked(const gfx::Rect& bounds, int modifiers) {
|
2025-05-02 07:51:05 -05:00
|
|
|
observers_.Notify(&TrayIconObserver::OnRightClicked, bounds, modifiers);
|
2015-07-15 19:23:12 +08:00
|
|
|
}
|
|
|
|
|
2015-11-10 10:02:50 -06:00
|
|
|
void TrayIcon::NotifyDrop() {
|
2025-05-02 07:51:05 -05:00
|
|
|
observers_.Notify(&TrayIconObserver::OnDrop);
|
2015-11-10 10:02:50 -06:00
|
|
|
}
|
|
|
|
|
2015-10-18 00:32:13 -05:00
|
|
|
void TrayIcon::NotifyDropFiles(const std::vector<std::string>& files) {
|
2025-05-02 07:51:05 -05:00
|
|
|
observers_.Notify(&TrayIconObserver::OnDropFiles, files);
|
2015-07-19 12:12:28 +08:00
|
|
|
}
|
|
|
|
|
2016-07-14 18:21:39 +01:00
|
|
|
void TrayIcon::NotifyDropText(const std::string& text) {
|
2025-05-02 07:51:05 -05:00
|
|
|
observers_.Notify(&TrayIconObserver::OnDropText, text);
|
2016-07-14 18:21:39 +01:00
|
|
|
}
|
|
|
|
|
2020-01-17 16:28:34 +00:00
|
|
|
void TrayIcon::NotifyMouseUp(const gfx::Point& location, int modifiers) {
|
2025-05-02 07:51:05 -05:00
|
|
|
observers_.Notify(&TrayIconObserver::OnMouseUp, location, modifiers);
|
2020-01-17 16:28:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void TrayIcon::NotifyMouseDown(const gfx::Point& location, int modifiers) {
|
2025-05-02 07:51:05 -05:00
|
|
|
observers_.Notify(&TrayIconObserver::OnMouseDown, location, modifiers);
|
2020-01-17 16:28:34 +00:00
|
|
|
}
|
|
|
|
|
2017-06-28 12:09:12 -07:00
|
|
|
void TrayIcon::NotifyMouseEntered(const gfx::Point& location, int modifiers) {
|
2025-05-02 07:51:05 -05:00
|
|
|
observers_.Notify(&TrayIconObserver::OnMouseEntered, location, modifiers);
|
2017-06-14 18:00:29 -04:00
|
|
|
}
|
|
|
|
|
2017-06-28 12:09:12 -07:00
|
|
|
void TrayIcon::NotifyMouseExited(const gfx::Point& location, int modifiers) {
|
2025-05-02 07:51:05 -05:00
|
|
|
observers_.Notify(&TrayIconObserver::OnMouseExited, location, modifiers);
|
2017-06-14 18:00:29 -04:00
|
|
|
}
|
|
|
|
|
2017-08-26 14:04:58 -04:00
|
|
|
void TrayIcon::NotifyMouseMoved(const gfx::Point& location, int modifiers) {
|
2025-05-02 07:51:05 -05:00
|
|
|
observers_.Notify(&TrayIconObserver::OnMouseMoved, location, modifiers);
|
2017-08-26 14:04:58 -04:00
|
|
|
}
|
|
|
|
|
2015-11-05 18:45:43 -06:00
|
|
|
void TrayIcon::NotifyDragEntered() {
|
2025-05-02 07:51:05 -05:00
|
|
|
observers_.Notify(&TrayIconObserver::OnDragEntered);
|
2015-11-05 18:45:43 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
void TrayIcon::NotifyDragExited() {
|
2025-05-02 07:51:05 -05:00
|
|
|
observers_.Notify(&TrayIconObserver::OnDragExited);
|
2015-11-05 18:45:43 -06:00
|
|
|
}
|
|
|
|
|
2015-11-10 10:02:50 -06:00
|
|
|
void TrayIcon::NotifyDragEnded() {
|
2025-05-02 07:51:05 -05:00
|
|
|
observers_.Notify(&TrayIconObserver::OnDragEnded);
|
2015-11-10 10:02:50 -06:00
|
|
|
}
|
|
|
|
|
2014-05-30 10:31:27 +08:00
|
|
|
} // namespace electron
|