ZaStoGram_desktop/Telegram/SourceFiles/data/data_document_resolver.h
John Preston c3b0b02b68 Keep launch warnings when Open With shows no chooser
Task: 2026/10/25/keep-launch-warnings-when-open-with-cannot-show-a-chooser

Discovered by Anthropic's OSS Scanner, as vulnerability ANT-2026-HFEZCIEF.
2026-10-28 17:50:27 +04:00

71 lines
1.5 KiB
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
*/
#pragma once
#include "base/binary_guard.h"
#include <gsl/util>
#include <optional>
class DocumentData;
class HistoryItem;
namespace Core {
class Settings;
struct LaunchType;
} // namespace Core
namespace Window {
class SessionController;
} // namespace Window
namespace Data {
class DocumentMedia;
enum class ImageOpenSource : uchar {
None,
Location,
Bytes,
};
struct ImageOpenCheck {
QString mime;
ImageOpenSource source = ImageOpenSource::None;
bool sizeOverLimit = false;
bool readable = false;
bool openInApp = false;
std::optional<gsl::final_action<Fn<void()>>> accessGuard;
};
[[nodiscard]] ImageOpenCheck CheckImageOpenInApp(
not_null<DocumentData*> document,
const std::shared_ptr<DocumentMedia> &media);
[[nodiscard]] bool LauncherWouldWarn(
const Core::Settings &settings,
const Core::LaunchType &type,
HistoryItem *item);
void LaunchWithWarning(const QString &name, HistoryItem *item);
base::binary_guard ReadBackgroundImageAsync(
not_null<Data::DocumentMedia*> media,
FnMut<QImage(QImage)> postprocess,
FnMut<void(QImage&&)> done);
void ResolveDocument(
Window::SessionController *controller,
not_null<DocumentData*> document,
HistoryItem *item,
MsgId topicRootId,
PeerId monoforumPeerId,
bool showDrawButton);
} // namespace Data