blob: 21d9fc65338dcd9b6734712ccf0f62859cd6412b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
|
// Copyright (C) 2017 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef DESKTOP_NOTIFICATION_CONTROLLER_H
#define DESKTOP_NOTIFICATION_CONTROLLER_H
#include <QtWebEngineCore/qtwebenginecoreglobal.h>
#include <QtCore/qsharedpointer.h>
#include <QtCore/qurl.h>
#include <QtGui/qimage.h>
class GURL;
namespace blink {
struct NotificationResources;
struct PlatformNotificationData;
}
namespace QtWebEngineCore {
class UserNotificationControllerPrivate;
// Works as an accessor and owner of chromium objects related to showing desktop notifications.
class Q_WEBENGINECORE_EXPORT UserNotificationController : public QEnableSharedFromThis<UserNotificationController> {
public:
struct Delegate {
virtual ~Delegate() { }
virtual void shown() = 0;
virtual void clicked() = 0;
virtual void closed(bool byUser) = 0;
};
UserNotificationController(const blink::PlatformNotificationData ¶ms,
const blink::NotificationResources &resources,
const GURL &origin,
Delegate *delegate);
~UserNotificationController();
// The notification was shown.
void notificationDisplayed();
// The notification was closed.
void notificationClosed();
// The user clicked on the notification.
void notificationClicked();
// Chromium requests to close the notification.
void closeNotification();
QUrl origin() const;
QImage icon() const;
QImage image() const;
QImage badge() const;
QString title() const;
QString body() const;
QString tag() const;
QString language() const;
Qt::LayoutDirection direction() const;
bool isShown() const;
class Client {
public:
virtual ~Client() { }
virtual void notificationClosed(const UserNotificationController *) = 0;
};
void setClient(Client *client);
Client* client();
private:
UserNotificationControllerPrivate *d;
};
} // namespace QtWebEngineCore
#endif // DESKTOP_NOTIFICATION_CONTROLLER_H
|