Messagelib

hashcachemanager.h
1 /*
2  SPDX-FileCopyrightText: 2016-2023 Laurent Montel <[email protected]>
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 
13 namespace WebEngineViewer
14 {
15 class HashCacheManagerPrivate;
16 // https://developers.google.com/safe-browsing/v4/caching
17 /**
18  * @brief The HashCacheManager class
19  * @author Laurent Montel <[email protected]>
20  */
21 class WEBENGINEVIEWER_EXPORT HashCacheManager : public QObject
22 {
23  Q_OBJECT
24 public:
25  enum UrlStatus { UrlOk = 0, MalWare = 1, Unknown = 2 };
26  explicit HashCacheManager(QObject *parent = nullptr);
27  ~HashCacheManager() override;
28 
29  static HashCacheManager *self();
30 
31  void clearCache();
32 
33  void addHashStatus(const QByteArray &hash, HashCacheManager::UrlStatus status, uint cacheDuration);
34 
35  [[nodiscard]] HashCacheManager::UrlStatus hashStatus(const QByteArray &hash);
36 
37 private:
38  std::unique_ptr<HashCacheManagerPrivate> const d;
39 };
40 }
41 
42 Q_DECLARE_METATYPE(WebEngineViewer::HashCacheManager::UrlStatus)
The HashCacheManager class.
Q_SCRIPTABLE CaptureState status()
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Sat Dec 2 2023 03:56:53 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.