Revert "refactor: make LoginItemSettings::path a wstring"

This reverts commit 9127cff58b.
This commit is contained in:
Charles Kerr 2021-03-30 20:32:11 -05:00
parent 1594c54933
commit 9684d85101
2 changed files with 6 additions and 4 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::wstring path; std::u16string path;
std::vector<std::u16string> args; std::vector<std::u16string> args;
#if defined(OS_WIN) #if defined(OS_WIN)

View file

@ -196,7 +196,9 @@ 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 = base::CommandLine::FromString(options.path).GetProgram(); lookup_exe_path =
base::CommandLine::FromString(base::UTF16ToWide(options.path))
.GetProgram();
} }
if (!lookup_exe_path.empty()) { if (!lookup_exe_path.empty()) {
@ -699,7 +701,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 = settings.path; std::wstring exe = base::UTF16ToWide(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());
@ -738,7 +740,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 = options.path; std::wstring exe = base::UTF16ToWide(options.path);
if (FormatCommandLineString(&exe, options.args)) { if (FormatCommandLineString(&exe, options.args)) {
settings.open_at_login = keyVal == exe; settings.open_at_login = keyVal == exe;
} }