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 program 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 program; 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
21#ifndef QtWebContext_h
22#define QtWebContext_h
23
24#include <QScopedPointer>
25#include <QtGlobal>
26#include <WKContext.h>
27#include <WKRetainPtr.h>
28
29namespace WebKit {
30
31class QtDownloadManager;
32class QtWebIconDatabaseClient;
33
34class QtWebContext {
35public:
36    ~QtWebContext();
37
38    enum StorageType {
39        DatabaseStorage,
40        LocalStorage,
41        CookieStorage,
42        DiskCacheStorage,
43        IconDatabaseStorage
44    };
45
46    static QtWebContext* create(WKContextRef);
47    static QtWebContext* defaultContext();
48
49    static QString preparedStoragePath(StorageType);
50
51    WKContextRef context() { return m_context.get(); }
52
53    QtDownloadManager* downloadManager() { return m_downloadManager.data(); }
54    QtWebIconDatabaseClient* iconDatabase() { return m_iconDatabase.data(); }
55
56private:
57    explicit QtWebContext(WKContextRef);
58
59    WKRetainPtr<WKContextRef> m_context;
60    QScopedPointer<QtDownloadManager> m_downloadManager;
61    QScopedPointer<QtWebIconDatabaseClient> m_iconDatabase;
62};
63
64} // namespace WebKit
65
66#endif // QtWebContext_h
67