Add API to add/remove app as login item
This commit is contained in:
parent
b55f55cfc4
commit
c5610b2186
3 changed files with 20 additions and 0 deletions
|
@ -531,6 +531,10 @@ void App::BuildPrototype(
|
|||
base::Bind(&Browser::GetLoginItemLaunchStatus, browser))
|
||||
.SetMethod("getLoginItemStatus",
|
||||
base::Bind(&Browser::GetLoginItemStatus, browser))
|
||||
.SetMethod("setAsLoginItem",
|
||||
base::Bind(&Browser::SetAsLoginItem, browser))
|
||||
.SetMethod("removeAsLoginItem",
|
||||
base::Bind(&Browser::RemoveAsLoginItem, browser))
|
||||
#endif
|
||||
#if defined(OS_WIN)
|
||||
.SetMethod("setUserTasks", base::Bind(&Browser::SetUserTasks, browser))
|
||||
|
|
|
@ -140,6 +140,12 @@ class Browser : public WindowListObserver {
|
|||
|
||||
// Get login item status of app
|
||||
v8::Local<v8::Value> GetLoginItemStatus(mate::Arguments* args);
|
||||
|
||||
// Set app as a login item
|
||||
void SetAsLoginItem(mate::Arguments* args);
|
||||
|
||||
// Remove app as a login item
|
||||
void RemoveAsLoginItem();
|
||||
#endif // defined(OS_MACOSX)
|
||||
|
||||
#if defined(OS_WIN)
|
||||
|
|
|
@ -166,6 +166,16 @@ v8::Local<v8::Value> Browser::GetLoginItemStatus(mate::Arguments* args) {
|
|||
return dict.GetHandle();
|
||||
}
|
||||
|
||||
void Browser::SetAsLoginItem(mate::Arguments* args) {
|
||||
bool hidden = false;
|
||||
args->GetNext(&hidden);
|
||||
base::mac::AddToLoginItems(hidden);
|
||||
}
|
||||
|
||||
void Browser::RemoveAsLoginItem() {
|
||||
base::mac::RemoveFromLoginItems();
|
||||
}
|
||||
|
||||
std::string Browser::GetExecutableFileVersion() const {
|
||||
return brightray::GetApplicationVersion();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue