diff --git a/atom/browser/api/atom_api_tray.cc b/atom/browser/api/atom_api_tray.cc index 86e6cb29953..19ac64d6183 100644 --- a/atom/browser/api/atom_api_tray.cc +++ b/atom/browser/api/atom_api_tray.cc @@ -48,6 +48,10 @@ void Tray::SetToolTip(const std::string& tool_tip) { tray_icon_->SetToolTip(tool_tip); } +void Tray::SetTitle(const std::string& title) { + tray_icon_->SetTitle(title); +} + void Tray::SetContextMenu(Menu* menu) { tray_icon_->SetContextMenu(menu->model()); } @@ -59,6 +63,7 @@ void Tray::BuildPrototype(v8::Isolate* isolate, .SetMethod("setImage", &Tray::SetImage) .SetMethod("setPressedImage", &Tray::SetPressedImage) .SetMethod("setToolTip", &Tray::SetToolTip) + .SetMethod("setTitle", &Tray::SetTitle) .SetMethod("_setContextMenu", &Tray::SetContextMenu); } diff --git a/atom/browser/api/atom_api_tray.h b/atom/browser/api/atom_api_tray.h index 5dce0cbe954..c50293219df 100644 --- a/atom/browser/api/atom_api_tray.h +++ b/atom/browser/api/atom_api_tray.h @@ -41,6 +41,7 @@ class Tray : public mate::EventEmitter, void SetImage(const gfx::ImageSkia& image); void SetPressedImage(const gfx::ImageSkia& image); void SetToolTip(const std::string& tool_tip); + void SetTitle(const std::string& title); void SetContextMenu(Menu* menu); private: diff --git a/atom/browser/ui/tray_icon.cc b/atom/browser/ui/tray_icon.cc index fdbdf7a5395..facd3e111a5 100644 --- a/atom/browser/ui/tray_icon.cc +++ b/atom/browser/ui/tray_icon.cc @@ -12,6 +12,9 @@ TrayIcon::TrayIcon() { TrayIcon::~TrayIcon() { } +void TrayIcon::SetTitle(const std::string& title) { +} + void TrayIcon::NotifyClicked() { FOR_EACH_OBSERVER(TrayIconObserver, observers_, OnClicked()); } diff --git a/atom/browser/ui/tray_icon.h b/atom/browser/ui/tray_icon.h index 80de248810b..46e609a2042 100644 --- a/atom/browser/ui/tray_icon.h +++ b/atom/browser/ui/tray_icon.h @@ -31,6 +31,10 @@ class TrayIcon { // status icon (e.g. Ubuntu Unity). virtual void SetToolTip(const std::string& tool_tip) = 0; + // Sets the title displayed aside of the status icon in the status bar. This + // only works on OS X. + virtual void SetTitle(const std::string& title); + // Set the context menu for this icon. virtual void SetContextMenu(ui::SimpleMenuModel* menu_model) = 0; diff --git a/atom/browser/ui/tray_icon_cocoa.h b/atom/browser/ui/tray_icon_cocoa.h index b6a710ce127..5c67b8ef60a 100644 --- a/atom/browser/ui/tray_icon_cocoa.h +++ b/atom/browser/ui/tray_icon_cocoa.h @@ -25,6 +25,7 @@ class TrayIconCocoa : public TrayIcon { virtual void SetImage(const gfx::ImageSkia& image) OVERRIDE; virtual void SetPressedImage(const gfx::ImageSkia& image) OVERRIDE; virtual void SetToolTip(const std::string& tool_tip) OVERRIDE; + virtual void SetTitle(const std::string& title) OVERRIDE; virtual void SetContextMenu(ui::SimpleMenuModel* menu_model) OVERRIDE; private: diff --git a/atom/browser/ui/tray_icon_cocoa.mm b/atom/browser/ui/tray_icon_cocoa.mm index ef456897e91..c4867e92552 100644 --- a/atom/browser/ui/tray_icon_cocoa.mm +++ b/atom/browser/ui/tray_icon_cocoa.mm @@ -68,6 +68,10 @@ void TrayIconCocoa::SetToolTip(const std::string& tool_tip) { [item_ setToolTip:base::SysUTF8ToNSString(tool_tip)]; } +void TrayIconCocoa::SetTitle(const std::string& title) { + [item_ setTitle:base::SysUTF8ToNSString(title)]; +} + void TrayIconCocoa::SetContextMenu(ui::SimpleMenuModel* menu_model) { menu_.reset([[AtomMenuController alloc] initWithModel:menu_model]); [item_ setMenu:[menu_ menu]];