summaryrefslogtreecommitdiffstats
path: root/src/core/favicon_manager_p.h
diff options
context:
space:
mode:
authorPeter Varga <pvarga@inf.u-szeged.hu>2015-12-01 10:50:02 +0100
committerPeter Varga <pvarga@inf.u-szeged.hu>2016-02-03 16:21:12 +0000
commit41d69eb0fa2375f0da6ba9b35136f5598be4b3a4 (patch)
tree3c754447cf5d1c854eb1bc7fdbe3d6777fcdac0c /src/core/favicon_manager_p.h
parent4713387c052d54e0f5ea02efaeaa25931d1cd7ee (diff)
Add FaviconManager to core
The new icon manager uses the WebContents::DownloadImage() API for downloading icons. It proposes the best quality among the available favicons via the iconChanged signal. Change-Id: I66a014365b6f6560ff34d40ee870aee84e4e70e4 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@theqtcompany.com>
Diffstat (limited to 'src/core/favicon_manager_p.h')
-rw-r--r--src/core/favicon_manager_p.h106
1 files changed, 106 insertions, 0 deletions
diff --git a/src/core/favicon_manager_p.h b/src/core/favicon_manager_p.h
new file mode 100644
index 000000000..8358245a2
--- /dev/null
+++ b/src/core/favicon_manager_p.h
@@ -0,0 +1,106 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the QtWebEngine module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef FAVICON_MANAGER_P_H
+#define FAVICON_MANAGER_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include "qtwebenginecoreglobal_p.h"
+
+#include <QtCore/QMap>
+#include <QtCore/QObject>
+#include <vector>
+
+#include "base/memory/weak_ptr.h"
+
+QT_FORWARD_DECLARE_CLASS(QUrl)
+
+class GURL;
+class SkBitmap;
+
+namespace gfx {
+ class Size;
+}
+
+namespace content {
+ class WebContents;
+}
+
+namespace QtWebEngineCore {
+
+class FaviconManager;
+class WebContentsAdapterClient;
+
+class FaviconManagerPrivate {
+public:
+ FaviconManagerPrivate(content::WebContents *, WebContentsAdapterClient *);
+ ~FaviconManagerPrivate();
+
+ int downloadIcon(const QUrl &, bool);
+
+ void iconDownloadFinished(int, int, const GURL &, const std::vector<SkBitmap> &, const std::vector<gfx::Size> &);
+ void storeIcon(int, const QIcon &);
+ void downloadPendingRequests();
+
+ content::WebContents *m_webContents;
+ WebContentsAdapterClient *m_viewClient;
+ base::WeakPtrFactory<FaviconManagerPrivate> m_weakFactory;
+
+ QMap<QUrl, QIcon> m_icons;
+ QMap<int, QUrl> m_inProgressCandidateRequests;
+ QMap<int, QUrl> m_inProgressCustomRequests;
+ QMap<int, QUrl> m_pendingRequests;
+
+ Q_DECLARE_PUBLIC(FaviconManager)
+ FaviconManager *q_ptr;
+};
+
+} // namespace QtWebEngineCore
+
+#endif // FAVICON_MANAGER_P_H