Bind TrayIcon to JS.
This commit is contained in:
parent
52d8d6fdb3
commit
6c7fe80ec5
13 changed files with 169 additions and 11 deletions
|
@ -15,6 +15,8 @@ class TrayIcon {
|
|||
public:
|
||||
static TrayIcon* Create();
|
||||
|
||||
virtual ~TrayIcon();
|
||||
|
||||
// Sets the image associated with this status icon.
|
||||
virtual void SetImage(const gfx::ImageSkia& image) = 0;
|
||||
|
||||
|
@ -32,7 +34,6 @@ class TrayIcon {
|
|||
|
||||
protected:
|
||||
TrayIcon();
|
||||
virtual ~TrayIcon();
|
||||
|
||||
private:
|
||||
DISALLOW_COPY_AND_ASSIGN(TrayIcon);
|
||||
|
|
|
@ -18,15 +18,15 @@ namespace atom {
|
|||
|
||||
class TrayIconCocoa : public TrayIcon {
|
||||
public:
|
||||
TrayIconCocoa();
|
||||
virtual ~TrayIconCocoa();
|
||||
|
||||
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 SetContextMenu(ui::SimpleMenuModel* menu_model) OVERRIDE;
|
||||
|
||||
private:
|
||||
TrayIconCocoa();
|
||||
virtual ~TrayIconCocoa();
|
||||
|
||||
base::scoped_nsobject<NSStatusItem> item_;
|
||||
|
||||
// Status menu shown when right-clicking the system icon.
|
||||
|
|
|
@ -41,9 +41,13 @@ void TrayIconCocoa::SetToolTip(const std::string& tool_tip) {
|
|||
}
|
||||
|
||||
void TrayIconCocoa::SetContextMenu(ui::SimpleMenuModel* menu_model) {
|
||||
TrayIcon::SetContextMenu(menu_model);
|
||||
menu_.reset([[AtomMenuController alloc] initWithModel:menu_model]);
|
||||
[item_ setMenu:[menu_ menu]];
|
||||
}
|
||||
|
||||
// static
|
||||
TrayIcon* TrayIcon::Create() {
|
||||
return new TrayIconCocoa;
|
||||
}
|
||||
|
||||
} // namespace atom
|
||||
|
|
|
@ -24,4 +24,9 @@ void TrayIconGtk::SetToolTip(const std::string& tool_tip) {
|
|||
void TrayIconGtk::SetContextMenu(ui::SimpleMenuModel* menu_model) {
|
||||
}
|
||||
|
||||
// static
|
||||
TrayIcon* TrayIcon::Create() {
|
||||
return new TrayIconGtk;
|
||||
}
|
||||
|
||||
} // namespace atom
|
||||
|
|
|
@ -13,15 +13,15 @@ namespace atom {
|
|||
|
||||
class TrayIconGtk : public TrayIcon {
|
||||
public:
|
||||
TrayIconGtk();
|
||||
virtual ~TrayIconGtk();
|
||||
|
||||
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 SetContextMenu(ui::SimpleMenuModel* menu_model) OVERRIDE;
|
||||
|
||||
private:
|
||||
TrayIconGtk();
|
||||
virtual ~TrayIconGtk();
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(TrayIconGtk);
|
||||
};
|
||||
|
||||
|
|
|
@ -24,4 +24,9 @@ void TrayIconWin::SetToolTip(const std::string& tool_tip) {
|
|||
void TrayIconWin::SetContextMenu(ui::SimpleMenuModel* menu_model) {
|
||||
}
|
||||
|
||||
// static
|
||||
TrayIcon* TrayIcon::Create() {
|
||||
return new TrayIconWin;
|
||||
}
|
||||
|
||||
} // namespace atom
|
||||
|
|
|
@ -13,15 +13,15 @@ namespace atom {
|
|||
|
||||
class TrayIconWin : public TrayIcon {
|
||||
public:
|
||||
TrayIconWin();
|
||||
virtual ~TrayIconWin();
|
||||
|
||||
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 SetContextMenu(ui::SimpleMenuModel* menu_model) OVERRIDE;
|
||||
|
||||
private:
|
||||
TrayIconWin();
|
||||
virtual ~TrayIconWin();
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(TrayIconWin);
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue