refactor: make LoginItemSettings::path a wstring

This commit is contained in:
Charles Kerr 2021-03-30 17:14:27 -07:00
parent 0f3620099a
commit 9127cff58b
2 changed files with 4 additions and 6 deletions

View file

@ -131,7 +131,7 @@ class Browser : public WindowListObserver {
bool restore_state = false; bool restore_state = false;
bool opened_at_login = false; bool opened_at_login = false;
bool opened_as_hidden = false; bool opened_as_hidden = false;
std::u16string path; std::wstring path;
std::vector<std::u16string> args; std::vector<std::u16string> args;
#if defined(OS_WIN) #if defined(OS_WIN)

View file

@ -196,9 +196,7 @@ std::vector<Browser::LaunchItem> GetLoginItemSettingsHelper(
lookup_exe_path = lookup_exe_path =
base::CommandLine::FromString(process_exe_path).GetProgram(); base::CommandLine::FromString(process_exe_path).GetProgram();
} else { } else {
lookup_exe_path = lookup_exe_path = base::CommandLine::FromString(options.path).GetProgram();
base::CommandLine::FromString(base::UTF16ToWide(options.path))
.GetProgram();
} }
if (!lookup_exe_path.empty()) { if (!lookup_exe_path.empty()) {
@ -701,7 +699,7 @@ void Browser::SetLoginItemSettings(LoginItemSettings settings) {
!settings.name.empty() ? settings.name.c_str() : GetAppUserModelID(); !settings.name.empty() ? settings.name.c_str() : GetAppUserModelID();
if (settings.open_at_login) { if (settings.open_at_login) {
std::wstring exe = base::UTF16ToWide(settings.path); std::wstring exe = settings.path;
if (FormatCommandLineString(&exe, settings.args)) { if (FormatCommandLineString(&exe, settings.args)) {
key.WriteValue(key_name, exe.c_str()); key.WriteValue(key_name, exe.c_str());
@ -740,7 +738,7 @@ Browser::LoginItemSettings Browser::GetLoginItemSettings(
// keep old openAtLogin behaviour // keep old openAtLogin behaviour
if (!FAILED(key.ReadValue(GetAppUserModelID(), &keyVal))) { if (!FAILED(key.ReadValue(GetAppUserModelID(), &keyVal))) {
std::wstring exe = base::UTF16ToWide(options.path); std::wstring exe = options.path;
if (FormatCommandLineString(&exe, options.args)) { if (FormatCommandLineString(&exe, options.args)) {
settings.open_at_login = keyVal == exe; settings.open_at_login = keyVal == exe;
} }