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 "Geolocation.h"
53 #include "HistoryItem.h"
57 #include "InspectorClientGtk.h"
58 #include "FrameLoaderClient.h"
59 #include "ResourceHandle.h"
60 #include "ResourceRequest.h"
61 #include "ResourceResponse.h"
62 #include "WindowFeatures.h"
63 #include "SecurityOrigin.h"
67 #include <libsoup/soup.h>
74 class PasteboardHelperGtk;
76 WebKitWebView* getViewFromFrame(WebKitWebFrame*);
78 WebCore::Frame* core(WebKitWebFrame*);
79 WebKitWebFrame* kit(WebCore::Frame*);
81 WebCore::Page* core(WebKitWebView*);
82 WebKitWebView* kit(WebCore::Page*);
84 WebCore::HistoryItem* core(WebKitWebHistoryItem*);
85 WebKitWebHistoryItem* kit(PassRefPtr<WebCore::HistoryItem>);
87 WebCore::BackForwardList* core(WebKitWebBackForwardList*);
89 WebKitWebNavigationReason kit(WebCore::NavigationType type);
90 WebCore::NavigationType core(WebKitWebNavigationReason reason);
92 WebCore::ResourceRequest core(WebKitNetworkRequest* request);
94 WebCore::ResourceResponse core(WebKitNetworkResponse* response);
96 WebCore::EditingBehavior core(WebKitEditingBehavior type);
98 WebKitSecurityOrigin* kit(WebCore::SecurityOrigin*);
99 WebCore::SecurityOrigin* core(WebKitSecurityOrigin*);
101 WebKitHitTestResult* kit(const WebCore::HitTestResult&);
103 WebKit::PasteboardHelperGtk* pasteboardHelperInstance();
109 #define WEBKIT_PARAM_READABLE ((GParamFlags)(G_PARAM_READABLE|G_PARAM_STATIC_NAME|G_PARAM_STATIC_NICK|G_PARAM_STATIC_BLURB))
110 #define WEBKIT_PARAM_READWRITE ((GParamFlags)(G_PARAM_READWRITE|G_PARAM_STATIC_NAME|G_PARAM_STATIC_NICK|G_PARAM_STATIC_BLURB))
112 #define WEBKIT_WEB_VIEW_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), WEBKIT_TYPE_WEB_VIEW, WebKitWebViewPrivate))
113 typedef struct _WebKitWebViewPrivate WebKitWebViewPrivate;
114 struct _WebKitWebViewPrivate {
115 WebCore::Page* corePage;
116 WebKitWebSettings* webSettings;
117 WebKitWebInspector* webInspector;
118 WebKitWebWindowFeatures* webWindowFeatures;
120 WebKitWebFrame* mainFrame;
121 WebKitWebBackForwardList* backForwardList;
123 GtkMenu* currentMenu;
124 gint lastPopupXPosition;
125 gint lastPopupYPosition;
127 HashSet<GtkWidget*> children;
129 GtkIMContext* imContext;
131 gboolean transparent;
133 GtkAdjustment* horizontalAdjustment;
134 GtkAdjustment* verticalAdjustment;
136 gboolean zoomFullContent;
137 WebKitLoadStatus loadStatus;
139 char* customEncoding;
144 gboolean usePrimaryForPaste;
146 // These are hosted here because the DataSource object is
147 // created too late in the frame loading process.
148 WebKitWebResource* mainResource;
149 char* mainResourceIdentifier;
150 GHashTable* subResources;
154 #define WEBKIT_WEB_FRAME_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), WEBKIT_TYPE_WEB_FRAME, WebKitWebFramePrivate))
155 typedef struct _WebKitWebFramePrivate WebKitWebFramePrivate;
156 struct _WebKitWebFramePrivate {
157 WebCore::Frame* coreFrame;
158 WebKitWebView* webView;
163 WebKitLoadStatus loadStatus;
164 WebKitSecurityOrigin* origin;
167 #define WEBKIT_SECURITY_ORIGIN_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), WEBKIT_TYPE_SECURITY_ORIGIN, WebKitSecurityOriginPrivate))
168 struct _WebKitSecurityOriginPrivate {
169 RefPtr<WebCore::SecurityOrigin> coreOrigin;
172 GHashTable* webDatabases;
177 PassRefPtr<WebCore::Frame>
178 webkit_web_frame_init_with_web_view(WebKitWebView*, WebCore::HTMLFrameOwnerElement*);
181 webkit_web_frame_core_frame_gone(WebKitWebFrame*);
183 // WebKitWebHistoryItem private
184 WebKitWebHistoryItem*
185 webkit_web_history_item_new_with_core_item(PassRefPtr<WebCore::HistoryItem> historyItem);
187 WEBKIT_API G_CONST_RETURN gchar*
188 webkit_web_history_item_get_target(WebKitWebHistoryItem*);
191 webkit_web_history_item_is_target_item(WebKitWebHistoryItem*);
194 webkit_web_history_item_get_children(WebKitWebHistoryItem*);
195 // end WebKitWebHistoryItem private
197 // WebKitWebResource private
198 #define WEBKIT_WEB_RESOURCE_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), WEBKIT_TYPE_WEB_RESOURCE, WebKitWebResourcePrivate))
199 struct _WebKitWebResourcePrivate {
200 WebCore::ArchiveResource* resource;
210 webkit_web_resource_new_with_core_resource(PassRefPtr<WebCore::ArchiveResource>);
213 webkit_web_resource_init_with_core_resource(WebKitWebResource*, PassRefPtr<WebCore::ArchiveResource>);
215 // end WebKitWebResource private
218 webkit_web_inspector_set_inspector_client(WebKitWebInspector*, WebCore::Page*);
221 webkit_web_inspector_set_web_view(WebKitWebInspector *web_inspector, WebKitWebView *web_view);
224 webkit_web_inspector_set_inspected_uri(WebKitWebInspector* web_inspector, const gchar* inspected_uri);
227 webkit_web_inspector_execute_script(WebKitWebInspector* inspector, long callId, const gchar* script);
230 WebKitWebWindowFeatures*
231 webkit_web_window_features_new_from_core_features (const WebCore::WindowFeatures& features);
234 webkit_web_view_notify_ready (WebKitWebView* web_view);
237 webkit_web_view_request_download(WebKitWebView* web_view, WebKitNetworkRequest* request, const WebCore::ResourceResponse& response = WebCore::ResourceResponse(), WebCore::ResourceHandle* handle = 0);
240 webkit_web_view_add_resource(WebKitWebView*, char*, WebKitWebResource*);
243 webkit_web_view_get_resource(WebKitWebView*, char*);
246 webkit_web_view_get_main_resource(WebKitWebView*);
249 webkit_web_view_clear_resources(WebKitWebView*);
252 webkit_web_view_get_subresources(WebKitWebView*);
255 webkit_web_view_set_tooltip_text(WebKitWebView*, const char*);
258 webkit_download_new_with_handle(WebKitNetworkRequest* request, WebCore::ResourceHandle* handle, const WebCore::ResourceResponse& response);
261 webkit_download_set_suggested_filename(WebKitDownload* download, const gchar* suggestedFilename);
263 WebKitWebPolicyDecision*
264 webkit_web_policy_decision_new (WebKitWebFrame*, WebCore::FramePolicyFunction);
267 webkit_web_policy_decision_cancel (WebKitWebPolicyDecision* decision);
269 WebKitNetworkRequest*
270 webkit_network_request_new_with_core_request(const WebCore::ResourceRequest& resourceRequest);
272 WebKitNetworkResponse*
273 webkit_network_response_new_with_core_response(const WebCore::ResourceResponse& resourceResponse);
275 WebKitGeolocationPolicyDecision*
276 webkit_geolocation_policy_decision_new(WebKitWebFrame*, WebCore::Geolocation*);
278 // FIXME: move this to webkitnetworkrequest.h once the API is agreed upon.
279 WEBKIT_API SoupMessage*
280 webkit_network_request_get_message(WebKitNetworkRequest* request);
282 // FIXME: move this functionality into a 'WebKitWebDataSource' once implemented
284 webkit_web_frame_get_response_mime_type(WebKitWebFrame* frame);
286 // FIXME: Move these to webkitwebframe.h once their API has been discussed.
289 webkit_web_frame_get_children (WebKitWebFrame* frame);
292 webkit_web_frame_get_inner_text (WebKitWebFrame* frame);
295 webkit_web_frame_dump_render_tree (WebKitWebFrame* frame);
298 webkit_web_frame_counter_value_for_element_by_id (WebKitWebFrame* frame, const gchar* id);
301 webkit_web_frame_page_number_for_element_by_id(WebKitWebFrame* frame, const gchar* id, float pageWidth, float pageHeight);
304 webkit_web_frame_number_of_pages(WebKitWebFrame* frame, float pageWidth, float pageHeight);
307 webkit_web_frame_get_pending_unload_event_count(WebKitWebFrame* frame);
310 webkit_web_frame_pause_animation(WebKitWebFrame* frame, const gchar* name, double time, const gchar* element);
313 webkit_web_frame_pause_transition(WebKitWebFrame* frame, const gchar* name, double time, const gchar* element);
316 webkit_web_frame_pause_svg_animation(WebKitWebFrame* frame, const gchar* animationId, double time, const gchar* elementId);
318 WEBKIT_API unsigned int
319 webkit_web_frame_number_of_active_animations(WebKitWebFrame* frame);
322 webkit_web_frame_clear_main_frame_name(WebKitWebFrame* frame);
324 WEBKIT_API AtkObject*
325 webkit_web_frame_get_focused_accessible_element(WebKitWebFrame* frame);
328 webkit_web_view_get_selected_text (WebKitWebView* web_view);
331 webkit_web_view_set_group_name(WebKitWebView* web_view, const gchar* group_name);
334 webkit_web_settings_add_extra_plugin_directory (WebKitWebView *web_view, const gchar* directory);
337 webkit_web_settings_get_enchant_dicts(WebKitWebView* web_view);
340 webkit_web_view_use_primary_for_paste(WebKitWebView* web_view);
343 webkit_history_items(void);
346 webkit_gc_collect_javascript_objects();
349 webkit_gc_collect_javascript_objects_on_alternate_thread(gboolean waitUntilDone);
352 webkit_gc_count_javascript_objects();
355 webkit_application_cache_set_maximum_size(unsigned long long size);
357 WEBKIT_API unsigned int
358 webkit_worker_thread_count();
361 webkit_white_list_access_from_origin(const gchar* sourceOrigin, const gchar* destinationProtocol, const gchar* destinationHost, bool allowDestinationSubdomains);
364 webkit_reset_origin_access_white_lists();
366 // WebKitWebDataSource private
368 webkit_web_data_source_new_with_loader(PassRefPtr<WebKit::DocumentLoader>);
370 WEBKIT_API WebKitWebDatabase *
371 webkit_security_origin_get_web_database(WebKitSecurityOrigin* securityOrigin, const char* databaseName);
374 webkit_web_frame_layout(WebKitWebFrame* frame);
378 template <> void freeOwnedGPtr<SoupMessage>(SoupMessage*);
379 template <> void freeOwnedGPtr<WebKitNetworkRequest>(WebKitNetworkRequest*);
380 template <> void freeOwnedGPtr<WebKitNetworkResponse>(WebKitNetworkResponse*);
381 template <> void freeOwnedGPtr<WebKitWebResource>(WebKitWebResource*);