2 * Copyright (C) 2007, 2008, 2009 Holger Hans Peter Freyther
3 * Copyright (C) 2008 Jan Michael C. Alonzo
4 * Copyright (C) 2008 Collabora Ltd.
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library General Public License for more details.
16 * You should have received a copy of the GNU Library General Public License
17 * along with this library; see the file COPYING.LIB. If not, write to
18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 * Boston, MA 02110-1301, USA.
22 #ifndef webkitprivate_h
23 #define webkitprivate_h
26 * This file knows the shared secret of WebKitWebView, WebKitWebFrame,
27 * and WebKitNetworkRequest.
28 * They are using WebCore which musn't be exposed to the outer world.
31 #include <webkit/webkitdefines.h>
32 #include <webkit/webkitdownload.h>
33 #include <webkit/webkithittestresult.h>
34 #include <webkit/webkitnetworkrequest.h>
35 #include <webkit/webkitwebview.h>
36 #include <webkit/webkitwebdatasource.h>
37 #include <webkit/webkitwebframe.h>
38 #include <webkit/webkitwebpolicydecision.h>
39 #include <webkit/webkitwebnavigationaction.h>
40 #include <webkit/webkitwebresource.h>
41 #include <webkit/webkitwebsettings.h>
42 #include <webkit/webkitwebwindowfeatures.h>
43 #include <webkit/webkitwebbackforwardlist.h>
44 #include <webkit/webkitnetworkrequest.h>
45 #include <webkit/webkitsecurityorigin.h>
47 #include "ArchiveResource.h"
48 #include "BackForwardList.h"
52 #include "HistoryItem.h"
56 #include "InspectorClientGtk.h"
57 #include "FrameLoaderClient.h"
58 #include "ResourceHandle.h"
59 #include "ResourceRequest.h"
60 #include "ResourceResponse.h"
61 #include "WindowFeatures.h"
62 #include "SecurityOrigin.h"
66 #include <libsoup/soup.h>
73 class PasteboardHelperGtk;
75 WebKitWebView* getViewFromFrame(WebKitWebFrame*);
77 WebCore::Frame* core(WebKitWebFrame*);
78 WebKitWebFrame* kit(WebCore::Frame*);
80 WebCore::Page* core(WebKitWebView*);
81 WebKitWebView* kit(WebCore::Page*);
83 WebCore::HistoryItem* core(WebKitWebHistoryItem*);
84 WebKitWebHistoryItem* kit(PassRefPtr<WebCore::HistoryItem>);
86 WebCore::BackForwardList* core(WebKitWebBackForwardList*);
88 WebKitWebNavigationReason kit(WebCore::NavigationType type);
89 WebCore::NavigationType core(WebKitWebNavigationReason reason);
91 WebCore::ResourceRequest core(WebKitNetworkRequest* request);
93 WebCore::ResourceResponse core(WebKitNetworkResponse* response);
95 WebCore::EditingBehavior core(WebKitEditingBehavior type);
97 WebKitSecurityOrigin* kit(WebCore::SecurityOrigin*);
98 WebCore::SecurityOrigin* core(WebKitSecurityOrigin*);
100 WebKitHitTestResult* kit(const WebCore::HitTestResult&);
102 WebKit::PasteboardHelperGtk* pasteboardHelperInstance();
108 #define WEBKIT_PARAM_READABLE ((GParamFlags)(G_PARAM_READABLE|G_PARAM_STATIC_NAME|G_PARAM_STATIC_NICK|G_PARAM_STATIC_BLURB))
109 #define WEBKIT_PARAM_READWRITE ((GParamFlags)(G_PARAM_READWRITE|G_PARAM_STATIC_NAME|G_PARAM_STATIC_NICK|G_PARAM_STATIC_BLURB))
111 #define WEBKIT_WEB_VIEW_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), WEBKIT_TYPE_WEB_VIEW, WebKitWebViewPrivate))
112 typedef struct _WebKitWebViewPrivate WebKitWebViewPrivate;
113 struct _WebKitWebViewPrivate {
114 WebCore::Page* corePage;
115 WebKitWebSettings* webSettings;
116 WebKitWebInspector* webInspector;
117 WebKitWebWindowFeatures* webWindowFeatures;
119 WebKitWebFrame* mainFrame;
120 WebKitWebBackForwardList* backForwardList;
122 GtkMenu* currentMenu;
123 gint lastPopupXPosition;
124 gint lastPopupYPosition;
126 HashSet<GtkWidget*> children;
128 GtkIMContext* imContext;
130 gboolean transparent;
132 GtkAdjustment* horizontalAdjustment;
133 GtkAdjustment* verticalAdjustment;
135 gboolean zoomFullContent;
136 WebKitLoadStatus loadStatus;
138 char* customEncoding;
143 gboolean usePrimaryForPaste;
145 // These are hosted here because the DataSource object is
146 // created too late in the frame loading process.
147 WebKitWebResource* mainResource;
148 char* mainResourceIdentifier;
149 GHashTable* subResources;
153 #define WEBKIT_WEB_FRAME_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), WEBKIT_TYPE_WEB_FRAME, WebKitWebFramePrivate))
154 typedef struct _WebKitWebFramePrivate WebKitWebFramePrivate;
155 struct _WebKitWebFramePrivate {
156 WebCore::Frame* coreFrame;
157 WebKitWebView* webView;
162 WebKitLoadStatus loadStatus;
163 WebKitSecurityOrigin* origin;
166 #define WEBKIT_SECURITY_ORIGIN_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), WEBKIT_TYPE_SECURITY_ORIGIN, WebKitSecurityOriginPrivate))
167 struct _WebKitSecurityOriginPrivate {
168 RefPtr<WebCore::SecurityOrigin> coreOrigin;
171 GHashTable* webDatabases;
176 PassRefPtr<WebCore::Frame>
177 webkit_web_frame_init_with_web_view(WebKitWebView*, WebCore::HTMLFrameOwnerElement*);
180 webkit_web_frame_core_frame_gone(WebKitWebFrame*);
182 // WebKitWebHistoryItem private
183 WebKitWebHistoryItem*
184 webkit_web_history_item_new_with_core_item(PassRefPtr<WebCore::HistoryItem> historyItem);
186 WEBKIT_API G_CONST_RETURN gchar*
187 webkit_web_history_item_get_target(WebKitWebHistoryItem*);
190 webkit_web_history_item_is_target_item(WebKitWebHistoryItem*);
193 webkit_web_history_item_get_children(WebKitWebHistoryItem*);
194 // end WebKitWebHistoryItem private
196 // WebKitWebResource private
197 #define WEBKIT_WEB_RESOURCE_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), WEBKIT_TYPE_WEB_RESOURCE, WebKitWebResourcePrivate))
198 struct _WebKitWebResourcePrivate {
199 WebCore::ArchiveResource* resource;
209 webkit_web_resource_new_with_core_resource(PassRefPtr<WebCore::ArchiveResource>);
212 webkit_web_resource_init_with_core_resource(WebKitWebResource*, PassRefPtr<WebCore::ArchiveResource>);
214 // end WebKitWebResource private
217 webkit_web_inspector_set_inspector_client(WebKitWebInspector*, WebCore::Page*);
220 webkit_web_inspector_set_web_view(WebKitWebInspector *web_inspector, WebKitWebView *web_view);
223 webkit_web_inspector_set_inspected_uri(WebKitWebInspector* web_inspector, const gchar* inspected_uri);
226 webkit_web_inspector_execute_script(WebKitWebInspector* inspector, long callId, const gchar* script);
229 WebKitWebWindowFeatures*
230 webkit_web_window_features_new_from_core_features (const WebCore::WindowFeatures& features);
233 webkit_web_view_notify_ready (WebKitWebView* web_view);
236 webkit_web_view_request_download(WebKitWebView* web_view, WebKitNetworkRequest* request, const WebCore::ResourceResponse& response = WebCore::ResourceResponse(), WebCore::ResourceHandle* handle = 0);
239 webkit_web_view_add_resource(WebKitWebView*, char*, WebKitWebResource*);
242 webkit_web_view_get_resource(WebKitWebView*, char*);
245 webkit_web_view_get_main_resource(WebKitWebView*);
248 webkit_web_view_clear_resources(WebKitWebView*);
251 webkit_web_view_get_subresources(WebKitWebView*);
254 webkit_web_view_set_tooltip_text(WebKitWebView*, const char*);
257 webkit_download_new_with_handle(WebKitNetworkRequest* request, WebCore::ResourceHandle* handle, const WebCore::ResourceResponse& response);
260 webkit_download_set_suggested_filename(WebKitDownload* download, const gchar* suggestedFilename);
262 WebKitWebPolicyDecision*
263 webkit_web_policy_decision_new (WebKitWebFrame*, WebCore::FramePolicyFunction);
266 webkit_web_policy_decision_cancel (WebKitWebPolicyDecision* decision);
268 WebKitNetworkRequest*
269 webkit_network_request_new_with_core_request(const WebCore::ResourceRequest& resourceRequest);
271 WebKitNetworkResponse*
272 webkit_network_response_new_with_core_response(const WebCore::ResourceResponse& resourceResponse);
274 // FIXME: move this to webkitnetworkrequest.h once the API is agreed upon.
275 WEBKIT_API SoupMessage*
276 webkit_network_request_get_message(WebKitNetworkRequest* request);
278 // FIXME: move this functionality into a 'WebKitWebDataSource' once implemented
280 webkit_web_frame_get_response_mime_type(WebKitWebFrame* frame);
282 // FIXME: Move these to webkitwebframe.h once their API has been discussed.
285 webkit_web_frame_get_children (WebKitWebFrame* frame);
288 webkit_web_frame_get_inner_text (WebKitWebFrame* frame);
291 webkit_web_frame_dump_render_tree (WebKitWebFrame* frame);
294 webkit_web_frame_counter_value_for_element_by_id (WebKitWebFrame* frame, const gchar* id);
297 webkit_web_frame_page_number_for_element_by_id(WebKitWebFrame* frame, const gchar* id, float pageWidth, float pageHeight);
300 webkit_web_frame_number_of_pages(WebKitWebFrame* frame, float pageWidth, float pageHeight);
303 webkit_web_frame_get_pending_unload_event_count(WebKitWebFrame* frame);
306 webkit_web_frame_pause_animation(WebKitWebFrame* frame, const gchar* name, double time, const gchar* element);
309 webkit_web_frame_pause_transition(WebKitWebFrame* frame, const gchar* name, double time, const gchar* element);
312 webkit_web_frame_pause_svg_animation(WebKitWebFrame* frame, const gchar* animationId, double time, const gchar* elementId);
314 WEBKIT_API unsigned int
315 webkit_web_frame_number_of_active_animations(WebKitWebFrame* frame);
318 webkit_web_frame_clear_main_frame_name(WebKitWebFrame* frame);
320 WEBKIT_API AtkObject*
321 webkit_web_frame_get_focused_accessible_element(WebKitWebFrame* frame);
324 webkit_web_view_get_selected_text (WebKitWebView* web_view);
327 webkit_web_view_set_group_name(WebKitWebView* web_view, const gchar* group_name);
330 webkit_web_settings_add_extra_plugin_directory (WebKitWebView *web_view, const gchar* directory);
333 webkit_web_settings_get_enchant_dicts(WebKitWebView* web_view);
336 webkit_web_view_use_primary_for_paste(WebKitWebView* web_view);
339 webkit_history_items(void);
342 webkit_gc_collect_javascript_objects();
345 webkit_gc_collect_javascript_objects_on_alternate_thread(gboolean waitUntilDone);
348 webkit_gc_count_javascript_objects();
351 webkit_application_cache_set_maximum_size(unsigned long long size);
353 WEBKIT_API unsigned int
354 webkit_worker_thread_count();
357 webkit_white_list_access_from_origin(const gchar* sourceOrigin, const gchar* destinationProtocol, const gchar* destinationHost, bool allowDestinationSubdomains);
360 webkit_reset_origin_access_white_lists();
362 // WebKitWebDataSource private
364 webkit_web_data_source_new_with_loader(PassRefPtr<WebKit::DocumentLoader>);
366 WEBKIT_API WebKitWebDatabase *
367 webkit_security_origin_get_web_database(WebKitSecurityOrigin* securityOrigin, const char* databaseName);
370 webkit_web_frame_layout(WebKitWebFrame* frame);
374 template <> void freeOwnedGPtr<SoupMessage>(SoupMessage*);
375 template <> void freeOwnedGPtr<WebKitNetworkRequest>(WebKitNetworkRequest*);
376 template <> void freeOwnedGPtr<WebKitNetworkResponse>(WebKitNetworkResponse*);
377 template <> void freeOwnedGPtr<WebKitWebResource>(WebKitWebResource*);