1/*
2    Copyright (C) 2012 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#ifndef qtwebsecurityorigin_p_h
20#define qtwebsecurityorigin_p_h
21
22#include "qwebkitglobal.h"
23
24#include <QtCore/QDataStream>
25#include <QtCore/QObject>
26#include <QtCore/QString>
27#include <QtCore/QUrl>
28#include <QtCore/qshareddata.h>
29
30class QWEBKIT_EXPORT QtWebSecurityOrigin : public QObject {
31    Q_OBJECT
32    Q_PROPERTY(QString scheme READ scheme CONSTANT)
33    Q_PROPERTY(QString host READ host CONSTANT)
34    Q_PROPERTY(int port READ port CONSTANT)
35    Q_PROPERTY(QString path READ path CONSTANT)
36
37public:
38    QtWebSecurityOrigin(QObject* parent = 0);
39    virtual ~QtWebSecurityOrigin();
40
41    QString scheme() const;
42    QString host() const;
43    int port() const;
44    QString path() const;
45
46    // Used to set security information in a permission request event (e.g.
47    // geolocation permission)
48    void setScheme(const QString& scheme) { m_url.setScheme(scheme); }
49    void setHost(const QString& host) { m_url.setHost(host); }
50    void setPath(const QString& path) { m_url.setPath(path); }
51    void setPort(int port) { m_url.setPort(port); }
52
53private:
54    QUrl m_url;
55};
56
57#endif // qtwebsecurityorigin_p_h
58