tray_icon_->DisplayBalloon(icon, title, content);
}
-void Tray::PopContextMenu() {
- tray_icon_->PopContextMenu();
+void Tray::PopContextMenu(mate::Arguments* args) {
+ gfx::Point pos;
+ args->GetNext(&pos);
+ tray_icon_->PopContextMenu(pos);
}
void Tray::SetContextMenu(mate::Arguments* args, Menu* menu) {
void SetTitle(mate::Arguments* args, const std::string& title);
void SetHighlightMode(mate::Arguments* args, bool highlight);
void DisplayBalloon(mate::Arguments* args, const mate::Dictionary& options);
- void PopContextMenu();
+ void PopContextMenu(mate::Arguments* args);
void SetContextMenu(mate::Arguments* args, Menu* menu);
private:
const base::string16& title,
const base::string16& contents);
- virtual void PopContextMenu();
+ virtual void PopContextMenu(const gfx::Point& pos);
// Set the context menu for this icon.
virtual void SetContextMenu(ui::SimpleMenuModel* menu_model) = 0;
}
NotifyRightClicked(gfx::Rect(rect));
-
- if (!menu_model_)
- return;
-
- // Set our window as the foreground window, so the context menu closes when
- // we click away from it.
- if (!SetForegroundWindow(window_))
- return;
-
- views::MenuRunner menu_runner(
- menu_model_,
- views::MenuRunner::CONTEXT_MENU | views::MenuRunner::HAS_MNEMONICS);
- ignore_result(menu_runner.RunMenuAt(
- NULL,
- NULL,
- gfx::Rect(cursor_pos, gfx::Size()),
- views::MENU_ANCHOR_TOPLEFT,
- ui::MENU_SOURCE_MOUSE));
+ PopContextMenu(cursor_pos);
}
void NotifyIcon::ResetIcon() {
LOG(WARNING) << "Unable to create status tray balloon.";
}
+void NotifyIcon::PopContextMenu(const gfx::Point& pos) {
+ // Set our window as the foreground window, so the context menu closes when
+ // we click away from it.
+ if (!SetForegroundWindow(window_))
+ return;
+
+ views::MenuRunner menu_runner(
+ menu_model_,
+ views::MenuRunner::CONTEXT_MENU | views::MenuRunner::HAS_MNEMONICS);
+ ignore_result(menu_runner.RunMenuAt(
+ NULL,
+ NULL,
+ gfx::Rect(pos, gfx::Size()),
+ views::MENU_ANCHOR_TOPLEFT,
+ ui::MENU_SOURCE_MOUSE));
+}
+
void NotifyIcon::SetContextMenu(ui::SimpleMenuModel* menu_model) {
menu_model_ = menu_model;
}
void DisplayBalloon(const gfx::Image& icon,
const base::string16& title,
const base::string16& contents) override;
+ void PopContextMenu(const gfx::Point& pos) override;
void SetContextMenu(ui::SimpleMenuModel* menu_model) override;
private: