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#include <JavaScriptCore/JSBase.h>
27#include <webkit/webkitdefines.h>
28#include <webkit/webkitnetworkrequest.h>
29#include <webkit/webkitwebdatasource.h>
30#include <webkitdom/webkitdom.h>
31
32G_BEGIN_DECLS
33
34#define WEBKIT_TYPE_WEB_FRAME            (webkit_web_frame_get_type())
35#define WEBKIT_WEB_FRAME(obj)            (G_TYPE_CHECK_INSTANCE_CAST((obj), WEBKIT_TYPE_WEB_FRAME, WebKitWebFrame))
36#define WEBKIT_WEB_FRAME_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST((klass),  WEBKIT_TYPE_WEB_FRAME, WebKitWebFrameClass))
37#define WEBKIT_IS_WEB_FRAME(obj)         (G_TYPE_CHECK_INSTANCE_TYPE((obj), WEBKIT_TYPE_WEB_FRAME))
38#define WEBKIT_IS_WEB_FRAME_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),  WEBKIT_TYPE_WEB_FRAME))
39#define WEBKIT_WEB_FRAME_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS((obj),  WEBKIT_TYPE_WEB_FRAME, WebKitWebFrameClass))
40
41typedef struct _WebKitWebFramePrivate WebKitWebFramePrivate;
42
43struct _WebKitWebFrame {
44    GObject parent_instance;
45
46    /*< private >*/
47    WebKitWebFramePrivate *priv;
48};
49
50struct _WebKitWebFrameClass {
51    GObjectClass parent_class;
52
53    /*< public >*/
54    void (*_webkit_reserved1) (void);
55    void (*_webkit_reserved2) (void);
56    void (*_webkit_reserved3) (void);
57    void (*_webkit_reserved4) (void);
58    void (*_webkit_reserved5) (void);
59    void (*_webkit_reserved6) (void);
60};
61
62/**
63 * WebKitLoadStatus:
64 * @WEBKIT_LOAD_PROVISIONAL: No data has been received yet, empty
65 * structures have been allocated to perform the load; the load may
66 * still fail for transport issues such as not being able to resolve a
67 * name, or connect to a port.
68 * @WEBKIT_LOAD_COMMITTED: The first data chunk has arrived, meaning
69 * that the necessary transport requirements are stabilished, and the
70 * load is being performed.
71 * @WEBKIT_LOAD_FIRST_VISUALLY_NON_EMPTY_LAYOUT: The first layout with
72 * actual visible content happened; one or more layouts may have
73 * happened before that caused nothing to be visible on the screen,
74 * because the data available at the time was not significant enough.
75 * @WEBKIT_LOAD_FINISHED: This state means that everything that was
76 * required to display the page has been loaded.
77 * @WEBKIT_LOAD_FAILED: This state means that some error occurred
78 * during the page load that prevented it from being completed. You
79 * can connect to the #WebKitWebView::load-error signal if you want to
80 * know precisely what kind of error occurred.
81 */
82typedef enum {
83    WEBKIT_LOAD_PROVISIONAL,
84    WEBKIT_LOAD_COMMITTED,
85    WEBKIT_LOAD_FINISHED,
86    WEBKIT_LOAD_FIRST_VISUALLY_NON_EMPTY_LAYOUT,
87    WEBKIT_LOAD_FAILED
88} WebKitLoadStatus;
89
90WEBKIT_API GType
91webkit_web_frame_get_type           (void);
92
93#ifndef WEBKIT_DISABLE_DEPRECATED
94WEBKIT_API WebKitWebFrame *
95webkit_web_frame_new                (WebKitWebView        *web_view);
96#endif
97
98WEBKIT_API WebKitWebView *
99webkit_web_frame_get_web_view       (WebKitWebFrame       *frame);
100
101WEBKIT_API const gchar *
102webkit_web_frame_get_name           (WebKitWebFrame       *frame);
103
104WEBKIT_API const gchar *
105webkit_web_frame_get_title          (WebKitWebFrame       *frame);
106
107WEBKIT_API const gchar *
108webkit_web_frame_get_uri            (WebKitWebFrame       *frame);
109
110WEBKIT_API WebKitWebFrame*
111webkit_web_frame_get_parent         (WebKitWebFrame       *frame);
112
113WEBKIT_API void
114webkit_web_frame_load_uri           (WebKitWebFrame       *frame,
115                                     const gchar          *uri);
116
117WEBKIT_API void
118webkit_web_frame_load_string        (WebKitWebFrame       *frame,
119                                     const gchar          *content,
120                                     const gchar          *mime_type,
121                                     const gchar          *encoding,
122                                     const gchar          *base_uri);
123
124WEBKIT_API void
125webkit_web_frame_load_alternate_string (WebKitWebFrame    *frame,
126                                        const gchar       *content,
127                                        const gchar       *base_url,
128                                        const gchar       *unreachable_url);
129
130WEBKIT_API void
131webkit_web_frame_load_request       (WebKitWebFrame       *frame,
132                                     WebKitNetworkRequest *request);
133
134WEBKIT_API void
135webkit_web_frame_stop_loading       (WebKitWebFrame       *frame);
136
137WEBKIT_API void
138webkit_web_frame_reload             (WebKitWebFrame       *frame);
139
140WEBKIT_API WebKitWebFrame *
141webkit_web_frame_find_frame         (WebKitWebFrame       *frame,
142                                     const gchar          *name);
143
144WEBKIT_API JSGlobalContextRef
145webkit_web_frame_get_global_context (WebKitWebFrame       *frame);
146
147WEBKIT_API GtkPrintOperationResult
148webkit_web_frame_print_full         (WebKitWebFrame       *frame,
149                                     GtkPrintOperation    *operation,
150                                     GtkPrintOperationAction action,
151                                     GError              **error);
152
153WEBKIT_API void
154webkit_web_frame_print              (WebKitWebFrame       *frame);
155
156WEBKIT_API WebKitLoadStatus
157webkit_web_frame_get_load_status    (WebKitWebFrame       *frame);
158
159WEBKIT_API GtkPolicyType
160webkit_web_frame_get_horizontal_scrollbar_policy (WebKitWebFrame        *frame);
161
162WEBKIT_API GtkPolicyType
163webkit_web_frame_get_vertical_scrollbar_policy   (WebKitWebFrame        *frame);
164
165WEBKIT_API WebKitWebDataSource *
166webkit_web_frame_get_data_source             (WebKitWebFrame       *frame);
167
168WEBKIT_API WebKitWebDataSource *
169webkit_web_frame_get_provisional_data_source (WebKitWebFrame       *frame);
170
171WEBKIT_API WebKitSecurityOrigin*
172webkit_web_frame_get_security_origin         (WebKitWebFrame       *frame);
173
174WEBKIT_API WebKitNetworkResponse*
175webkit_web_frame_get_network_response        (WebKitWebFrame       *frame);
176
177WEBKIT_API void
178webkit_web_frame_replace_selection           (WebKitWebFrame        *frame,
179                                              const char            *text);
180
181WEBKIT_API WebKitDOMRange*
182webkit_web_frame_get_range_for_word_around_caret (WebKitWebFrame    *frame);
183
184WEBKIT_API WebKitDOMDocument*
185webkit_web_frame_get_dom_document            (WebKitWebFrame        *frame);
186
187G_END_DECLS
188
189#endif
190