in remote/CommandLineArgs.cpp [192:274]
void CommandLineArgs::prepareCefSettings(void * pCefSettings) {
CefSettings & settings = *reinterpret_cast<CefSettings*>(pCefSettings);
for (const auto & p: myParsedCefSettings) {
if (p.first.compare("cache_path") == 0 && !myPathRootCache.empty()) {
Log::debug("Setting 'cache_path' from params file (or cmd line) with value '%s' will be overrriden with cmd line arg '--root=%s'", p.second.c_str(), myPathRootCache.c_str());
CefString(&settings.cache_path) = myPathRootCache;
} else
CefSettingsParser::setSettingItem(settings, p.first, p.second);
}
settings.windowless_rendering_enabled = true;
settings.multi_threaded_message_loop = false;
settings.external_message_pump = false;
settings.no_sandbox = true; // TODO: support sandbox later.
#if defined(OS_MAC)
CefString(&settings.framework_dir_path) = CefUtils::getFrameworkDir();
if (settings.browser_subprocess_path.length == 0) {
// example: browser_subprocess_path=/Users/bocha/Downloads/jbr_jcef-25.0.1-osx-aarch64-b245.32/Contents/Frameworks/cef_server.app/Contents/Frameworks/cef_server Helper.app/Contents/MacOS/cef_server Helper
boost::filesystem::path path = boost::filesystem::current_path()
.append("..")
.append("Frameworks")
.append("cef_server Helper.app")
.append("Contents")
.append("MacOS")
.append("cef_server Helper")
.lexically_normal();
if (utils::isFileExist(path.c_str())) {
Log::debug("Set CefSettings.browser_subprocess_path=%s", path.c_str());
CefString(&settings.browser_subprocess_path) = path.string();
} else
Log::error("Empty browser_subprocess_path.");
}
#elif defined(OS_WIN)
const bool doSetResourcesPath = getBoolEnv("CEF_SERVER_CommandLineArgs_SetResourcesPath");
if (doSetResourcesPath) {
auto installation_root =
boost::filesystem::current_path().append("..").lexically_normal();
boost::filesystem::path resources_dir_path =
installation_root.append("lib");
boost::filesystem::path framework_dir_path =
installation_root.append("bin");
std::string resources_path = resources_dir_path.string();
std::string locales_dir_path =
resources_dir_path.append("locales").string();
CefString(&settings.resources_dir_path).FromString(resources_path);
CefString(&settings.locales_dir_path).FromString(locales_dir_path);
Log::debug("Set CefSettings.resources_dir_path=%s", resources_path.c_str());
Log::debug("Set CefSettings.locales_dir_path=%s", locales_dir_path.c_str());
}
#endif
#if defined(OS_POSIX)
settings.disable_signal_handlers = true;
#endif
if (Log::isTraceEnabled()) {
std::stringstream ss;
ss << "browser_subprocess_path=" << CefString(&settings.browser_subprocess_path).c_str() << std::endl;
ss << "cache_path=" << CefString(&settings.cache_path).c_str() << std::endl;
ss << "user_agent_product=" << CefString(&settings.user_agent_product).c_str() << std::endl;
ss << "user_agent=" << CefString(&settings.user_agent).c_str() << std::endl;
ss << "locales_dir_path=" << CefString(&settings.locales_dir_path).c_str() << std::endl;
ss << "locale=" << CefString(&settings.locale).c_str() << std::endl;
ss << "log_file=" << CefString(&settings.log_file).c_str() << std::endl;
ss << "log_severity=" << settings.log_severity << std::endl;
ss << "javascript_flags=" << CefString(&settings.javascript_flags).c_str() << std::endl;
ss << "resources_dir_path=" << CefString(&settings.resources_dir_path).c_str() << std::endl;
ss << "cookieable_schemes_list=" << CefString(&settings.cookieable_schemes_list).c_str() << std::endl;
ss << "windowless_rendering_enabled=" << settings.windowless_rendering_enabled << std::endl;
ss << "command_line_args_disabled=" << settings.command_line_args_disabled << std::endl;
ss << "persist_session_cookies=" << settings.persist_session_cookies << std::endl;
ss << "cookieable_schemes_exclude_defaults=" << settings.cookieable_schemes_exclude_defaults << std::endl;
ss << "no_sandbox=" << settings.no_sandbox << std::endl;
ss << "remote_debugging_port=" << settings.remote_debugging_port << std::endl;
ss << "uncaught_exception_stack_size=" << settings.uncaught_exception_stack_size << std::endl;
ss << "background_color=" << settings.background_color << std::endl;
Log::trace("Prepared CefSettings:\n%s", ss.str().c_str());
}
}