1/*
2 * Copyright (C) 2012 Igalia S.L.
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2,1 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#if !defined(__WEBKIT2_H_INSIDE__) && !defined(WEBKIT2_COMPILATION)
21#error "Only <webkit2/webkit2.h> can be included directly."
22#endif
23
24#ifndef WebKitFaviconDatabase_h
25#define WebKitFaviconDatabase_h
26
27#include <cairo.h>
28#include <gio/gio.h>
29#include <glib-object.h>
30#include <webkit2/WebKitDefines.h>
31
32G_BEGIN_DECLS
33
34#define WEBKIT_TYPE_FAVICON_DATABASE            (webkit_favicon_database_get_type())
35#define WEBKIT_FAVICON_DATABASE(obj)            (G_TYPE_CHECK_INSTANCE_CAST((obj), WEBKIT_TYPE_FAVICON_DATABASE, WebKitFaviconDatabase))
36#define WEBKIT_IS_FAVICON_DATABASE(obj)         (G_TYPE_CHECK_INSTANCE_TYPE((obj), WEBKIT_TYPE_FAVICON_DATABASE))
37#define WEBKIT_FAVICON_DATABASE_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST((klass),  WEBKIT_TYPE_FAVICON_DATABASE, WebKitFaviconDatabaseClass))
38#define WEBKIT_IS_FAVICON_DATABASE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),  WEBKIT_TYPE_FAVICON_DATABASE))
39#define WEBKIT_FAVICON_DATABASE_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS((obj),  WEBKIT_TYPE_FAVICON_DATABASE, WebKitFaviconDatabaseClass))
40#define WEBKIT_FAVICON_DATABASE_ERROR           (webkit_favicon_database_error_quark())
41
42typedef struct _WebKitFaviconDatabase        WebKitFaviconDatabase;
43typedef struct _WebKitFaviconDatabaseClass   WebKitFaviconDatabaseClass;
44typedef struct _WebKitFaviconDatabasePrivate WebKitFaviconDatabasePrivate;
45
46struct _WebKitFaviconDatabase {
47    GObject parent;
48
49    WebKitFaviconDatabasePrivate *priv;
50};
51
52struct _WebKitFaviconDatabaseClass {
53    GObjectClass parent_class;
54
55    void (*_webkit_reserved0) (void);
56    void (*_webkit_reserved1) (void);
57    void (*_webkit_reserved2) (void);
58    void (*_webkit_reserved3) (void);
59};
60
61/**
62 * WebKitFaviconDatabaseError:
63 * @WEBKIT_FAVICON_DATABASE_ERROR_NOT_INITIALIZED: The #WebKitFaviconDatabase has not been initialized yet
64 * @WEBKIT_FAVICON_DATABASE_ERROR_FAVICON_NOT_FOUND: There is not an icon available for the requested URL
65 * @WEBKIT_FAVICON_DATABASE_ERROR_FAVICON_UNKNOWN: There might be an icon for the requested URL, but its data is unknown at the moment
66 *
67 * Enum values used to denote the various errors related to the #WebKitFaviconDatabase.
68 **/
69typedef enum {
70    WEBKIT_FAVICON_DATABASE_ERROR_NOT_INITIALIZED,
71    WEBKIT_FAVICON_DATABASE_ERROR_FAVICON_NOT_FOUND,
72    WEBKIT_FAVICON_DATABASE_ERROR_FAVICON_UNKNOWN
73} WebKitFaviconDatabaseError;
74
75WEBKIT_API GQuark
76webkit_favicon_database_error_quark        (void);
77
78WEBKIT_API GType
79webkit_favicon_database_get_type           (void);
80
81WEBKIT_API void
82webkit_favicon_database_get_favicon        (WebKitFaviconDatabase *database,
83                                            const gchar           *page_uri,
84                                            GCancellable          *cancellable,
85                                            GAsyncReadyCallback    callback,
86                                            gpointer               user_data);
87WEBKIT_API cairo_surface_t *
88webkit_favicon_database_get_favicon_finish (WebKitFaviconDatabase *database,
89                                            GAsyncResult          *result,
90                                            GError               **error);
91WEBKIT_API gchar *
92webkit_favicon_database_get_favicon_uri    (WebKitFaviconDatabase *database,
93                                            const gchar           *page_uri);
94WEBKIT_API void
95webkit_favicon_database_clear              (WebKitFaviconDatabase *database);
96
97G_END_DECLS
98
99#endif
100