electron/shell/browser/ui/tray_icon.cc
Shelley Vohr 1f19a74417
fix: potential crash calling tray.popUpContextMenu() (#39231)
fix: potential crash calling tray.popUpContextMenu
2023-08-01 15:07:30 +09:00

119 lines
3.3 KiB
C++

// Copyright (c) 2014 GitHub, Inc.
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
#include "shell/browser/ui/tray_icon.h"
namespace electron {
TrayIcon::BalloonOptions::BalloonOptions() = default;
TrayIcon::TrayIcon() = default;
TrayIcon::~TrayIcon() = default;
void TrayIcon::SetPressedImage(ImageType image) {}
void TrayIcon::DisplayBalloon(const BalloonOptions& options) {}
void TrayIcon::RemoveBalloon() {}
void TrayIcon::Focus() {}
void TrayIcon::PopUpContextMenu(const gfx::Point& pos,
base::WeakPtr<ElectronMenuModel> menu_model) {}
void TrayIcon::CloseContextMenu() {}
gfx::Rect TrayIcon::GetBounds() {
return gfx::Rect();
}
void TrayIcon::NotifyClicked(const gfx::Rect& bounds,
const gfx::Point& location,
int modifiers) {
for (TrayIconObserver& observer : observers_)
observer.OnClicked(bounds, location, modifiers);
}
void TrayIcon::NotifyDoubleClicked(const gfx::Rect& bounds, int modifiers) {
for (TrayIconObserver& observer : observers_)
observer.OnDoubleClicked(bounds, modifiers);
}
void TrayIcon::NotifyBalloonShow() {
for (TrayIconObserver& observer : observers_)
observer.OnBalloonShow();
}
void TrayIcon::NotifyBalloonClicked() {
for (TrayIconObserver& observer : observers_)
observer.OnBalloonClicked();
}
void TrayIcon::NotifyBalloonClosed() {
for (TrayIconObserver& observer : observers_)
observer.OnBalloonClosed();
}
void TrayIcon::NotifyRightClicked(const gfx::Rect& bounds, int modifiers) {
for (TrayIconObserver& observer : observers_)
observer.OnRightClicked(bounds, modifiers);
}
void TrayIcon::NotifyDrop() {
for (TrayIconObserver& observer : observers_)
observer.OnDrop();
}
void TrayIcon::NotifyDropFiles(const std::vector<std::string>& files) {
for (TrayIconObserver& observer : observers_)
observer.OnDropFiles(files);
}
void TrayIcon::NotifyDropText(const std::string& text) {
for (TrayIconObserver& observer : observers_)
observer.OnDropText(text);
}
void TrayIcon::NotifyMouseUp(const gfx::Point& location, int modifiers) {
for (TrayIconObserver& observer : observers_)
observer.OnMouseUp(location, modifiers);
}
void TrayIcon::NotifyMouseDown(const gfx::Point& location, int modifiers) {
for (TrayIconObserver& observer : observers_)
observer.OnMouseDown(location, modifiers);
}
void TrayIcon::NotifyMouseEntered(const gfx::Point& location, int modifiers) {
for (TrayIconObserver& observer : observers_)
observer.OnMouseEntered(location, modifiers);
}
void TrayIcon::NotifyMouseExited(const gfx::Point& location, int modifiers) {
for (TrayIconObserver& observer : observers_)
observer.OnMouseExited(location, modifiers);
}
void TrayIcon::NotifyMouseMoved(const gfx::Point& location, int modifiers) {
for (TrayIconObserver& observer : observers_)
observer.OnMouseMoved(location, modifiers);
}
void TrayIcon::NotifyDragEntered() {
for (TrayIconObserver& observer : observers_)
observer.OnDragEntered();
}
void TrayIcon::NotifyDragExited() {
for (TrayIconObserver& observer : observers_)
observer.OnDragExited();
}
void TrayIcon::NotifyDragEnded() {
for (TrayIconObserver& observer : observers_)
observer.OnDragEnded();
}
} // namespace electron