browser_win.cc (electron-11.0.1) | : | browser_win.cc (electron-11.0.2) | ||
---|---|---|---|---|
skipping to change at line 199 | skipping to change at line 199 | |||
// a list of launchItem with matching paths to our application. | // a list of launchItem with matching paths to our application. | |||
// if a launchItem with a matching path also has a matching entry within the | // if a launchItem with a matching path also has a matching entry within the | |||
// startup_approved_key_path, set executable_will_launch_at_login to be `true` | // startup_approved_key_path, set executable_will_launch_at_login to be `true` | |||
std::vector<Browser::LaunchItem> GetLoginItemSettingsHelper( | std::vector<Browser::LaunchItem> GetLoginItemSettingsHelper( | |||
base::win::RegistryValueIterator* it, | base::win::RegistryValueIterator* it, | |||
boolean* executable_will_launch_at_login, | boolean* executable_will_launch_at_login, | |||
base::string16 scope, | base::string16 scope, | |||
const Browser::LoginItemSettings& options) { | const Browser::LoginItemSettings& options) { | |||
std::vector<Browser::LaunchItem> launch_items; | std::vector<Browser::LaunchItem> launch_items; | |||
while (it->Valid()) { | base::FilePath lookup_exe_path; | |||
base::string16 exe = options.path; | if (options.path.empty()) { | |||
if (FormatCommandLineString(&exe, options.args)) { | base::string16 process_exe_path; | |||
GetProcessExecPath(&process_exe_path); | ||||
lookup_exe_path = | ||||
base::CommandLine::FromString(process_exe_path).GetProgram(); | ||||
} else { | ||||
lookup_exe_path = base::CommandLine::FromString(options.path).GetProgram(); | ||||
} | ||||
if (!lookup_exe_path.empty()) { | ||||
while (it->Valid()) { | ||||
base::CommandLine registry_launch_cmd = | ||||
base::CommandLine::FromString(it->Value()); | ||||
base::FilePath registry_launch_path = registry_launch_cmd.GetProgram(); | ||||
bool exe_match = base::FilePath::CompareEqualIgnoreCase( | ||||
lookup_exe_path.value(), registry_launch_path.value()); | ||||
// add launch item to vector if it has a matching path (case-insensitive) | // add launch item to vector if it has a matching path (case-insensitive) | |||
if ((base::CompareCaseInsensitiveASCII(it->Value(), exe.c_str())) == 0) { | if (exe_match) { | |||
Browser::LaunchItem launch_item; | Browser::LaunchItem launch_item; | |||
base::string16 launch_path = options.path; | ||||
if (launch_path.empty()) { | ||||
GetProcessExecPath(&launch_path); | ||||
} | ||||
launch_item.name = it->Name(); | launch_item.name = it->Name(); | |||
launch_item.path = launch_path; | launch_item.path = registry_launch_path.value(); | |||
launch_item.args = options.args; | launch_item.args = registry_launch_cmd.GetArgs(); | |||
launch_item.scope = scope; | launch_item.scope = scope; | |||
launch_item.enabled = true; | launch_item.enabled = true; | |||
// attempt to update launch_item.enabled if there is a matching key | // attempt to update launch_item.enabled if there is a matching key | |||
// value entry in the StartupApproved registry | // value entry in the StartupApproved registry | |||
HKEY hkey; | HKEY hkey; | |||
// StartupApproved registry path | // StartupApproved registry path | |||
LPCTSTR path = TEXT( | LPCTSTR path = TEXT( | |||
"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\StartupApp" | "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\StartupApp" | |||
"roved\\Run"); | "roved\\Run"); | |||
skipping to change at line 252 | skipping to change at line 263 | |||
0x00, 0x00, 0x00, 0x00, | 0x00, 0x00, 0x00, 0x00, | |||
0x00, 0x00, 0x00, 0x00}; | 0x00, 0x00, 0x00, 0x00}; | |||
wchar_t binary_accepted_alt[12] = {0x02, 0x00, 0x00, 0x00, | wchar_t binary_accepted_alt[12] = {0x02, 0x00, 0x00, 0x00, | |||
0x00, 0x00, 0x00, 0x00, | 0x00, 0x00, 0x00, 0x00, | |||
0x00, 0x00, 0x00, 0x00}; | 0x00, 0x00, 0x00, 0x00}; | |||
std::string reg_binary(reinterpret_cast<char*>(binary_accepted)); | std::string reg_binary(reinterpret_cast<char*>(binary_accepted)); | |||
std::string reg_binary_alt( | std::string reg_binary_alt( | |||
reinterpret_cast<char*>(binary_accepted_alt)); | reinterpret_cast<char*>(binary_accepted_alt)); | |||
std::string reg_startup_binary( | std::string reg_startup_binary( | |||
reinterpret_cast<char*>(startup_binary)); | reinterpret_cast<char*>(startup_binary)); | |||
launch_item.enabled = (reg_binary == reg_startup_binary) || | launch_item.enabled = (reg_startup_binary == reg_binary) || | |||
(reg_binary == reg_binary_alt); | (reg_startup_binary == reg_binary_alt); | |||
} | } | |||
} | } | |||
} | } | |||
*executable_will_launch_at_login = | *executable_will_launch_at_login = | |||
*executable_will_launch_at_login || launch_item.enabled; | *executable_will_launch_at_login || launch_item.enabled; | |||
launch_items.push_back(launch_item); | launch_items.push_back(launch_item); | |||
} | } | |||
it->operator++(); | ||||
} | } | |||
it->operator++(); | ||||
} | } | |||
return launch_items; | return launch_items; | |||
} | } | |||
std::unique_ptr<FileVersionInfo> FetchFileVersionInfo() { | std::unique_ptr<FileVersionInfo> FetchFileVersionInfo() { | |||
base::FilePath path; | base::FilePath path; | |||
if (base::PathService::Get(base::FILE_EXE, &path)) { | if (base::PathService::Get(base::FILE_EXE, &path)) { | |||
base::ThreadRestrictions::ScopedAllowIO allow_io; | base::ThreadRestrictions::ScopedAllowIO allow_io; | |||
return FileVersionInfo::CreateFileVersionInfo(path); | return FileVersionInfo::CreateFileVersionInfo(path); | |||
End of changes. 7 change blocks. | ||||
13 lines changed or deleted | 24 lines changed or added |