fix: app.setLoginItemSettings
error getting swallowed by gin conversion (#41667)
* fix: errors getting swallowed by gin conversion Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com> * fix: Windows build Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com> * test: re-enable disabled test Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com> --------- Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com> Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
This commit is contained in:
parent
21341a56a7
commit
0f1e52fafe
11 changed files with 211 additions and 154 deletions
|
@ -17,6 +17,7 @@
|
|||
#include "gin/dictionary.h"
|
||||
#include "shell/browser/browser_observer.h"
|
||||
#include "shell/browser/window_list_observer.h"
|
||||
#include "shell/common/gin_converters/login_item_settings_converter.h"
|
||||
#include "shell/common/gin_helper/promise.h"
|
||||
|
||||
#if BUILDFLAG(IS_WIN)
|
||||
|
@ -41,6 +42,48 @@ namespace electron {
|
|||
|
||||
class ElectronMenuModel;
|
||||
|
||||
#if BUILDFLAG(IS_WIN)
|
||||
struct LaunchItem {
|
||||
std::wstring name;
|
||||
std::wstring path;
|
||||
std::wstring scope;
|
||||
std::vector<std::wstring> args;
|
||||
bool enabled = true;
|
||||
|
||||
LaunchItem();
|
||||
~LaunchItem();
|
||||
LaunchItem(const LaunchItem&);
|
||||
};
|
||||
#endif
|
||||
|
||||
struct LoginItemSettings {
|
||||
bool open_at_login = false;
|
||||
bool open_as_hidden = false;
|
||||
bool restore_state = false;
|
||||
bool opened_at_login = false;
|
||||
bool opened_as_hidden = false;
|
||||
std::u16string path;
|
||||
std::vector<std::u16string> args;
|
||||
|
||||
#if BUILDFLAG(IS_MAC)
|
||||
std::string type = "mainAppService";
|
||||
std::string service_name;
|
||||
std::string status;
|
||||
#elif BUILDFLAG(IS_WIN)
|
||||
// used in browser::setLoginItemSettings
|
||||
bool enabled = true;
|
||||
std::wstring name;
|
||||
|
||||
// used in browser::getLoginItemSettings
|
||||
bool executable_will_launch_at_login = false;
|
||||
std::vector<LaunchItem> launch_items;
|
||||
#endif
|
||||
|
||||
LoginItemSettings();
|
||||
~LoginItemSettings();
|
||||
LoginItemSettings(const LoginItemSettings&);
|
||||
};
|
||||
|
||||
// This class is used for control application-wide operations.
|
||||
class Browser : public WindowListObserver {
|
||||
public:
|
||||
|
@ -112,50 +155,8 @@ class Browser : public WindowListObserver {
|
|||
bool SetBadgeCount(std::optional<int> count);
|
||||
[[nodiscard]] int badge_count() const { return badge_count_; }
|
||||
|
||||
#if BUILDFLAG(IS_WIN)
|
||||
struct LaunchItem {
|
||||
std::wstring name;
|
||||
std::wstring path;
|
||||
std::wstring scope;
|
||||
std::vector<std::wstring> args;
|
||||
bool enabled = true;
|
||||
|
||||
LaunchItem();
|
||||
~LaunchItem();
|
||||
LaunchItem(const LaunchItem&);
|
||||
};
|
||||
#endif
|
||||
|
||||
// Set/Get the login item settings of the app
|
||||
struct LoginItemSettings {
|
||||
bool open_at_login = false;
|
||||
bool open_as_hidden = false;
|
||||
bool restore_state = false;
|
||||
bool opened_at_login = false;
|
||||
bool opened_as_hidden = false;
|
||||
std::u16string path;
|
||||
std::vector<std::u16string> args;
|
||||
|
||||
#if BUILDFLAG(IS_MAC)
|
||||
std::string type = "mainAppService";
|
||||
std::string service_name;
|
||||
std::string status;
|
||||
#elif BUILDFLAG(IS_WIN)
|
||||
// used in browser::setLoginItemSettings
|
||||
bool enabled = true;
|
||||
std::wstring name;
|
||||
|
||||
// used in browser::getLoginItemSettings
|
||||
bool executable_will_launch_at_login = false;
|
||||
std::vector<LaunchItem> launch_items;
|
||||
#endif
|
||||
|
||||
LoginItemSettings();
|
||||
~LoginItemSettings();
|
||||
LoginItemSettings(const LoginItemSettings&);
|
||||
};
|
||||
void SetLoginItemSettings(LoginItemSettings settings);
|
||||
LoginItemSettings GetLoginItemSettings(const LoginItemSettings& options);
|
||||
v8::Local<v8::Value> GetLoginItemSettings(const LoginItemSettings& options);
|
||||
|
||||
#if BUILDFLAG(IS_MAC)
|
||||
// Set the handler which decides whether to shutdown.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue