ZaStoGram_desktop/Telegram/SourceFiles/test/test_widget_helper_probe_lockdown.cpp
John Preston 995493df3a [ai] Share the widget helper probe's mode dispatch
Task: 2026/11/16/share-the-widget-helper-probes-mode-dispatch-between-macos-and-linux
2026-11-19 23:17:09 +04:00

35 lines
856 B
C++

/*
This file is part of Telegram Desktop,
the official desktop application for the Telegram messaging service.
For license and copyright information please follow this link:
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
*/
#include "test/test_widget_helper_probe_lockdown.h"
#ifdef _DEBUG
namespace Test {
std::string WidgetHelperProbeLockdown(
const std::vector<std::string> &arguments,
const std::function<std::string()> &lockdown) {
if (arguments.size() < 2) {
return lockdown
? lockdown()
: std::string("no lockdown callable");
}
const auto &mode = arguments[1];
if (mode != kWidgetHelperProbeMode
&& mode != kWidgetHelperUnsandboxedMode) {
return RefuseWidgetHelperMode(mode);
}
return RunWidgetHelperProbe(
mode == kWidgetHelperProbeMode,
arguments,
lockdown);
}
} // namespace Test
#endif // _DEBUG