1/*
2    Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies)
3
4    This library is free software; you can redistribute it and/or
5    modify it under the terms of the GNU Library General Public
6    License as published by the Free Software Foundation; either
7    version 2 of the License, or (at your option) any later version.
8
9    This library is distributed in the hope that it will be useful,
10    but WITHOUT ANY WARRANTY; without even the implied warranty of
11    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12    Library General Public License for more details.
13
14    You should have received a copy of the GNU Library General Public License
15    along with this library; see the file COPYING.LIB.  If not, write to
16    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17    Boston, MA 02110-1301, USA.
18*/
19
20#ifndef qwebpermissionrequest_p_h
21#define qwebpermissionrequest_p_h
22
23#include "qtwebsecurityorigin_p.h"
24#include "qwebkitglobal.h"
25
26#include <QtCore/QObject>
27#include <QtCore/qshareddata.h>
28#include <WebKit2/WKGeolocationPermissionRequest.h>
29#include <WebKit2/WKNotificationPermissionRequest.h>
30#include <WebKit2/WKSecurityOrigin.h>
31
32class QWebPermissionRequestPrivate;
33
34class QWEBKIT_EXPORT QWebPermissionRequest : public QObject {
35    Q_OBJECT
36    Q_PROPERTY(bool allow READ allow WRITE setAllow)
37    Q_PROPERTY(RequestType type READ type CONSTANT)
38    Q_PROPERTY(QtWebSecurityOrigin* origin READ securityOrigin)
39    Q_ENUMS(RequestType)
40
41public:
42    enum RequestType {
43        Geolocation,
44        Notification
45    };
46
47    static QWebPermissionRequest* create(WKSecurityOriginRef, WKGeolocationPermissionRequestRef);
48    static QWebPermissionRequest* create(WKSecurityOriginRef, WKNotificationPermissionRequestRef);
49    virtual ~QWebPermissionRequest();
50
51    RequestType type() const;
52    bool allow() const;
53
54public Q_SLOTS:
55    void setAllow(bool);
56    QtWebSecurityOrigin* securityOrigin();
57
58private:
59    friend class QWebPermissionRequestPrivate;
60    QWebPermissionRequest(WKSecurityOriginRef securityOrigin
61                          , WKGeolocationPermissionRequestRef geo = 0
62                          , WKNotificationPermissionRequestRef notify = 0
63                          , QWebPermissionRequest::RequestType type = Geolocation
64                          , QObject* parent = 0);
65
66private:
67    QExplicitlySharedDataPointer<QWebPermissionRequestPrivate> d;
68};
69
70
71#endif // qwebpermissionrequest_h
72