1/*
2 * Copyright (C) 2007, 2008, 2009 Holger Hans Peter Freyther
3 * Copyright (C) 2008 Jan Michael C. Alonzo
4 * Copyright (C) 2008, 2010 Collabora Ltd.
5 * Copyright (C) 2010 Igalia S.L.
6 *
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version.
11 *
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15 * Library General Public License for more details.
16 *
17 * You should have received a copy of the GNU Library General Public License
18 * along with this library; see the file COPYING.LIB.  If not, write to
19 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20 * Boston, MA 02110-1301, USA.
21 */
22
23#ifndef webkitwebviewprivate_h
24#define webkitwebviewprivate_h
25
26#include "DataObjectGtk.h"
27#include "FullscreenVideoController.h"
28#include "GOwnPtr.h"
29#include "ResourceHandle.h"
30#include <webkit/webkitwebview.h>
31
32namespace WebKit {
33
34WebCore::Page* core(WebKitWebView*);
35WebKitWebView* kit(WebCore::Page*);
36
37
38typedef struct DroppingContext_ {
39    WebKitWebView* webView;
40    GdkDragContext* gdkContext;
41    RefPtr<WebCore::DataObjectGtk> dataObject;
42    WebCore::IntPoint lastMotionPosition;
43    int pendingDataRequests;
44    bool dropHappened;
45} DroppingContext;
46
47}
48
49extern "C" {
50
51#define WEBKIT_WEB_VIEW_GET_PRIVATE(obj)    (G_TYPE_INSTANCE_GET_PRIVATE((obj), WEBKIT_TYPE_WEB_VIEW, WebKitWebViewPrivate))
52typedef struct _WebKitWebViewPrivate WebKitWebViewPrivate;
53struct _WebKitWebViewPrivate {
54    WebCore::Page* corePage;
55    GRefPtr<WebKitWebSettings> webSettings;
56    GRefPtr<WebKitWebInspector> webInspector;
57    GRefPtr<WebKitViewportAttributes> viewportAttributes;
58    GRefPtr<WebKitWebWindowFeatures> webWindowFeatures;
59
60    WebKitWebFrame* mainFrame;
61    GRefPtr<WebKitWebBackForwardList> backForwardList;
62
63    GtkMenu* currentMenu;
64    gint lastPopupXPosition;
65    gint lastPopupYPosition;
66
67    HashSet<GtkWidget*> children;
68    GRefPtr<GtkIMContext> imContext;
69
70    gboolean transparent;
71
72    GRefPtr<GtkAdjustment> horizontalAdjustment;
73    GRefPtr<GtkAdjustment> verticalAdjustment;
74
75#ifndef GTK_API_VERSION_2
76    // GtkScrollablePolicy needs to be checked when
77    // driving the scrollable adjustment values
78    GtkScrollablePolicy horizontalScrollingPolicy;
79    GtkScrollablePolicy verticalScrollingPolicy;
80#endif
81
82    gboolean zoomFullContent;
83    WebKitLoadStatus loadStatus;
84    CString encoding;
85    CString customEncoding;
86
87    CString iconURI;
88
89    gboolean disposing;
90    gboolean usePrimaryForPaste;
91
92#if ENABLE(VIDEO)
93    FullscreenVideoController* fullscreenVideoController;
94#endif
95
96    // These are hosted here because the DataSource object is
97    // created too late in the frame loading process.
98    GRefPtr<WebKitWebResource> mainResource;
99    CString mainResourceIdentifier;
100    GRefPtr<GHashTable> subResources;
101    CString tooltipText;
102    WebCore::IntRect tooltipArea;
103
104    int currentClickCount;
105    WebCore::IntPoint previousClickPoint;
106    guint previousClickButton;
107    guint32 previousClickTime;
108    HashMap<GdkDragContext*, RefPtr<WebCore::DataObjectGtk> > draggingDataObjects;
109    HashMap<GdkDragContext*, WebKit::DroppingContext*> droppingContexts;
110};
111
112void webkit_web_view_notify_ready(WebKitWebView*);
113
114void webkit_web_view_request_download(WebKitWebView*, WebKitNetworkRequest*, const WebCore::ResourceResponse& = WebCore::ResourceResponse(), WebCore::ResourceHandle* = 0);
115
116void webkit_web_view_add_resource(WebKitWebView*, const char*, WebKitWebResource*);
117void webkit_web_view_add_main_resource(WebKitWebView*, const char*, WebKitWebResource*);
118void webkit_web_view_remove_resource(WebKitWebView*, const char*);
119WebKitWebResource* webkit_web_view_get_resource(WebKitWebView*, char*);
120WebKitWebResource* webkit_web_view_get_main_resource(WebKitWebView*);
121void webkit_web_view_clear_resources(WebKitWebView*);
122GList* webkit_web_view_get_subresources(WebKitWebView*);
123
124void webkit_web_view_set_tooltip_text(WebKitWebView*, const char*);
125GtkMenu* webkit_web_view_get_context_menu(WebKitWebView*);
126
127WEBKIT_API gchar* webkit_web_view_get_selected_text(WebKitWebView*);
128bool webkit_web_view_use_primary_for_paste(WebKitWebView*);
129
130void webViewEnterFullscreen(WebKitWebView* webView, WebCore::Node*);
131void webViewExitFullscreen(WebKitWebView* webView);
132
133}
134
135#endif
136