1/*
2 * Copyright (C) 2007 Holger Hans Peter Freyther
3 * Copyright (C) 2007 Alp Toker <alp@atoker.com>
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13 * Library General Public License for more details.
14 *
15 * You should have received a copy of the GNU Library General Public License
16 * along with this library; see the file COPYING.LIB.  If not, write to
17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 * Boston, MA 02110-1301, USA.
19 */
20
21#ifndef webkitwebframe_h
22#define webkitwebframe_h
23
24#include <glib-object.h>
25#include <gtk/gtk.h>
26
27#include <JavaScriptCore/JSBase.h>
28
29#include <webkit/webkitdefines.h>
30#include <webkit/webkitnetworkrequest.h>
31#include <webkit/webkitwebdatasource.h>
32
33G_BEGIN_DECLS
34
35#define WEBKIT_TYPE_WEB_FRAME            (webkit_web_frame_get_type())
36#define WEBKIT_WEB_FRAME(obj)            (G_TYPE_CHECK_INSTANCE_CAST((obj), WEBKIT_TYPE_WEB_FRAME, WebKitWebFrame))
37#define WEBKIT_WEB_FRAME_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST((klass),  WEBKIT_TYPE_WEB_FRAME, WebKitWebFrameClass))
38#define WEBKIT_IS_WEB_FRAME(obj)         (G_TYPE_CHECK_INSTANCE_TYPE((obj), WEBKIT_TYPE_WEB_FRAME))
39#define WEBKIT_IS_WEB_FRAME_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),  WEBKIT_TYPE_WEB_FRAME))
40#define WEBKIT_WEB_FRAME_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS((obj),  WEBKIT_TYPE_WEB_FRAME, WebKitWebFrameClass))
41
42typedef struct _WebKitWebFramePrivate WebKitWebFramePrivate;
43
44struct _WebKitWebFrame {
45    GObject parent_instance;
46
47    /*< private >*/
48    WebKitWebFramePrivate *priv;
49};
50
51struct _WebKitWebFrameClass {
52    GObjectClass parent_class;
53
54    /*< public >*/
55    void (*_webkit_reserved1) (void);
56    void (*_webkit_reserved2) (void);
57    void (*_webkit_reserved3) (void);
58    void (*_webkit_reserved4) (void);
59    void (*_webkit_reserved5) (void);
60    void (*_webkit_reserved6) (void);
61};
62
63/**
64 * WebKitLoadStatus
65 * @WEBKIT_LOAD_PROVISIONAL: No data has been received yet, empty
66 * structures have been allocated to perform the load; the load may
67 * still fail for transport issues such as not being able to resolve a
68 * name, or connect to a port.
69 * @WEBKIT_LOAD_COMMITTED: The first data chunk has arrived, meaning
70 * that the necessary transport requirements are stabilished, and the
71 * load is being performed.
72 * @WEBKIT_LOAD_FIRST_VISUALLY_NON_EMPTY_LAYOUT: The first layout with
73 * actual visible content happened; one or more layouts may have
74 * happened before that caused nothing to be visible on the screen,
75 * because the data available at the time was not significant enough.
76 * @WEBKIT_LOAD_FINISHED: This state means that everything that was
77 * required to display the page has been loaded.
78 * @WEBKIT_LOAD_FAILED: This state means that some error occurred
79 * during the page load that prevented it from being completed. You
80 * can connect to the #WebKitWebView::load-error signal if you want to
81 * know precisely what kind of error occurred.
82 */
83typedef enum {
84    WEBKIT_LOAD_PROVISIONAL,
85    WEBKIT_LOAD_COMMITTED,
86    WEBKIT_LOAD_FINISHED,
87    WEBKIT_LOAD_FIRST_VISUALLY_NON_EMPTY_LAYOUT,
88    WEBKIT_LOAD_FAILED
89} WebKitLoadStatus;
90
91WEBKIT_API GType
92webkit_web_frame_get_type           (void);
93
94#ifndef WEBKIT_DISABLE_DEPRECATED
95WEBKIT_API WebKitWebFrame *
96webkit_web_frame_new                (WebKitWebView        *web_view);
97#endif
98
99WEBKIT_API WebKitWebView *
100webkit_web_frame_get_web_view       (WebKitWebFrame       *frame);
101
102WEBKIT_API G_CONST_RETURN gchar *
103webkit_web_frame_get_name           (WebKitWebFrame       *frame);
104
105WEBKIT_API G_CONST_RETURN gchar *
106webkit_web_frame_get_title          (WebKitWebFrame       *frame);
107
108WEBKIT_API G_CONST_RETURN gchar *
109webkit_web_frame_get_uri            (WebKitWebFrame       *frame);
110
111WEBKIT_API WebKitWebFrame*
112webkit_web_frame_get_parent         (WebKitWebFrame       *frame);
113
114WEBKIT_API void
115webkit_web_frame_load_uri           (WebKitWebFrame       *frame,
116                                     const gchar          *uri);
117
118WEBKIT_API void
119webkit_web_frame_load_string        (WebKitWebFrame       *frame,
120                                     const gchar          *content,
121                                     const gchar          *mime_type,
122                                     const gchar          *encoding,
123                                     const gchar          *base_uri);
124
125WEBKIT_API void
126webkit_web_frame_load_alternate_string (WebKitWebFrame    *frame,
127                                        const gchar       *content,
128                                        const gchar       *base_url,
129                                        const gchar       *unreachable_url);
130
131WEBKIT_API void
132webkit_web_frame_load_request       (WebKitWebFrame       *frame,
133                                     WebKitNetworkRequest *request);
134
135WEBKIT_API void
136webkit_web_frame_stop_loading       (WebKitWebFrame       *frame);
137
138WEBKIT_API void
139webkit_web_frame_reload             (WebKitWebFrame       *frame);
140
141WEBKIT_API WebKitWebFrame *
142webkit_web_frame_find_frame         (WebKitWebFrame       *frame,
143                                     const gchar          *name);
144
145WEBKIT_API JSGlobalContextRef
146webkit_web_frame_get_global_context (WebKitWebFrame       *frame);
147
148WEBKIT_API GtkPrintOperationResult
149webkit_web_frame_print_full         (WebKitWebFrame       *frame,
150                                     GtkPrintOperation    *operation,
151                                     GtkPrintOperationAction action,
152                                     GError              **error);
153
154WEBKIT_API void
155webkit_web_frame_print              (WebKitWebFrame       *frame);
156
157WEBKIT_API WebKitLoadStatus
158webkit_web_frame_get_load_status    (WebKitWebFrame       *frame);
159
160WEBKIT_API GtkPolicyType
161webkit_web_frame_get_horizontal_scrollbar_policy (WebKitWebFrame        *frame);
162
163WEBKIT_API GtkPolicyType
164webkit_web_frame_get_vertical_scrollbar_policy   (WebKitWebFrame        *frame);
165
166WEBKIT_API WebKitWebDataSource *
167webkit_web_frame_get_data_source             (WebKitWebFrame       *frame);
168
169WEBKIT_API WebKitWebDataSource *
170webkit_web_frame_get_provisional_data_source (WebKitWebFrame       *frame);
171
172WEBKIT_API WebKitSecurityOrigin*
173webkit_web_frame_get_security_origin         (WebKitWebFrame       *frame);
174
175WEBKIT_API WebKitNetworkResponse*
176webkit_web_frame_get_network_response        (WebKitWebFrame       *frame);
177
178G_END_DECLS
179
180#endif
181