Messagelib

hashcachemanager.h
1/*
2 SPDX-FileCopyrightText: 2016-2024 Laurent Montel <montel@kde.org>
3
4 SPDX-License-Identifier: LGPL-2.0-or-later
5*/
6
7#pragma once
8
9#include "webengineviewer_export.h"
10#include <QObject>
11#include <memory>
12
13namespace WebEngineViewer
14{
15class HashCacheManagerPrivate;
16// https://developers.google.com/safe-browsing/v4/caching
17/**
18 * @brief The HashCacheManager class
19 * @author Laurent Montel <montel@kde.org>
20 */
21class WEBENGINEVIEWER_EXPORT HashCacheManager : public QObject
22{
23 Q_OBJECT
24public:
25 enum UrlStatus : uint8_t {
26 UrlOk = 0,
27 MalWare = 1,
28 Unknown = 2,
29 };
30 explicit HashCacheManager(QObject *parent = nullptr);
31 ~HashCacheManager() override;
32
33 static HashCacheManager *self();
34
35 void clearCache();
36
37 void addHashStatus(const QByteArray &hash, HashCacheManager::UrlStatus status, uint cacheDuration);
38
39 [[nodiscard]] HashCacheManager::UrlStatus hashStatus(const QByteArray &hash);
40
41private:
42 std::unique_ptr<HashCacheManagerPrivate> const d;
43};
44}
45
46Q_DECLARE_METATYPE(WebEngineViewer::HashCacheManager::UrlStatus)
The HashCacheManager class.
Q_SCRIPTABLE CaptureState status()
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Dec 6 2024 11:58:49 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.