1 /* 2 * Copyright (C) 2007, 2008, 2009 Holger Hans Peter Freyther 3 * Copyright (C) 2008 Jan Michael C. Alonzo 4 * Copyright (C) 2008 Collabora Ltd. 5 * 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. 10 * 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. 15 * 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. 20 */ 21 22 #ifndef WEBKIT_PRIVATE_H 23 #define WEBKIT_PRIVATE_H 24 25 /* 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. 29 */ 30 31 #include <webkit/webkitdefines.h> 32 #include <webkit/webkitdownload.h> 33 #include <webkit/webkitnetworkrequest.h> 34 #include <webkit/webkitwebview.h> 35 #include <webkit/webkitwebframe.h> 36 #include <webkit/webkitwebpolicydecision.h> 37 #include <webkit/webkitwebnavigationaction.h> 38 #include <webkit/webkitwebsettings.h> 39 #include <webkit/webkitwebwindowfeatures.h> 40 #include <webkit/webkitwebbackforwardlist.h> 41 #include <webkit/webkitnetworkrequest.h> 42 43 #include "BackForwardList.h" 44 #include <enchant.h> 45 #include "HistoryItem.h" 46 #include "Settings.h" 47 #include "Page.h" 48 #include "Frame.h" 49 #include "InspectorClientGtk.h" 50 #include "FrameLoaderClient.h" 51 #include "ResourceHandle.h" 52 #include "ResourceRequest.h" 53 #include "ResourceResponse.h" 54 #include "WindowFeatures.h" 55 56 #include <atk/atk.h> 57 #include <glib.h> 58 #include <libsoup/soup.h> 59 60 class DownloadClient; 61 62 namespace WebKit { 63 WebKitWebView* getViewFromFrame(WebKitWebFrame*); 64 65 WebCore::Frame* core(WebKitWebFrame*); 66 WebKitWebFrame* kit(WebCore::Frame*); 67 68 WebCore::Page* core(WebKitWebView*); 69 WebKitWebView* kit(WebCore::Page*); 70 71 WebCore::HistoryItem* core(WebKitWebHistoryItem*); 72 WebKitWebHistoryItem* kit(PassRefPtr<WebCore::HistoryItem>); 73 74 WebCore::BackForwardList* core(WebKitWebBackForwardList*); 75 76 WebKitWebNavigationReason kit(WebCore::NavigationType type); 77 WebCore::NavigationType core(WebKitWebNavigationReason reason); 78 79 WebCore::ResourceRequest core(WebKitNetworkRequest* request); 80 } 81 82 typedef struct { 83 EnchantBroker* config; 84 EnchantDict* speller; 85 } SpellLanguage; 86 87 extern "C" { 88 void webkit_init(); 89 90 #define WEBKIT_PARAM_READABLE ((GParamFlags)(G_PARAM_READABLE|G_PARAM_STATIC_NAME|G_PARAM_STATIC_NICK|G_PARAM_STATIC_BLURB)) 91 #define WEBKIT_PARAM_READWRITE ((GParamFlags)(G_PARAM_READWRITE|G_PARAM_STATIC_NAME|G_PARAM_STATIC_NICK|G_PARAM_STATIC_BLURB)) 92 93 #define WEBKIT_WEB_VIEW_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), WEBKIT_TYPE_WEB_VIEW, WebKitWebViewPrivate)) 94 typedef struct _WebKitWebViewPrivate WebKitWebViewPrivate; 95 struct _WebKitWebViewPrivate { 96 WebCore::Page* corePage; 97 WebKitWebSettings* webSettings; 98 WebKitWebInspector* webInspector; 99 WebKitWebWindowFeatures* webWindowFeatures; 100 101 WebKitWebFrame* mainFrame; 102 WebKitWebBackForwardList* backForwardList; 103 104 gint lastPopupXPosition; 105 gint lastPopupYPosition; 106 107 HashSet<GtkWidget*> children; 108 bool editable; 109 GtkIMContext* imContext; 110 111 GtkTargetList* copy_target_list; 112 GtkTargetList* paste_target_list; 113 114 gboolean transparent; 115 116 GtkAdjustment* horizontalAdjustment; 117 GtkAdjustment* verticalAdjustment; 118 119 gboolean zoomFullContent; 120 WebKitLoadStatus loadStatus; 121 char* encoding; 122 char* customEncoding; 123 124 gboolean disposing; 125 gboolean usePrimaryForPaste; 126 }; 127 128 #define WEBKIT_WEB_FRAME_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), WEBKIT_TYPE_WEB_FRAME, WebKitWebFramePrivate)) 129 typedef struct _WebKitWebFramePrivate WebKitWebFramePrivate; 130 struct _WebKitWebFramePrivate { 131 WebCore::Frame* coreFrame; 132 WebKitWebView* webView; 133 134 gchar* name; 135 gchar* title; 136 gchar* uri; 137 WebKitLoadStatus loadStatus; 138 }; 139 140 PassRefPtr<WebCore::Frame> 141 webkit_web_frame_init_with_web_view(WebKitWebView*, WebCore::HTMLFrameOwnerElement*); 142 143 void 144 webkit_web_frame_core_frame_gone(WebKitWebFrame*); 145 146 // WebKitWebHistoryItem private 147 WebKitWebHistoryItem* 148 webkit_web_history_item_new_with_core_item(PassRefPtr<WebCore::HistoryItem> historyItem); 149 150 WEBKIT_API G_CONST_RETURN gchar* 151 webkit_web_history_item_get_target(WebKitWebHistoryItem*); 152 153 WEBKIT_API gboolean 154 webkit_web_history_item_is_target_item(WebKitWebHistoryItem*); 155 156 WEBKIT_API GList* 157 webkit_web_history_item_get_children(WebKitWebHistoryItem*); 158 // end WebKitWebHistoryItem private 159 160 void 161 webkit_web_inspector_set_inspector_client(WebKitWebInspector*, WebCore::Page*); 162 163 void 164 webkit_web_inspector_set_web_view(WebKitWebInspector *web_inspector, WebKitWebView *web_view); 165 166 void 167 webkit_web_inspector_set_inspected_uri(WebKitWebInspector* web_inspector, const gchar* inspected_uri); 168 169 WebKitWebWindowFeatures* 170 webkit_web_window_features_new_from_core_features (const WebCore::WindowFeatures& features); 171 172 void 173 webkit_web_view_notify_ready (WebKitWebView* web_view); 174 175 void 176 webkit_web_view_request_download(WebKitWebView* web_view, WebKitNetworkRequest* request, const WebCore::ResourceResponse& response = WebCore::ResourceResponse()); 177 178 void 179 webkit_download_set_suggested_filename(WebKitDownload* download, const gchar* suggestedFilename); 180 181 WebKitWebPolicyDecision* 182 webkit_web_policy_decision_new (WebKitWebFrame*, WebCore::FramePolicyFunction); 183 184 void 185 webkit_web_policy_decision_cancel (WebKitWebPolicyDecision* decision); 186 187 WebKitNetworkRequest* 188 webkit_network_request_new_with_core_request(const WebCore::ResourceRequest& resourceRequest); 189 190 // FIXME: move this to webkitnetworkrequest.h once the API is agreed upon. 191 WEBKIT_API SoupMessage* 192 webkit_network_request_get_message(WebKitNetworkRequest* request); 193 194 // FIXME: move this functionality into a 'WebKitWebDataSource' once implemented 195 WEBKIT_API gchar* 196 webkit_web_frame_get_response_mime_type(WebKitWebFrame* frame); 197 198 // FIXME: Move these to webkitwebframe.h once their API has been discussed. 199 200 WEBKIT_API GSList* 201 webkit_web_frame_get_children (WebKitWebFrame* frame); 202 203 WEBKIT_API gchar* 204 webkit_web_frame_get_inner_text (WebKitWebFrame* frame); 205 206 WEBKIT_API gchar* 207 webkit_web_frame_dump_render_tree (WebKitWebFrame* frame); 208 209 WEBKIT_API bool 210 webkit_web_frame_pause_animation(WebKitWebFrame* frame, const gchar* name, double time, const gchar* element); 211 212 WEBKIT_API bool 213 webkit_web_frame_pause_transition(WebKitWebFrame* frame, const gchar* name, double time, const gchar* element); 214 215 WEBKIT_API unsigned int 216 webkit_web_frame_number_of_active_animations(WebKitWebFrame* frame); 217 218 WEBKIT_API void 219 webkit_web_frame_clear_main_frame_name(WebKitWebFrame* frame); 220 221 WEBKIT_API AtkObject* 222 webkit_web_frame_get_focused_accessible_element(WebKitWebFrame* frame); 223 224 WEBKIT_API gchar* 225 webkit_web_view_get_selected_text (WebKitWebView* web_view); 226 227 WEBKIT_API void 228 webkit_web_view_set_group_name(WebKitWebView* web_view, const gchar* group_name); 229 230 WEBKIT_API void 231 webkit_web_settings_add_extra_plugin_directory (WebKitWebView *web_view, const gchar* directory); 232 233 GSList* 234 webkit_web_settings_get_spell_languages(WebKitWebView* web_view); 235 236 bool 237 webkit_web_view_use_primary_for_paste(WebKitWebView* web_view); 238 239 GHashTable* 240 webkit_history_items(void); 241 242 WEBKIT_API void 243 webkit_gc_collect_javascript_objects(); 244 245 WEBKIT_API void 246 webkit_gc_collect_javascript_objects_on_alternate_thread(gboolean waitUntilDone); 247 248 WEBKIT_API gsize 249 webkit_gc_count_javascript_objects(); 250 251 WEBKIT_API void 252 webkit_application_cache_set_maximum_size(unsigned long long size); 253 } 254 255 #endif 256