summaryrefslogtreecommitdiff
path: root/Tools/MiniBrowser
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@digia.com>2012-10-16 14:56:46 +0200
committerSimon Hausmann <simon.hausmann@digia.com>2012-10-16 14:57:30 +0200
commitb297e0fa5c217c9467033b7c8b46891a52870120 (patch)
tree43fc14689295e9e64f2719d05aad94e3049f6cd7 /Tools/MiniBrowser
parent69d517dbfa69903d8593cc1737f0474b21e3251e (diff)
downloadqtwebkit-b297e0fa5c217c9467033b7c8b46891a52870120.tar.gz
Revert "Imported WebKit commit 0dc6cd75e1d4836eaffbb520be96fac4847cc9d2 (http://svn.webkit.org/repository/webkit/trunk@131300)"
This reverts commit 5466563f4b5b6b86523e3f89bb7f77e5b5270c78. Caused OOM issues on some CI machines :(
Diffstat (limited to 'Tools/MiniBrowser')
-rw-r--r--Tools/MiniBrowser/MiniBrowser.xcodeproj/project.pbxproj24
-rw-r--r--Tools/MiniBrowser/efl/CMakeLists.txt9
-rw-r--r--Tools/MiniBrowser/efl/main.c603
-rw-r--r--Tools/MiniBrowser/gtk/BrowserWindow.c37
-rw-r--r--Tools/MiniBrowser/gtk/main.c8
-rw-r--r--Tools/MiniBrowser/mac/AppDelegate.m21
-rw-r--r--Tools/MiniBrowser/mac/BrowserWindowController.h50
-rw-r--r--Tools/MiniBrowser/mac/BrowserWindowController.m762
-rw-r--r--Tools/MiniBrowser/mac/MainMenu.xib279
-rw-r--r--Tools/MiniBrowser/mac/WK1BrowserWindowController.h35
-rw-r--r--Tools/MiniBrowser/mac/WK1BrowserWindowController.m244
-rw-r--r--Tools/MiniBrowser/mac/WK2BrowserWindowController.h36
-rw-r--r--Tools/MiniBrowser/mac/WK2BrowserWindowController.m809
-rw-r--r--Tools/MiniBrowser/qt/MiniBrowser.pro2
-rw-r--r--Tools/MiniBrowser/qt/raw/Target.pri2
15 files changed, 1042 insertions, 1879 deletions
diff --git a/Tools/MiniBrowser/MiniBrowser.xcodeproj/project.pbxproj b/Tools/MiniBrowser/MiniBrowser.xcodeproj/project.pbxproj
index 68dadb51d..0e0cc502e 100644
--- a/Tools/MiniBrowser/MiniBrowser.xcodeproj/project.pbxproj
+++ b/Tools/MiniBrowser/MiniBrowser.xcodeproj/project.pbxproj
@@ -9,14 +9,12 @@
/* Begin PBXBuildFile section */
0F7EB6E3134113C300F4D865 /* WebKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0F7EB6E2134113C300F4D865 /* WebKit.framework */; };
0F7EB879134113F200F4D865 /* WebKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0F7EB6E2134113C300F4D865 /* WebKit.framework */; };
- 0FE643A1161FA8940059E3FF /* BrowserWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = 0FE643A0161FA8940059E3FF /* BrowserWindowController.m */; };
- 0FE643A4161FAC660059E3FF /* WK1BrowserWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = 0FE643A3161FAC660059E3FF /* WK1BrowserWindowController.m */; };
256AC3DA0F4B6AC300CF3369 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 256AC3D90F4B6AC300CF3369 /* AppDelegate.m */; };
51E244FA11EFCE07008228D1 /* MBToolbarItem.m in Sources */ = {isa = PBXBuildFile; fileRef = 51E244F911EFCE07008228D1 /* MBToolbarItem.m */; };
8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */; };
BC20545E11C96C92008F3375 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */; };
BC329487116A92E2008635D0 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = BC329486116A92E2008635D0 /* main.m */; };
- BC329498116A941B008635D0 /* WK2BrowserWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = BC329497116A941B008635D0 /* WK2BrowserWindowController.m */; };
+ BC329498116A941B008635D0 /* BrowserWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = BC329497116A941B008635D0 /* BrowserWindowController.m */; };
BC72B89511E57E07001EB4EA /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 1DDD58150DA1D0A300B32029 /* MainMenu.xib */; };
BC72B89611E57E0F001EB4EA /* BrowserWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = BC3294A2116A9852008635D0 /* BrowserWindow.xib */; };
BC8FB5A8116AA1FE0080D413 /* WebKit2.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BC8FB5A7116AA1FE0080D413 /* WebKit2.framework */; };
@@ -51,10 +49,6 @@
/* Begin PBXFileReference section */
0F7EB6E2134113C300F4D865 /* WebKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = WebKit.framework; sourceTree = BUILT_PRODUCTS_DIR; };
- 0FE6439F161FA8940059E3FF /* BrowserWindowController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = BrowserWindowController.h; path = mac/BrowserWindowController.h; sourceTree = "<group>"; };
- 0FE643A0161FA8940059E3FF /* BrowserWindowController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = BrowserWindowController.m; path = mac/BrowserWindowController.m; sourceTree = "<group>"; };
- 0FE643A2161FAC660059E3FF /* WK1BrowserWindowController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WK1BrowserWindowController.h; path = mac/WK1BrowserWindowController.h; sourceTree = "<group>"; };
- 0FE643A3161FAC660059E3FF /* WK1BrowserWindowController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = WK1BrowserWindowController.m; path = mac/WK1BrowserWindowController.m; sourceTree = "<group>"; };
1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = "<absolute>"; };
1DDD58150DA1D0A300B32029 /* MainMenu.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = MainMenu.xib; path = mac/MainMenu.xib; sourceTree = "<group>"; };
256AC3D80F4B6AC300CF3369 /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AppDelegate.h; path = mac/AppDelegate.h; sourceTree = "<group>"; };
@@ -66,8 +60,8 @@
51E244F911EFCE07008228D1 /* MBToolbarItem.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MBToolbarItem.m; sourceTree = "<group>"; };
8D1107320486CEB800E47090 /* MiniBrowser.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = MiniBrowser.app; sourceTree = BUILT_PRODUCTS_DIR; };
BC329486116A92E2008635D0 /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = main.m; path = mac/main.m; sourceTree = "<group>"; };
- BC329496116A941B008635D0 /* WK2BrowserWindowController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WK2BrowserWindowController.h; path = mac/WK2BrowserWindowController.h; sourceTree = "<group>"; };
- BC329497116A941B008635D0 /* WK2BrowserWindowController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = WK2BrowserWindowController.m; path = mac/WK2BrowserWindowController.m; sourceTree = "<group>"; };
+ BC329496116A941B008635D0 /* BrowserWindowController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = BrowserWindowController.h; path = mac/BrowserWindowController.h; sourceTree = "<group>"; };
+ BC329497116A941B008635D0 /* BrowserWindowController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = BrowserWindowController.m; path = mac/BrowserWindowController.m; sourceTree = "<group>"; };
BC3294A2116A9852008635D0 /* BrowserWindow.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = BrowserWindow.xib; path = mac/BrowserWindow.xib; sourceTree = "<group>"; };
BC72B89711E57E6E001EB4EA /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
BC72B89A11E57E8A001EB4EA /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = mac/Info.plist; sourceTree = "<group>"; };
@@ -111,12 +105,8 @@
BC329486116A92E2008635D0 /* main.m */,
256AC3D80F4B6AC300CF3369 /* AppDelegate.h */,
256AC3D90F4B6AC300CF3369 /* AppDelegate.m */,
- 0FE6439F161FA8940059E3FF /* BrowserWindowController.h */,
- 0FE643A0161FA8940059E3FF /* BrowserWindowController.m */,
- 0FE643A2161FAC660059E3FF /* WK1BrowserWindowController.h */,
- 0FE643A3161FAC660059E3FF /* WK1BrowserWindowController.m */,
- BC329496116A941B008635D0 /* WK2BrowserWindowController.h */,
- BC329497116A941B008635D0 /* WK2BrowserWindowController.m */,
+ BC329496116A941B008635D0 /* BrowserWindowController.h */,
+ BC329497116A941B008635D0 /* BrowserWindowController.m */,
51E244F811EFCE07008228D1 /* MBToolbarItem.h */,
51E244F911EFCE07008228D1 /* MBToolbarItem.m */,
);
@@ -295,10 +285,8 @@
files = (
256AC3DA0F4B6AC300CF3369 /* AppDelegate.m in Sources */,
BC329487116A92E2008635D0 /* main.m in Sources */,
- BC329498116A941B008635D0 /* WK2BrowserWindowController.m in Sources */,
+ BC329498116A941B008635D0 /* BrowserWindowController.m in Sources */,
51E244FA11EFCE07008228D1 /* MBToolbarItem.m in Sources */,
- 0FE643A1161FA8940059E3FF /* BrowserWindowController.m in Sources */,
- 0FE643A4161FAC660059E3FF /* WK1BrowserWindowController.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
diff --git a/Tools/MiniBrowser/efl/CMakeLists.txt b/Tools/MiniBrowser/efl/CMakeLists.txt
index e39d9115c..22295a548 100644
--- a/Tools/MiniBrowser/efl/CMakeLists.txt
+++ b/Tools/MiniBrowser/efl/CMakeLists.txt
@@ -1,6 +1,7 @@
SET(MiniBrowser_DIR "${TOOLS_DIR}/MiniBrowser/efl")
SET(MiniBrowser_SOURCES
+ ${TOOLS_DIR}/EWebLauncher/url_bar.c
${TOOLS_DIR}/EWebLauncher/url_utils.c
${MiniBrowser_DIR}/main.c
)
@@ -11,12 +12,7 @@ SET(MiniBrowser_INCLUDE_DIRECTORIES
${ECORE_EVAS_INCLUDE_DIRS}
${ECORE_FILE_INCLUDE_DIRS}
${EDJE_INCLUDE_DIRS}
- ${EET_INCLUDE_DIRS}
- ${DBUS_INCLUDE_DIRS}
- ${E_DBUS_INCLUDE_DIRS}
- ${EFREET_INCLUDE_DIRS}
${EINA_INCLUDE_DIRS}
- ${ELEMENTARY_INCLUDE_DIRS}
${EVAS_INCLUDE_DIRS}
${TOOLS_DIR}/EWebLauncher
${WEBKIT2_DIR}/UIProcess/API/efl
@@ -34,7 +30,6 @@ SET(MiniBrowser_LIBRARIES
${ECORE_FILE_LIBRARIES}
${EDJE_LIBRARIES}
${EINA_LIBRARIES}
- ${ELEMENTARY_LIBRARIES}
${EVAS_LIBRARIES}
${FONTCONFIG_LIBRARIES}
${LIBSOUP_LIBRARIES}
@@ -58,3 +53,5 @@ INCLUDE_DIRECTORIES(${MiniBrowser_INCLUDE_DIRECTORIES})
ADD_EXECUTABLE(MiniBrowser ${MiniBrowser_SOURCES})
TARGET_LINK_LIBRARIES(MiniBrowser ${MiniBrowser_LIBRARIES})
SET_TARGET_PROPERTIES(MiniBrowser PROPERTIES FOLDER "Tools")
+
+ADD_DEPENDENCIES(MiniBrowser ThemeControl)
diff --git a/Tools/MiniBrowser/efl/main.c b/Tools/MiniBrowser/efl/main.c
index ee03b8857..b44e514a1 100644
--- a/Tools/MiniBrowser/efl/main.c
+++ b/Tools/MiniBrowser/efl/main.c
@@ -18,19 +18,17 @@
*/
#include "EWebKit2.h"
+#include "url_bar.h"
#include "url_utils.h"
#include <Ecore.h>
#include <Ecore_Evas.h>
#include <Eina.h>
-#include <Elementary.h>
#include <Evas.h>
static const int DEFAULT_WIDTH = 800;
static const int DEFAULT_HEIGHT = 600;
static const char DEFAULT_URL[] = "http://www.google.com/";
static const char APP_NAME[] = "EFL MiniBrowser";
-static const int TOOL_BAR_ICON_SIZE = 24;
-static const int TOOL_BAR_BUTTON_SIZE = 32;
#define info(format, args...) \
do { \
@@ -38,24 +36,16 @@ static const int TOOL_BAR_BUTTON_SIZE = 32;
printf(format, ##args); \
} while (0)
-static int verbose = 1;
-static Eina_List *windows = NULL;
-static char *evas_engine_name = NULL;
-static Eina_Bool frame_flattening_enabled = EINA_FALSE;
+static int verbose = 0;
-static Ewk_View_Smart_Class* miniBrowserViewSmartClass()
-{
- static Ewk_View_Smart_Class ewkViewClass = EWK_VIEW_SMART_CLASS_INIT_NAME_VERSION("MiniBrowser_View");
- return &ewkViewClass;
-}
+typedef struct _MiniBrowser {
+ Ecore_Evas *ee;
+ Evas *evas;
+ Evas_Object *browser;
+ Url_Bar *url_bar;
+} MiniBrowser;
-typedef struct _Browser_Window {
- Evas_Object *window;
- Evas_Object *webview;
- Evas_Object *url_bar;
- Evas_Object *back_button;
- Evas_Object *forward_button;
-} Browser_Window;
+MiniBrowser *browser;
static const Ecore_Getopt options = {
"MiniBrowser",
@@ -70,8 +60,6 @@ static const Ecore_Getopt options = {
ECORE_GETOPT_CALLBACK_NOARGS
('E', "list-engines", "list ecore-evas engines.",
ecore_getopt_callback_ecore_evas_list_engines, NULL),
- ECORE_GETOPT_STORE_DEF_BOOL
- ('f', "flattening", "frame flattening.", EINA_FALSE),
ECORE_GETOPT_VERSION
('V', "version"),
ECORE_GETOPT_COPYRIGHT
@@ -82,55 +70,30 @@ static const Ecore_Getopt options = {
}
};
-static Browser_Window *window_create(const char *url);
-
-static Browser_Window *browser_window_find(Evas_Object *window)
+static Eina_Bool main_signal_exit(void *data, int ev_type, void *ev)
{
- Eina_List *l;
- void *data;
-
- if (!window)
- return NULL;
-
- EINA_LIST_FOREACH(windows, l, data) {
- Browser_Window *browser_window = (Browser_Window *)data;
- if (browser_window->window == window)
- return browser_window;
- }
- return NULL;
+ ecore_main_loop_quit();
+ return EINA_TRUE;
}
-static Browser_Window *browser_view_find(Evas_Object *view)
+static void closeWindow(Ecore_Evas *ee)
{
- Eina_List *l;
- void *data;
-
- if (!view)
- return NULL;
-
- EINA_LIST_FOREACH(windows, l, data) {
- Browser_Window *browser_window = (Browser_Window *)data;
- if (browser_window->webview == view)
- return browser_window;
- }
- return NULL;
+ ecore_main_loop_quit();
}
-static void window_free(Browser_Window *window)
+static void on_ecore_evas_resize(Ecore_Evas *ee)
{
- evas_object_del(window->webview);
- /* The elm_win will take care of freeing its children */
- evas_object_del(window->window);
- free(window);
-}
+ Evas_Object *webview;
+ int w, h;
-static void window_close(Browser_Window *window)
-{
- windows = eina_list_remove(windows, window);
- window_free(window);
+ ecore_evas_geometry_get(ee, NULL, NULL, &w, &h);
+
+ /* Resize URL bar */
+ url_bar_width_set(browser->url_bar, w);
- if (!windows)
- elm_exit();
+ webview = evas_object_name_find(ecore_evas_get(ee), "browser");
+ evas_object_move(webview, 0, URL_BAR_HEIGHT);
+ evas_object_resize(webview, w, h - URL_BAR_HEIGHT);
}
static void
@@ -143,8 +106,6 @@ on_key_down(void *data, Evas *e, Evas_Object *obj, void *event_info)
NULL
};
static int currentEncoding = -1;
- Eina_Bool ctrlPressed = evas_key_modifier_is_set(evas_key_modifier_get(e), "Control");
-
if (!strcmp(ev->key, "F1")) {
info("Back (F1) was pressed\n");
if (!ewk_view_back(obj))
@@ -158,53 +119,32 @@ on_key_down(void *data, Evas *e, Evas_Object *obj, void *event_info)
info("Set encoding (F3) pressed. New encoding to %s", encodings[currentEncoding]);
ewk_view_setting_encoding_custom_set(obj, encodings[currentEncoding]);
} else if (!strcmp(ev->key, "F5")) {
- info("Reload (F5) was pressed, reloading.\n");
- ewk_view_reload(obj);
+ info("Reload (F5) was pressed, reloading.\n");
+ ewk_view_reload(obj);
} else if (!strcmp(ev->key, "F6")) {
- info("Stop (F6) was pressed, stop loading.\n");
- ewk_view_stop(obj);
- } else if (!strcmp(ev->key, "n") && ctrlPressed) {
- info("Create new window (Ctrl+n) was pressed.\n");
- Browser_Window *window = window_create(DEFAULT_URL);
- windows = eina_list_append(windows, window);
- } else if (!strcmp(ev->key, "i") && ctrlPressed) {
- info("Show Inspector (Ctrl+i) was pressed.\n");
- ewk_view_inspector_show(obj);
+ info("Stop (F6) was pressed, stop loading.\n");
+ ewk_view_stop(obj);
}
}
static void
-view_focus_set(Browser_Window *window, Eina_Bool focus)
-{
- /* We steal focus away from elm's focus model and start to do things
- * manually here, so elm now has no clue what's up. Tell elm that its
- * toplevel widget is to be unfocused so elm gives up the focus */
- elm_object_focus_set(elm_object_top_widget_get(window->window), EINA_FALSE);
- evas_object_focus_set(window->webview, focus);
-}
-
-static void
-on_mouse_down(void *user_data, Evas *e, Evas_Object *webview, void *event_info)
+on_mouse_down(void *data, Evas *e, Evas_Object *webview, void *event_info)
{
- Browser_Window *window = (Browser_Window *)user_data;
Evas_Event_Mouse_Down *ev = (Evas_Event_Mouse_Down *)event_info;
- /* Clear selection from the URL bar */
- elm_entry_select_none(window->url_bar);
-
if (ev->button == 1)
- view_focus_set(window, EINA_TRUE);
+ evas_object_focus_set(webview, EINA_TRUE);
else if (ev->button == 2)
- view_focus_set(window, !evas_object_focus_get(webview));
+ evas_object_focus_set(webview, !evas_object_focus_get(webview));
}
static void
-title_set(Evas_Object *window, const char *title, int progress)
+title_set(Ecore_Evas *ee, const char *title, int progress)
{
- Eina_Strbuf *buffer;
+ Eina_Strbuf* buffer;
if (!title || !*title) {
- elm_win_title_set(window, APP_NAME);
+ ecore_evas_title_set(ee, APP_NAME);
return;
}
@@ -214,119 +154,53 @@ title_set(Evas_Object *window, const char *title, int progress)
else
eina_strbuf_append_printf(buffer, "%s - %s", title, APP_NAME);
- elm_win_title_set(window, eina_strbuf_string_get(buffer));
+ ecore_evas_title_set(ee, eina_strbuf_string_get(buffer));
eina_strbuf_free(buffer);
}
static void
on_title_changed(void *user_data, Evas_Object *webview, void *event_info)
{
- Browser_Window *window = (Browser_Window *)user_data;
+ MiniBrowser *app = (MiniBrowser *)user_data;
const char *title = (const char *)event_info;
- title_set(window->window, title, 100);
+ title_set(app->ee, title, 100);
}
static void
on_url_changed(void *user_data, Evas_Object *webview, void *event_info)
{
- Browser_Window *window = (Browser_Window *)user_data;
- elm_entry_entry_set(window->url_bar, ewk_view_url_get(window->webview));
-}
-
-static void
-on_back_forward_list_changed(void *user_data, Evas_Object *webview, void *event_info)
-{
- Browser_Window *window = (Browser_Window *)user_data;
-
- /* Update navigation buttons state */
- elm_object_disabled_set(window->back_button, !ewk_view_back_possible(webview));
- elm_object_disabled_set(window->forward_button, !ewk_view_forward_possible(webview));
-}
-
-static void
-on_new_window(void *user_data, Evas_Object *webview, void *event_info)
-{
- Evas_Object **new_view = (Evas_Object **)event_info;
- Browser_Window *window = window_create(NULL);
- *new_view = window->webview;
- windows = eina_list_append(windows, window);
-}
-
-static void
-on_close_window(void *user_data, Evas_Object *webview, void *event_info)
-{
- window_close((Browser_Window *)user_data);
+ MiniBrowser *app = (MiniBrowser *)user_data;
+ url_bar_url_set(app->url_bar, ewk_view_uri_get(app->browser));
}
static void
on_progress(void *user_data, Evas_Object *webview, void *event_info)
{
- Browser_Window *window = (Browser_Window *)user_data;
+ MiniBrowser *app = (MiniBrowser *)user_data;
double progress = *(double *)event_info;
- title_set(window->window, ewk_view_title_get(window->webview), progress * 100);
+ title_set(app->ee, ewk_view_title_get(app->browser), progress * 100);
}
static void
on_error(void *user_data, Evas_Object *webview, void *event_info)
{
Eina_Strbuf* buffer;
- const Ewk_Error *error = (const Ewk_Error *)event_info;
-
- /* This is a cancellation, do not display the error page */
- if (ewk_error_cancellation_get(error))
- return;
+ const Ewk_Web_Error *error = (const Ewk_Web_Error *)event_info;
buffer = eina_strbuf_new();
eina_strbuf_append_printf(buffer, "<html><body><div style=\"color:#ff0000\">ERROR!</div><br><div>Code: %d<br>Description: %s<br>URL: %s</div></body</html>",
- ewk_error_code_get(error), ewk_error_description_get(error), ewk_error_url_get(error));
+ ewk_web_error_code_get(error), ewk_web_error_description_get(error), ewk_web_error_url_get(error));
- ewk_view_html_string_load(webview, eina_strbuf_string_get(buffer), 0, ewk_error_url_get(error));
+ ewk_view_html_string_load(webview, eina_strbuf_string_get(buffer), 0, ewk_web_error_url_get(error));
eina_strbuf_free(buffer);
}
-static void
-on_download_request(void *user_data, Evas_Object *webview, void *event_info)
-{
- Ewk_Download_Job *download = (Ewk_Download_Job *)event_info;
-
- // FIXME: The destination folder should be selected by the user but we set it to '/tmp' for now.
- Eina_Strbuf *destination_path = eina_strbuf_new();
-
- const char *suggested_name = ewk_download_job_suggested_filename_get(download);
- if (suggested_name && *suggested_name)
- eina_strbuf_append_printf(destination_path, "/tmp/%s", suggested_name);
- else {
- // Generate a unique file name since no name was suggested.
- char unique_path[] = "/tmp/downloaded-file.XXXXXX";
- mktemp(unique_path);
- eina_strbuf_append(destination_path, unique_path);
- }
-
- ewk_download_job_destination_set(download, eina_strbuf_string_get(destination_path));
- info("Downloading: %s\n", eina_strbuf_string_get(destination_path));
- eina_strbuf_free(destination_path);
-}
-
-static void
-on_download_finished(void *user_data, Evas_Object *webview, void *event_info)
-{
- Ewk_Download_Job *download = (Ewk_Download_Job *)event_info;
- info("Download finished: %s\n", ewk_download_job_destination_get(download));
-}
-
-static void
-on_download_failed(void *user_data, Evas_Object *webview, void *event_info)
-{
- info("Download failed!\n");
-}
-
static int
quit(Eina_Bool success, const char *msg)
{
ewk_shutdown();
- elm_shutdown();
if (msg)
fputs(msg, (success) ? stdout : stderr);
@@ -337,362 +211,57 @@ quit(Eina_Bool success, const char *msg)
return EXIT_SUCCESS;
}
-static void
-on_url_bar_activated(void *user_data, Evas_Object *url_bar, void *event_info)
-{
- Browser_Window *app_data = (Browser_Window *)user_data;
-
- const char *user_url = elm_entry_entry_get(url_bar);
- char *url = url_from_user_input(user_url);
- ewk_view_url_set(app_data->webview, url);
- free(url);
-
- /* Give focus back to the view */
- view_focus_set(app_data, EINA_TRUE);
-}
-
-static void
-on_url_bar_clicked(void *user_data, Evas_Object *url_bar, void *event_info)
-{
- Browser_Window *app_data = (Browser_Window *)user_data;
-
- /* Grab focus from the view */
- evas_object_focus_set(app_data->webview, EINA_FALSE);
- elm_object_focus_set(url_bar, EINA_TRUE);
-}
-
-static void
-on_back_button_clicked(void *user_data, Evas_Object *back_button, void *event_info)
+static MiniBrowser *browserCreate(const char *url, const char *engine)
{
- Browser_Window *app_data = (Browser_Window *)user_data;
-
- ewk_view_back(app_data->webview);
- /* Update back button state */
- elm_object_disabled_set(back_button, !ewk_view_back_possible(app_data->webview));
-}
+ MiniBrowser *app = malloc(sizeof(MiniBrowser));
-static void
-on_forward_button_clicked(void *user_data, Evas_Object *forward_button, void *event_info)
-{
- Browser_Window *app_data = (Browser_Window *)user_data;
+ app->ee = ecore_evas_new(engine, 0, 0, DEFAULT_WIDTH, DEFAULT_HEIGHT, 0);
+ if (!app->ee)
+ return 0;
- ewk_view_forward(app_data->webview);
- /* Update forward button state */
- elm_object_disabled_set(forward_button, !ewk_view_forward_possible(app_data->webview));
-}
+ ecore_evas_title_set(app->ee, APP_NAME);
+ ecore_evas_callback_resize_set(app->ee, on_ecore_evas_resize);
+ ecore_evas_borderless_set(app->ee, 0);
+ ecore_evas_show(app->ee);
+ ecore_evas_callback_delete_request_set(app->ee, closeWindow);
-static void
-on_refresh_button_clicked(void *user_data, Evas_Object *refresh_button, void *event_info)
-{
- Browser_Window *app_data = (Browser_Window *)user_data;
-
- Evas *evas = evas_object_evas_get(refresh_button);
- Eina_Bool ctrlPressed = evas_key_modifier_is_set(evas_key_modifier_get(evas), "Control");
- if (ctrlPressed) {
- info("Reloading and bypassing cache...\n");
- ewk_view_reload_bypass_cache(app_data->webview);
- } else {
- info("Reloading...\n");
- ewk_view_reload(app_data->webview);
- }
-}
+ app->evas = ecore_evas_get(app->ee);
-static void
-quit_event_loop(void *user_data, Evas_Object *obj, void *event_info)
-{
- ecore_main_loop_quit();
-}
-
-static void
-on_ok_clicked(void *user_data, Evas_Object *obj, void *event_info)
-{
- Eina_Bool *confirmed = (Eina_Bool *)user_data;
- *confirmed = EINA_TRUE;
-
- ecore_main_loop_quit();
-}
-
-static void
-on_javascript_alert(Ewk_View_Smart_Data *smartData, const char *message)
-{
- Browser_Window *window = browser_view_find(smartData->self);
-
- Evas_Object *alert_popup = elm_popup_add(window->window);
- evas_object_size_hint_weight_set(alert_popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- elm_object_text_set(alert_popup, message);
- elm_object_part_text_set(alert_popup, "title,text", "Alert");
-
- /* Popup buttons */
- Evas_Object *button = elm_button_add(alert_popup);
- elm_object_text_set(button, "OK");
- elm_object_part_content_set(alert_popup, "button1", button);
- evas_object_smart_callback_add(button, "clicked", quit_event_loop, NULL);
- evas_object_show(alert_popup);
-
- /* Make modal */
- ecore_main_loop_begin();
-
- evas_object_del(alert_popup);
-}
-
-static Eina_Bool
-on_javascript_confirm(Ewk_View_Smart_Data *smartData, const char *message)
-{
- Browser_Window *window = browser_view_find(smartData->self);
-
- Eina_Bool ok = EINA_FALSE;
-
- Evas_Object *confirm_popup = elm_popup_add(window->window);
- evas_object_size_hint_weight_set(confirm_popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- elm_object_text_set(confirm_popup, message);
- elm_object_part_text_set(confirm_popup, "title,text", "Confirmation");
-
- /* Popup buttons */
- Evas_Object *cancel_button = elm_button_add(confirm_popup);
- elm_object_text_set(cancel_button, "Cancel");
- elm_object_part_content_set(confirm_popup, "button1", cancel_button);
- evas_object_smart_callback_add(cancel_button, "clicked", quit_event_loop, NULL);
- Evas_Object *ok_button = elm_button_add(confirm_popup);
- elm_object_text_set(ok_button, "OK");
- elm_object_part_content_set(confirm_popup, "button2", ok_button);
- evas_object_smart_callback_add(ok_button, "clicked", on_ok_clicked, &ok);
- evas_object_show(confirm_popup);
-
- /* Make modal */
- ecore_main_loop_begin();
-
- evas_object_del(confirm_popup);
-
- return ok;
-}
-
-static const char *
-on_javascript_prompt(Ewk_View_Smart_Data *smartData, const char *message, const char *default_value)
-{
- Browser_Window *window = browser_view_find(smartData->self);
-
- Eina_Bool ok = EINA_FALSE;
-
- Evas_Object *prompt_popup = elm_popup_add(window->window);
- evas_object_size_hint_weight_set(prompt_popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- elm_object_part_text_set(prompt_popup, "title,text", "Prompt");
-
- /* Popup Content */
- Evas_Object *box = elm_box_add(window->window);
- elm_box_padding_set(box, 0, 4);
- evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- evas_object_size_hint_align_set(box, EVAS_HINT_FILL, EVAS_HINT_FILL);
- evas_object_show(box);
-
- Evas_Object *prompt = elm_label_add(window->window);
- elm_object_text_set(prompt, message);
- evas_object_size_hint_weight_set(prompt, EVAS_HINT_EXPAND, 0.0);
- evas_object_size_hint_align_set(prompt, EVAS_HINT_FILL, 0.5);
- elm_box_pack_end(box, prompt);
- evas_object_show(prompt);
-
- Evas_Object *entry = elm_entry_add(window->window);
- elm_entry_scrollable_set(entry, EINA_TRUE);
- elm_entry_single_line_set(entry, EINA_TRUE);
- elm_entry_text_style_user_push(entry, "DEFAULT='font_size=18'");
- elm_entry_entry_set(entry, default_value ? default_value : "");
- evas_object_size_hint_weight_set(entry, EVAS_HINT_EXPAND, 0.0);
- evas_object_size_hint_align_set(entry, EVAS_HINT_FILL, 0.5);
- elm_box_pack_end(box, entry);
- evas_object_show(entry);
-
- elm_object_content_set(prompt_popup, box);
-
- /* Popup buttons */
- Evas_Object *cancel_button = elm_button_add(prompt_popup);
- elm_object_text_set(cancel_button, "Cancel");
- elm_object_part_content_set(prompt_popup, "button1", cancel_button);
- evas_object_smart_callback_add(cancel_button, "clicked", quit_event_loop, NULL);
- Evas_Object *ok_button = elm_button_add(prompt_popup);
- elm_object_text_set(ok_button, "OK");
- elm_object_part_content_set(prompt_popup, "button2", ok_button);
- evas_object_smart_callback_add(ok_button, "clicked", on_ok_clicked, &ok);
- evas_object_show(prompt_popup);
-
- /* Make modal */
- ecore_main_loop_begin();
-
- /* The return string need to be stringshared */
- const char *prompt_text = ok ? eina_stringshare_add(elm_entry_entry_get(entry)) : NULL;
- evas_object_del(prompt_popup);
-
- return prompt_text;
-}
-
-static void
-on_home_button_clicked(void *user_data, Evas_Object *home_button, void *event_info)
-{
- Browser_Window *app_data = (Browser_Window *)user_data;
+ /* Create webview */
+ app->browser = ewk_view_add(app->evas);
+ ewk_view_theme_set(app->browser, THEME_DIR"/default.edj");
+ evas_object_name_set(app->browser, "browser");
- ewk_view_url_set(app_data->webview, DEFAULT_URL);
-}
+ evas_object_smart_callback_add(app->browser, "load,error", on_error, app);
+ evas_object_smart_callback_add(app->browser, "load,progress", on_progress, app);
+ evas_object_smart_callback_add(app->browser, "title,changed", on_title_changed, app);
+ evas_object_smart_callback_add(app->browser, "uri,changed", on_url_changed, app);
-static void
-on_window_deletion(void *user_data, Evas_Object *window, void *event_info)
-{
- window_close(browser_window_find(window));
-}
+ evas_object_event_callback_add(app->browser, EVAS_CALLBACK_KEY_DOWN, on_key_down, app);
+ evas_object_event_callback_add(app->browser, EVAS_CALLBACK_MOUSE_DOWN, on_mouse_down, app);
-static Evas_Object *
-create_toolbar_button(Evas_Object *window, const char *icon_name)
-{
- Evas_Object *button = elm_button_add(window);
+ evas_object_size_hint_weight_set(app->browser, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_move(app->browser, 0, URL_BAR_HEIGHT);
+ evas_object_resize(app->browser, DEFAULT_WIDTH, DEFAULT_HEIGHT - URL_BAR_HEIGHT);
+ evas_object_show(app->browser);
+ evas_object_focus_set(app->browser, EINA_TRUE);
- Evas_Object *icon = elm_icon_add(window);
- elm_icon_standard_set(icon, icon_name);
- evas_object_size_hint_max_set(icon, TOOL_BAR_ICON_SIZE, TOOL_BAR_ICON_SIZE);
- evas_object_color_set(icon, 44, 44, 102, 128);
- evas_object_show(icon);
- elm_object_part_content_set(button, "icon", icon);
- evas_object_size_hint_min_set(button, TOOL_BAR_BUTTON_SIZE, TOOL_BAR_BUTTON_SIZE);
+ app->url_bar = url_bar_add(app->browser, DEFAULT_WIDTH);
- return button;
-}
+ ewk_view_uri_set(app->browser, url);
-static Browser_Window *window_create(const char *url)
-{
- Browser_Window *app_data = malloc(sizeof(Browser_Window));
- if (!app_data) {
- info("ERROR: could not create browser window.\n");
- return NULL;
- }
-
- /* Create window */
- app_data->window = elm_win_add(NULL, "minibrowser-window", ELM_WIN_BASIC);
- elm_win_title_set(app_data->window, APP_NAME);
- evas_object_smart_callback_add(app_data->window, "delete,request", on_window_deletion, &app_data);
-
- /* Create window background */
- Evas_Object *bg = elm_bg_add(app_data->window);
- elm_bg_color_set(bg, 193, 192, 191);
- evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- elm_win_resize_object_add(app_data->window, bg);
- evas_object_show(bg);
-
- /* Create vertical layout */
- Evas_Object *vertical_layout = elm_box_add(app_data->window);
- elm_box_padding_set(vertical_layout, 0, 2);
- evas_object_size_hint_weight_set(vertical_layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- elm_win_resize_object_add(app_data->window, vertical_layout);
- evas_object_show(vertical_layout);
-
- /* Create horizontal layout for top bar */
- Evas_Object *horizontal_layout = elm_box_add(app_data->window);
- elm_box_horizontal_set(horizontal_layout, EINA_TRUE);
- evas_object_size_hint_weight_set(horizontal_layout, EVAS_HINT_EXPAND, 0.0);
- evas_object_size_hint_align_set(horizontal_layout, EVAS_HINT_FILL, 0.0);
- elm_box_pack_end(vertical_layout, horizontal_layout);
- evas_object_show(horizontal_layout);
-
- /* Create Back button */
- app_data->back_button = create_toolbar_button(app_data->window, "arrow_left");
- evas_object_smart_callback_add(app_data->back_button, "clicked", on_back_button_clicked, app_data);
- elm_object_disabled_set(app_data->back_button, EINA_TRUE);
- evas_object_size_hint_weight_set(app_data->back_button, 0.0, EVAS_HINT_EXPAND);
- evas_object_size_hint_align_set(app_data->back_button, 0.0, 0.5);
- elm_box_pack_end(horizontal_layout, app_data->back_button);
- evas_object_show(app_data->back_button);
-
- /* Create Forward button */
- app_data->forward_button = create_toolbar_button(app_data->window, "arrow_right");
- evas_object_smart_callback_add(app_data->forward_button, "clicked", on_forward_button_clicked, app_data);
- elm_object_disabled_set(app_data->forward_button, EINA_TRUE);
- evas_object_size_hint_weight_set(app_data->forward_button, 0.0, EVAS_HINT_EXPAND);
- evas_object_size_hint_align_set(app_data->forward_button, 0.0, 0.5);
- elm_box_pack_end(horizontal_layout, app_data->forward_button);
- evas_object_show(app_data->forward_button);
-
- /* Create URL bar */
- app_data->url_bar = elm_entry_add(app_data->window);
- elm_entry_scrollable_set(app_data->url_bar, EINA_TRUE);
- elm_entry_single_line_set(app_data->url_bar, EINA_TRUE);
- elm_entry_cnp_mode_set(app_data->url_bar, ELM_CNP_MODE_PLAINTEXT);
- elm_entry_text_style_user_push(app_data->url_bar, "DEFAULT='font_size=18'");
- evas_object_smart_callback_add(app_data->url_bar, "activated", on_url_bar_activated, app_data);
- evas_object_smart_callback_add(app_data->url_bar, "clicked", on_url_bar_clicked, app_data);
- evas_object_size_hint_weight_set(app_data->url_bar, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- evas_object_size_hint_align_set(app_data->url_bar, EVAS_HINT_FILL, EVAS_HINT_FILL);
- elm_box_pack_end(horizontal_layout, app_data->url_bar);
- evas_object_show(app_data->url_bar);
-
- /* Create Refresh button */
- Evas_Object *refresh_button = create_toolbar_button(app_data->window, "refresh");
- evas_object_smart_callback_add(refresh_button, "clicked", on_refresh_button_clicked, app_data);
- evas_object_size_hint_weight_set(refresh_button, 0.0, EVAS_HINT_EXPAND);
- evas_object_size_hint_align_set(refresh_button, 1.0, 0.5);
- elm_box_pack_end(horizontal_layout, refresh_button);
- evas_object_show(refresh_button);
-
- /* Create Home button */
- Evas_Object *home_button = create_toolbar_button(app_data->window, "home");
- evas_object_smart_callback_add(home_button, "clicked", on_home_button_clicked, app_data);
- evas_object_size_hint_weight_set(home_button, 0.0, EVAS_HINT_EXPAND);
- evas_object_size_hint_align_set(home_button, 1.0, 0.5);
- elm_box_pack_end(horizontal_layout, home_button);
- evas_object_show(home_button);
-
- /* Create webview */
- Ewk_View_Smart_Class *ewkViewClass = miniBrowserViewSmartClass();
- ewkViewClass->run_javascript_alert = on_javascript_alert;
- ewkViewClass->run_javascript_confirm = on_javascript_confirm;
- ewkViewClass->run_javascript_prompt = on_javascript_prompt;
-
- Evas *evas = evas_object_evas_get(app_data->window);
- Evas_Smart *smart = evas_smart_class_new(&ewkViewClass->sc);
- app_data->webview = ewk_view_smart_add(evas, smart, ewk_context_default_get());
- ewk_view_theme_set(app_data->webview, THEME_DIR "/default.edj");
-
- Ewk_Settings *settings = ewk_view_settings_get(app_data->webview);
- ewk_settings_file_access_from_file_urls_allowed_set(settings, EINA_TRUE);
- ewk_settings_frame_flattening_enabled_set(settings, frame_flattening_enabled);
- ewk_settings_developer_extras_enabled_set(settings, EINA_TRUE);
-
- evas_object_smart_callback_add(app_data->webview, "close,window", on_close_window, app_data);
- evas_object_smart_callback_add(app_data->webview, "create,window", on_new_window, app_data);
- evas_object_smart_callback_add(app_data->webview, "download,failed", on_download_failed, app_data);
- evas_object_smart_callback_add(app_data->webview, "download,finished", on_download_finished, app_data);
- evas_object_smart_callback_add(app_data->webview, "download,request", on_download_request, app_data);
- evas_object_smart_callback_add(app_data->webview, "load,error", on_error, app_data);
- evas_object_smart_callback_add(app_data->webview, "load,progress", on_progress, app_data);
- evas_object_smart_callback_add(app_data->webview, "title,changed", on_title_changed, app_data);
- evas_object_smart_callback_add(app_data->webview, "url,changed", on_url_changed, app_data);
- evas_object_smart_callback_add(app_data->webview, "back,forward,list,changed", on_back_forward_list_changed, app_data);
-
- evas_object_event_callback_add(app_data->webview, EVAS_CALLBACK_KEY_DOWN, on_key_down, app_data);
- evas_object_event_callback_add(app_data->webview, EVAS_CALLBACK_MOUSE_DOWN, on_mouse_down, app_data);
-
- evas_object_size_hint_weight_set(app_data->webview, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- evas_object_size_hint_align_set(app_data->webview, EVAS_HINT_FILL, EVAS_HINT_FILL);
- elm_box_pack_end(vertical_layout, app_data->webview);
- evas_object_show(app_data->webview);
-
- if (url)
- ewk_view_url_set(app_data->webview, url);
-
- evas_object_resize(app_data->window, DEFAULT_WIDTH, DEFAULT_HEIGHT);
- evas_object_show(app_data->window);
-
- view_focus_set(app_data, EINA_TRUE);
-
- return app_data;
+ return app;
}
-EAPI_MAIN int
-elm_main(int argc, char *argv[])
+int main(int argc, char *argv[])
{
int args = 1;
+ char *engine = NULL;
unsigned char quitOption = 0;
- Browser_Window *window;
Ecore_Getopt_Value values[] = {
- ECORE_GETOPT_VALUE_STR(evas_engine_name),
+ ECORE_GETOPT_VALUE_STR(engine),
ECORE_GETOPT_VALUE_BOOL(quitOption),
- ECORE_GETOPT_VALUE_BOOL(frame_flattening_enabled),
ECORE_GETOPT_VALUE_BOOL(quitOption),
ECORE_GETOPT_VALUE_BOOL(quitOption),
ECORE_GETOPT_VALUE_BOOL(quitOption),
@@ -702,8 +271,6 @@ elm_main(int argc, char *argv[])
if (!ewk_init())
return EXIT_FAILURE;
- ewk_view_smart_class_set(miniBrowserViewSmartClass());
-
ecore_app_args_set(argc, (const char **) argv);
args = ecore_getopt_parse(&options, values, argc, argv);
@@ -715,18 +282,22 @@ elm_main(int argc, char *argv[])
if (args < argc) {
char *url = url_from_user_input(argv[args]);
- window = window_create(url);
+ browser = browserCreate(url, engine);
free(url);
} else
- window = window_create(DEFAULT_URL);
+ browser = browserCreate(DEFAULT_URL, engine);
+
+ if (!browser)
+ return quit(EINA_FALSE, "ERROR: could not create browser.\n");
- if (!window)
- return quit(EINA_FALSE, "ERROR: could not create browser window.\n");
+ Ecore_Event_Handler *handle = ecore_event_handler_add(ECORE_EVENT_SIGNAL_EXIT, main_signal_exit, 0);
- windows = eina_list_append(windows, window);
+ ecore_main_loop_begin();
- elm_run();
+ url_bar_del(browser->url_bar);
+ ecore_event_handler_del(handle);
+ ecore_evas_free(browser->ee);
+ free(browser);
return quit(EINA_TRUE, NULL);
}
-ELM_MAIN()
diff --git a/Tools/MiniBrowser/gtk/BrowserWindow.c b/Tools/MiniBrowser/gtk/BrowserWindow.c
index 86b04461d..6ed2ff6a2 100644
--- a/Tools/MiniBrowser/gtk/BrowserWindow.c
+++ b/Tools/MiniBrowser/gtk/BrowserWindow.c
@@ -51,7 +51,6 @@ struct _BrowserWindow {
GtkWidget *settingsDialog;
WebKitWebView *webView;
GtkWidget *downloadsBar;
- GdkPixbuf *favicon;
};
struct _BrowserWindowClass {
@@ -349,33 +348,6 @@ static void webViewZoomLevelChanged(GObject *object, GParamSpec *paramSpec, Brow
browserWindowUpdateZoomActions(window);
}
-static void updateUriEntryIcon(BrowserWindow *window)
-{
- GtkEntry *entry = GTK_ENTRY(window->uriEntry);
- if (window->favicon)
- gtk_entry_set_icon_from_pixbuf(entry, GTK_ENTRY_ICON_PRIMARY, window->favicon);
- else
- gtk_entry_set_icon_from_stock(entry, GTK_ENTRY_ICON_PRIMARY, GTK_STOCK_NEW);
-}
-
-static void faviconChanged(GObject *object, GParamSpec *paramSpec, BrowserWindow *window)
-{
- GdkPixbuf *favicon = NULL;
- cairo_surface_t *surface = webkit_web_view_get_favicon(window->webView);
-
- if (surface) {
- int width = cairo_image_surface_get_width(surface);
- int height = cairo_image_surface_get_height(surface);
- favicon = gdk_pixbuf_get_from_surface(surface, 0, 0, width, height);
- }
-
- if (window->favicon)
- g_object_unref(window->favicon);
- window->favicon = favicon;
-
- updateUriEntryIcon(window);
-}
-
static void zoomInCallback(BrowserWindow *window)
{
gdouble zoomLevel = webkit_web_view_get_zoom_level(window->webView) * zoomStep;
@@ -390,12 +362,6 @@ static void zoomOutCallback(BrowserWindow *window)
static void browserWindowFinalize(GObject *gObject)
{
- BrowserWindow *window = BROWSER_WINDOW(gObject);
- if (window->favicon) {
- g_object_unref(window->favicon);
- window->favicon = NULL;
- }
-
G_OBJECT_CLASS(browser_window_parent_class)->finalize(gObject);
if (g_atomic_int_dec_and_test(&windowCount))
@@ -437,8 +403,6 @@ static void browser_window_init(BrowserWindow *window)
window->uriEntry = gtk_entry_new();
g_signal_connect_swapped(window->uriEntry, "activate", G_CALLBACK(activateUriEntryCallback), (gpointer)window);
- gtk_entry_set_icon_activatable(GTK_ENTRY(window->uriEntry), GTK_ENTRY_ICON_PRIMARY, FALSE);
- updateUriEntryIcon(window);
GtkWidget *toolbar = gtk_toolbar_new();
window->toolbar = toolbar;
@@ -512,7 +476,6 @@ static void browserWindowConstructed(GObject *gObject)
g_signal_connect(window->webView, "permission-request", G_CALLBACK(webViewDecidePermissionRequest), window);
g_signal_connect(window->webView, "mouse-target-changed", G_CALLBACK(webViewMouseTargetChanged), window);
g_signal_connect(window->webView, "notify::zoom-level", G_CALLBACK(webViewZoomLevelChanged), window);
- g_signal_connect(window->webView, "notify::favicon", G_CALLBACK(faviconChanged), window);
g_signal_connect(webkit_web_view_get_context(window->webView), "download-started", G_CALLBACK(downloadStarted), window);
diff --git a/Tools/MiniBrowser/gtk/main.c b/Tools/MiniBrowser/gtk/main.c
index c7367df9c..988e39696 100644
--- a/Tools/MiniBrowser/gtk/main.c
+++ b/Tools/MiniBrowser/gtk/main.c
@@ -207,7 +207,6 @@ int main(int argc, char *argv[])
g_option_context_add_group(context, gtk_get_option_group(TRUE));
WebKitSettings *webkitSettings = webkit_settings_new();
- webkit_settings_set_enable_developer_extras(webkitSettings, TRUE);
if (!addSettingsGroupToContext(context, webkitSettings)) {
g_object_unref(webkitSettings);
webkitSettings = 0;
@@ -223,13 +222,6 @@ int main(int argc, char *argv[])
}
g_option_context_free (context);
-#ifdef WEBKIT_EXEC_PATH
- g_setenv("WEBKIT_INSPECTOR_PATH", WEBKIT_EXEC_PATH "resources/inspector", FALSE);
-#endif /* WEBKIT_EXEC_PATH */
-
- // Enable the favicon database, by specifying the default directory.
- webkit_web_context_set_favicon_database_directory(webkit_web_context_get_default(), NULL);
-
if (uriArguments) {
int i;
diff --git a/Tools/MiniBrowser/mac/AppDelegate.m b/Tools/MiniBrowser/mac/AppDelegate.m
index 3bde3d1f5..285736175 100644
--- a/Tools/MiniBrowser/mac/AppDelegate.m
+++ b/Tools/MiniBrowser/mac/AppDelegate.m
@@ -25,8 +25,7 @@
#import "AppDelegate.h"
-#import "WK1BrowserWindowController.h"
-#import "WK2BrowserWindowController.h"
+#import "BrowserWindowController.h"
#import <WebKit2/WKContextPrivate.h>
#import <WebKit2/WKStringCF.h>
@@ -34,11 +33,6 @@
static NSString *defaultURL = @"http://www.webkit.org/";
-enum {
- WebKit1NewWindowTag = 1,
- WebKit2NewWindowTag = 2
-};
-
@implementation BrowserAppDelegate
void didReceiveMessageFromInjectedBundle(WKContextRef context, WKStringRef messageName, WKTypeRef messageBody, const void *clientInfo)
@@ -158,16 +152,7 @@ static void populateVisitedLinks(WKContextRef context, const void *clientInfo)
- (IBAction)newWindow:(id)sender
{
- BrowserWindowController *controller = nil;
-
- if (![sender respondsToSelector:@selector(tag)] || [sender tag] == WebKit1NewWindowTag)
- controller = [[WK1BrowserWindowController alloc] initWithWindowNibName:@"BrowserWindow"];
- else if ([sender tag] == WebKit2NewWindowTag)
- controller = [[WK2BrowserWindowController alloc] initWithContext:_processContext pageGroup:_pageGroup];
-
- if (!controller)
- return;
-
+ BrowserWindowController *controller = [[BrowserWindowController alloc] initWithContext:_processContext pageGroup:_pageGroup];
[[controller window] makeKeyAndOrderFront:sender];
[_browserWindows addObject:[controller window]];
@@ -232,7 +217,7 @@ static void populateVisitedLinks(WKContextRef context, const void *clientInfo)
BrowserWindowController *controller = [self frontmostBrowserWindowController];
if (!controller) {
- controller = [[WK2BrowserWindowController alloc] initWithContext:_processContext pageGroup:_pageGroup]; // FIXME: add a way to open in WK1 also.
+ controller = [[BrowserWindowController alloc] initWithContext:_processContext pageGroup:_pageGroup];
[[controller window] makeKeyAndOrderFront:self];
}
diff --git a/Tools/MiniBrowser/mac/BrowserWindowController.h b/Tools/MiniBrowser/mac/BrowserWindowController.h
index 7ee89197b..84c9f0afe 100644
--- a/Tools/MiniBrowser/mac/BrowserWindowController.h
+++ b/Tools/MiniBrowser/mac/BrowserWindowController.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2012 Apple Inc. All rights reserved.
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -23,10 +23,22 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
-#import <Cocoa/Cocoa.h>
-
-@protocol BrowserController
-
+@interface BrowserWindowController : NSWindowController {
+ IBOutlet NSProgressIndicator *progressIndicator;
+ IBOutlet NSButton *reloadButton;
+ IBOutlet NSButton *backButton;
+ IBOutlet NSButton *forwardButton;
+ IBOutlet NSToolbar *toolbar;
+ IBOutlet NSTextField *urlText;
+ IBOutlet NSView *containerView;
+
+ IBOutlet NSWindow *findPanelWindow;
+
+ WKContextRef _context;
+ WKPageGroupRef _pageGroup;
+ WKView *_webView;
+ BOOL _zoomTextOnly;
+}
- (IBAction)fetch:(id)sender;
- (IBAction)reload:(id)sender;
- (IBAction)forceRepaint:(id)sender;
@@ -36,6 +48,10 @@
- (IBAction)showHideWebView:(id)sender;
- (IBAction)removeReinsertWebView:(id)sender;
+- (id)initWithContext:(WKContextRef)context pageGroup:(WKPageGroupRef)pageGroup;
+- (void)loadURLString:(NSString *)urlString;
+- (void)applicationTerminating;
+
- (IBAction)zoomIn:(id)sender;
- (IBAction)zoomOut:(id)sender;
- (IBAction)resetZoom:(id)sender;
@@ -51,27 +67,3 @@
- (IBAction)find:(id)sender;
@end
-
-@interface BrowserWindowController : NSWindowController {
- IBOutlet NSProgressIndicator *progressIndicator;
- IBOutlet NSButton *reloadButton;
- IBOutlet NSButton *backButton;
- IBOutlet NSButton *forwardButton;
- IBOutlet NSToolbar *toolbar;
- IBOutlet NSTextField *urlText;
- IBOutlet NSView *containerView;
-
- IBOutlet NSWindow *findPanelWindow;
-
- BOOL _zoomTextOnly;
-}
-
-- (void)loadURLString:(NSString *)urlString;
-- (NSString *)addProtocolIfNecessary:(NSString *)address;
-
-- (void)applicationTerminating;
-
-- (IBAction)openLocation:(id)sender;
-
-@end
-
diff --git a/Tools/MiniBrowser/mac/BrowserWindowController.m b/Tools/MiniBrowser/mac/BrowserWindowController.m
index ba38d2563..0adb7e2d2 100644
--- a/Tools/MiniBrowser/mac/BrowserWindowController.m
+++ b/Tools/MiniBrowser/mac/BrowserWindowController.m
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2012 Apple Inc. All rights reserved.
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -25,45 +25,779 @@
#import "BrowserWindowController.h"
-@interface BrowserWindowController ()
+#import "AppDelegate.h"
+#import <WebKit2/WKPagePrivate.h>
+#import <WebKit2/WKStringCF.h>
+#import <WebKit2/WKURLCF.h>
+#import <WebKit2/WKViewPrivate.h>
+@interface BrowserWindowController ()
+- (void)didStartProgress;
+- (void)didChangeProgress:(double)value;
+- (void)didFinishProgress;
+- (void)didStartProvisionalLoadForFrame:(WKFrameRef)frame;
+- (void)didCommitLoadForFrame:(WKFrameRef)frame;
+- (void)didReceiveServerRedirectForProvisionalLoadForFrame:(WKFrameRef)frame;
+- (void)didFailProvisionalLoadWithErrorForFrame:(WKFrameRef)frame;
+- (void)didFailLoadWithErrorForFrame:(WKFrameRef)frame;
+- (void)didSameDocumentNavigationForFrame:(WKFrameRef)frame;
+- (BOOL)isPaginated;
@end
@implementation BrowserWindowController
-- (id)initWithWindow:(NSWindow *)window
+- (id)initWithContext:(WKContextRef)context pageGroup:(WKPageGroupRef)pageGroup
{
- self = [super initWithWindow:window];
- if (self) {
+ if ((self = [super initWithWindowNibName:@"BrowserWindow"])) {
+ _context = WKRetain(context);
+ _pageGroup = WKRetain(pageGroup);
+ _zoomTextOnly = NO;
}
return self;
}
-- (void)windowDidLoad
+- (void)dealloc
{
- [super windowDidLoad];
+ WKRelease(_context);
+ WKRelease(_pageGroup);
+ [_webView release];
+
+ [super dealloc];
}
-- (IBAction)openLocation:(id)sender
+- (IBAction)fetch:(id)sender
{
- [[self window] makeFirstResponder:urlText];
+ CFURLRef cfURL = CFURLCreateWithString(0, (CFStringRef)[urlText stringValue], 0);
+ if (!cfURL)
+ return;
+
+ WKURLRef url = WKURLCreateWithCFURL(cfURL);
+ CFRelease(cfURL);
+
+ WKPageLoadURL(_webView.pageRef, url);
+ WKRelease(url);
}
-- (void)loadURLString:(NSString *)urlString
+- (IBAction)showHideWebView:(id)sender
+{
+ BOOL hidden = ![_webView isHidden];
+
+ [_webView setHidden:hidden];
+}
+
+- (IBAction)removeReinsertWebView:(id)sender
+{
+ if ([_webView window]) {
+ [_webView retain];
+ [_webView removeFromSuperview];
+ } else {
+ [containerView addSubview:_webView];
+ [_webView release];
+ }
+}
+
+- (BOOL)validateMenuItem:(NSMenuItem *)menuItem
+{
+ SEL action = [menuItem action];
+
+ if (action == @selector(zoomIn:))
+ return [self canZoomIn];
+ if (action == @selector(zoomOut:))
+ return [self canZoomOut];
+ if (action == @selector(resetZoom:))
+ return [self canResetZoom];
+
+ if (action == @selector(showHideWebView:))
+ [menuItem setTitle:[_webView isHidden] ? @"Show Web View" : @"Hide Web View"];
+ else if (action == @selector(removeReinsertWebView:))
+ [menuItem setTitle:[_webView window] ? @"Remove Web View" : @"Insert Web View"];
+ else if (action == @selector(toggleZoomMode:))
+ [menuItem setState:_zoomTextOnly ? NSOnState : NSOffState];
+ else if ([menuItem action] == @selector(togglePaginationMode:))
+ [menuItem setState:[self isPaginated] ? NSOnState : NSOffState];
+
+ return YES;
+}
+
+- (IBAction)reload:(id)sender
+{
+ WKPageReload(_webView.pageRef);
+}
+
+- (IBAction)forceRepaint:(id)sender
+{
+ [_webView setNeedsDisplay:YES];
+}
+
+- (IBAction)goBack:(id)sender
+{
+ WKPageGoBack(_webView.pageRef);
+}
+
+- (IBAction)goForward:(id)sender
+{
+ WKPageGoForward(_webView.pageRef);
+}
+
+- (BOOL)validateUserInterfaceItem:(id <NSValidatedUserInterfaceItem>)item
+{
+ SEL action = [item action];
+
+ if (action == @selector(goBack:))
+ return _webView && WKPageCanGoBack(_webView.pageRef);
+
+ if (action == @selector(goForward:))
+ return _webView && WKPageCanGoForward(_webView.pageRef);
+
+ return YES;
+}
+
+- (void)validateToolbar
+{
+ [toolbar validateVisibleItems];
+}
+
+- (BOOL)windowShouldClose:(id)sender
{
+ LOG(@"windowShouldClose");
+ BOOL canCloseImmediately = WKPageTryClose(_webView.pageRef);
+ return canCloseImmediately;
+}
+
+- (void)windowWillClose:(NSNotification *)notification
+{
+ [(BrowserAppDelegate *)[NSApp delegate] browserWindowWillClose:[self window]];
+ [self autorelease];
}
- (void)applicationTerminating
{
+ // FIXME: Why are we bothering to close the page? This doesn't even prevent LEAK output.
+ WKPageClose(_webView.pageRef);
+}
+
+#define DefaultMinimumZoomFactor (.5)
+#define DefaultMaximumZoomFactor (3.0)
+#define DefaultZoomFactorRatio (1.2)
+
+- (double)currentZoomFactor
+{
+ return _zoomTextOnly ? WKPageGetTextZoomFactor(_webView.pageRef) : WKPageGetPageZoomFactor(_webView.pageRef);
+}
+
+- (void)setCurrentZoomFactor:(double)factor
+{
+ _zoomTextOnly ? WKPageSetTextZoomFactor(_webView.pageRef, factor) : WKPageSetPageZoomFactor(_webView.pageRef, factor);
+}
+
+- (BOOL)canZoomIn
+{
+ return [self currentZoomFactor] * DefaultZoomFactorRatio < DefaultMaximumZoomFactor;
+}
+
+- (void)zoomIn:(id)sender
+{
+ if (![self canZoomIn])
+ return;
+
+ double factor = [self currentZoomFactor] * DefaultZoomFactorRatio;
+ [self setCurrentZoomFactor:factor];
+}
+
+- (BOOL)canZoomOut
+{
+ return [self currentZoomFactor] / DefaultZoomFactorRatio > DefaultMinimumZoomFactor;
+}
+
+- (void)zoomOut:(id)sender
+{
+ if (![self canZoomIn])
+ return;
+
+ double factor = [self currentZoomFactor] / DefaultZoomFactorRatio;
+ [self setCurrentZoomFactor:factor];
+}
+
+- (BOOL)canResetZoom
+{
+ return _zoomTextOnly ? (WKPageGetTextZoomFactor(_webView.pageRef) != 1) : (WKPageGetPageZoomFactor(_webView.pageRef) != 1);
+}
+
+- (void)resetZoom:(id)sender
+{
+ if (![self canResetZoom])
+ return;
+
+ if (_zoomTextOnly)
+ WKPageSetTextZoomFactor(_webView.pageRef, 1);
+ else
+ WKPageSetPageZoomFactor(_webView.pageRef, 1);
+}
+
+- (IBAction)toggleZoomMode:(id)sender
+{
+ if (_zoomTextOnly) {
+ _zoomTextOnly = NO;
+ double currentTextZoom = WKPageGetTextZoomFactor(_webView.pageRef);
+ WKPageSetPageAndTextZoomFactors(_webView.pageRef, currentTextZoom, 1);
+ } else {
+ _zoomTextOnly = YES;
+ double currentPageZoom = WKPageGetPageZoomFactor(_webView.pageRef);
+ WKPageSetPageAndTextZoomFactors(_webView.pageRef, 1, currentPageZoom);
+ }
+}
+
+- (BOOL)isPaginated
+{
+ return WKPageGetPaginationMode(_webView.pageRef) != kWKPaginationModeUnpaginated;
+}
+
+- (IBAction)togglePaginationMode:(id)sender
+{
+ if ([self isPaginated])
+ WKPageSetPaginationMode(_webView.pageRef, kWKPaginationModeUnpaginated);
+ else {
+ WKPageSetPaginationMode(_webView.pageRef, kWKPaginationModeLeftToRight);
+ WKPageSetPageLength(_webView.pageRef, _webView.bounds.size.width / 2);
+ WKPageSetGapBetweenPages(_webView.pageRef, 10);
+ }
+}
+
+- (IBAction)dumpSourceToConsole:(id)sender
+{
+ WKPageGetSourceForFrame_b(_webView.pageRef, WKPageGetMainFrame(_webView.pageRef), ^(WKStringRef result, WKErrorRef error) {
+ CFStringRef cfResult = WKStringCopyCFString(0, result);
+ LOG(@"Main frame source\n \"%@\"", (NSString *)cfResult);
+ CFRelease(cfResult);
+ });
+}
+
+// MARK: Loader Client Callbacks
+
+static void didStartProvisionalLoadForFrame(WKPageRef page, WKFrameRef frame, WKTypeRef userData, const void *clientInfo)
+{
+ [(BrowserWindowController *)clientInfo didStartProvisionalLoadForFrame:frame];
+}
+
+static void didReceiveServerRedirectForProvisionalLoadForFrame(WKPageRef page, WKFrameRef frame, WKTypeRef userData, const void *clientInfo)
+{
+ [(BrowserWindowController *)clientInfo didReceiveServerRedirectForProvisionalLoadForFrame:frame];
+}
+
+static void didFailProvisionalLoadWithErrorForFrame(WKPageRef page, WKFrameRef frame, WKErrorRef error, WKTypeRef userData, const void *clientInfo)
+{
+ [(BrowserWindowController *)clientInfo didFailProvisionalLoadWithErrorForFrame:frame];
+}
+
+static void didCommitLoadForFrame(WKPageRef page, WKFrameRef frame, WKTypeRef userData, const void *clientInfo)
+{
+ [(BrowserWindowController *)clientInfo didCommitLoadForFrame:frame];
+}
+
+static void didFinishDocumentLoadForFrame(WKPageRef page, WKFrameRef frame, WKTypeRef userData, const void *clientInfo)
+{
+ LOG(@"didFinishDocumentLoadForFrame");
+}
+
+static void didFinishLoadForFrame(WKPageRef page, WKFrameRef frame, WKTypeRef userData, const void *clientInfo)
+{
+ LOG(@"didFinishLoadForFrame");
+}
+
+static void didFailLoadWithErrorForFrame(WKPageRef page, WKFrameRef frame, WKErrorRef error, WKTypeRef userData, const void *clientInfo)
+{
+ [(BrowserWindowController *)clientInfo didFailLoadWithErrorForFrame:frame];
+}
+
+static void didSameDocumentNavigationForFrame(WKPageRef page, WKFrameRef frame, WKSameDocumentNavigationType type, WKTypeRef userData, const void *clientInfo)
+{
+ [(BrowserWindowController *)clientInfo didSameDocumentNavigationForFrame:frame];
+}
+
+static void didReceiveTitleForFrame(WKPageRef page, WKStringRef title, WKFrameRef frame, WKTypeRef userData, const void *clientInfo)
+{
+ CFStringRef cfTitle = WKStringCopyCFString(0, title);
+ LOG(@"didReceiveTitleForFrame \"%@\"", (NSString *)cfTitle);
+ CFRelease(cfTitle);
+}
+
+static void didFirstLayoutForFrame(WKPageRef page, WKFrameRef frame, WKTypeRef userData, const void *clientInfo)
+{
+ LOG(@"didFirstLayoutForFrame");
+}
+
+static void didFirstVisuallyNonEmptyLayoutForFrame(WKPageRef page, WKFrameRef frame, WKTypeRef userData, const void *clientInfo)
+{
+ LOG(@"didFirstVisuallyNonEmptyLayoutForFrame");
+}
+
+static void didRemoveFrameFromHierarchy(WKPageRef page, WKFrameRef frame, WKTypeRef userData, const void *clientInfo)
+{
+ LOG(@"didRemoveFrameFromHierarchy");
+}
+
+static void didDisplayInsecureContentForFrame(WKPageRef page, WKFrameRef frame, WKTypeRef userData, const void *clientInfo)
+{
+ LOG(@"didDisplayInsecureContentForFrame");
+}
+
+static void didRunInsecureContentForFrame(WKPageRef page, WKFrameRef frame, WKTypeRef userData, const void *clientInfo)
+{
+ LOG(@"didRunInsecureContentForFrame");
+}
+
+static void didDetectXSSForFrame(WKPageRef page, WKFrameRef frame, WKTypeRef userData, const void *clientInfo)
+{
+ LOG(@"didDetectXSSForFrame");
+}
+
+static void didStartProgress(WKPageRef page, const void *clientInfo)
+{
+ [(BrowserWindowController *)clientInfo didStartProgress];
+}
+
+static void didChangeProgress(WKPageRef page, const void *clientInfo)
+{
+ [(BrowserWindowController *)clientInfo didChangeProgress:WKPageGetEstimatedProgress(page)];
+}
+
+static void didFinishProgress(WKPageRef page, const void *clientInfo)
+{
+ [(BrowserWindowController *)clientInfo didFinishProgress];
+}
+
+static void didBecomeUnresponsive(WKPageRef page, const void *clientInfo)
+{
+ LOG(@"didBecomeUnresponsive");
+}
+
+static void didBecomeResponsive(WKPageRef page, const void *clientInfo)
+{
+ LOG(@"didBecomeResponsive");
+}
+
+static void processDidExit(WKPageRef page, const void *clientInfo)
+{
+ LOG(@"processDidExit");
+}
+
+static void didChangeBackForwardList(WKPageRef page, WKBackForwardListItemRef addedItem, WKArrayRef removedItems, const void *clientInfo)
+{
+ [(BrowserWindowController *)clientInfo validateToolbar];
+}
+
+// MARK: Policy Client Callbacks
+
+static void decidePolicyForNavigationAction(WKPageRef page, WKFrameRef frame, WKFrameNavigationType navigationType, WKEventModifiers modifiers, WKEventMouseButton mouseButton, WKURLRequestRef request, WKFramePolicyListenerRef listener, WKTypeRef userData, const void* clientInfo)
+{
+ LOG(@"decidePolicyForNavigationAction");
+ WKFramePolicyListenerUse(listener);
+}
+
+static void decidePolicyForNewWindowAction(WKPageRef page, WKFrameRef frame, WKFrameNavigationType navigationType, WKEventModifiers modifiers, WKEventMouseButton mouseButton, WKURLRequestRef request, WKStringRef frameName, WKFramePolicyListenerRef listener, WKTypeRef userData, const void* clientInfo)
+{
+ LOG(@"decidePolicyForNewWindowAction");
+ WKFramePolicyListenerUse(listener);
+}
+
+static void decidePolicyForResponse(WKPageRef page, WKFrameRef frame, WKURLResponseRef response, WKURLRequestRef request, WKFramePolicyListenerRef listener, WKTypeRef userData, const void* clientInfo)
+{
+ WKFramePolicyListenerUse(listener);
+}
+
+// MARK: UI Client Callbacks
+
+static WKPageRef createNewPage(WKPageRef page, WKURLRequestRef request, WKDictionaryRef features, WKEventModifiers modifiers, WKEventMouseButton button, const void* clientInfo)
+{
+ LOG(@"createNewPage");
+ BrowserWindowController *controller = [[BrowserWindowController alloc] initWithContext:WKPageGetContext(page) pageGroup:WKPageGetPageGroup(page)];
+ [controller loadWindow];
+
+ return WKRetain(controller->_webView.pageRef);
+}
+
+static void showPage(WKPageRef page, const void *clientInfo)
+{
+ LOG(@"showPage");
+ [[(BrowserWindowController *)clientInfo window] orderFront:nil];
+}
+
+static void closePage(WKPageRef page, const void *clientInfo)
+{
+ LOG(@"closePage");
+ WKPageClose(page);
+ [[(BrowserWindowController *)clientInfo window] close];
+}
+
+static void runJavaScriptAlert(WKPageRef page, WKStringRef message, WKFrameRef frame, const void* clientInfo)
+{
+ NSAlert* alert = [[NSAlert alloc] init];
+
+ WKURLRef wkURL = WKFrameCopyURL(frame);
+ CFURLRef cfURL = WKURLCopyCFURL(0, wkURL);
+ WKRelease(wkURL);
+
+ [alert setMessageText:[NSString stringWithFormat:@"JavaScript alert dialog from %@.", [(NSURL *)cfURL absoluteString]]];
+ CFRelease(cfURL);
+
+ CFStringRef cfMessage = WKStringCopyCFString(0, message);
+ [alert setInformativeText:(NSString *)cfMessage];
+ CFRelease(cfMessage);
+
+ [alert addButtonWithTitle:@"OK"];
+
+ [alert runModal];
+ [alert release];
+}
+
+static bool runJavaScriptConfirm(WKPageRef page, WKStringRef message, WKFrameRef frame, const void* clientInfo)
+{
+ NSAlert* alert = [[NSAlert alloc] init];
+
+ WKURLRef wkURL = WKFrameCopyURL(frame);
+ CFURLRef cfURL = WKURLCopyCFURL(0, wkURL);
+ WKRelease(wkURL);
+
+ [alert setMessageText:[NSString stringWithFormat:@"JavaScript confirm dialog from %@.", [(NSURL *)cfURL absoluteString]]];
+ CFRelease(cfURL);
+
+ CFStringRef cfMessage = WKStringCopyCFString(0, message);
+ [alert setInformativeText:(NSString *)cfMessage];
+ CFRelease(cfMessage);
+
+ [alert addButtonWithTitle:@"OK"];
+ [alert addButtonWithTitle:@"Cancel"];
+
+ NSInteger button = [alert runModal];
+ [alert release];
+
+ return button == NSAlertFirstButtonReturn;
+}
+
+static WKStringRef runJavaScriptPrompt(WKPageRef page, WKStringRef message, WKStringRef defaultValue, WKFrameRef frame, const void* clientInfo)
+{
+ NSAlert* alert = [[NSAlert alloc] init];
+
+ WKURLRef wkURL = WKFrameCopyURL(frame);
+ CFURLRef cfURL = WKURLCopyCFURL(0, wkURL);
+ WKRelease(wkURL);
+
+ [alert setMessageText:[NSString stringWithFormat:@"JavaScript prompt dialog from %@.", [(NSURL *)cfURL absoluteString]]];
+ CFRelease(cfURL);
+
+ CFStringRef cfMessage = WKStringCopyCFString(0, message);
+ [alert setInformativeText:(NSString *)cfMessage];
+ CFRelease(cfMessage);
+
+ [alert addButtonWithTitle:@"OK"];
+ [alert addButtonWithTitle:@"Cancel"];
+
+ NSTextField* input = [[NSTextField alloc] initWithFrame:NSMakeRect(0, 0, 200, 24)];
+ CFStringRef cfDefaultValue = WKStringCopyCFString(0, defaultValue);
+ [input setStringValue:(NSString *)cfDefaultValue];
+ CFRelease(cfDefaultValue);
+
+ [alert setAccessoryView:input];
+
+ NSInteger button = [alert runModal];
+
+ NSString* result = nil;
+ if (button == NSAlertFirstButtonReturn) {
+ [input validateEditing];
+ result = [input stringValue];
+ }
+
+ [alert release];
+
+ if (!result)
+ return 0;
+ return WKStringCreateWithCFString((CFStringRef)result);
+}
+
+static void setStatusText(WKPageRef page, WKStringRef text, const void* clientInfo)
+{
+ LOG(@"setStatusText");
+}
+
+static void mouseDidMoveOverElement(WKPageRef page, WKHitTestResultRef hitTestResult, WKEventModifiers modifiers, WKTypeRef userData, const void *clientInfo)
+{
+ LOG(@"mouseDidMoveOverElement");
+}
+
+static WKRect getWindowFrame(WKPageRef page, const void* clientInfo)
+{
+ NSRect rect = [[(BrowserWindowController *)clientInfo window] frame];
+ WKRect wkRect;
+ wkRect.origin.x = rect.origin.x;
+ wkRect.origin.y = rect.origin.y;
+ wkRect.size.width = rect.size.width;
+ wkRect.size.height = rect.size.height;
+ return wkRect;
+}
+
+static void setWindowFrame(WKPageRef page, WKRect rect, const void* clientInfo)
+{
+ [[(BrowserWindowController *)clientInfo window] setFrame:NSMakeRect(rect.origin.x, rect.origin.y, rect.size.width, rect.size.height) display:YES];
+}
+
+static bool runBeforeUnloadConfirmPanel(WKPageRef page, WKStringRef message, WKFrameRef frame, const void* clientInfo)
+{
+ NSAlert *alert = [[NSAlert alloc] init];
+
+ WKURLRef wkURL = WKFrameCopyURL(frame);
+ CFURLRef cfURL = WKURLCopyCFURL(0, wkURL);
+ WKRelease(wkURL);
+
+ [alert setMessageText:[NSString stringWithFormat:@"BeforeUnload confirm dialog from %@.", [(NSURL *)cfURL absoluteString]]];
+ CFRelease(cfURL);
+
+ CFStringRef cfMessage = WKStringCopyCFString(0, message);
+ [alert setInformativeText:(NSString *)cfMessage];
+ CFRelease(cfMessage);
+
+ [alert addButtonWithTitle:@"OK"];
+ [alert addButtonWithTitle:@"Cancel"];
+
+ NSInteger button = [alert runModal];
+ [alert release];
+
+ return button == NSAlertFirstButtonReturn;
+}
+
+static void runOpenPanel(WKPageRef page, WKFrameRef frame, WKOpenPanelParametersRef parameters, WKOpenPanelResultListenerRef listener, const void* clientInfo)
+{
+ NSOpenPanel *openPanel = [NSOpenPanel openPanel];
+ [openPanel setAllowsMultipleSelection:WKOpenPanelParametersGetAllowsMultipleFiles(parameters)];
+
+ WKRetain(listener);
+
+ [openPanel beginSheetModalForWindow:[(BrowserWindowController *)clientInfo window] completionHandler:^(NSInteger result) {
+ if (result == NSFileHandlingPanelOKButton) {
+ WKMutableArrayRef fileURLs = WKMutableArrayCreate();
+
+ NSURL *nsURL;
+ for (nsURL in [openPanel URLs]) {
+ WKURLRef wkURL = WKURLCreateWithCFURL((CFURLRef)nsURL);
+ WKArrayAppendItem(fileURLs, wkURL);
+ WKRelease(wkURL);
+ }
+
+ WKOpenPanelResultListenerChooseFiles(listener, fileURLs);
+
+ WKRelease(fileURLs);
+ } else
+ WKOpenPanelResultListenerCancel(listener);
+
+ WKRelease(listener);
+ }];
+}
+
+- (void)awakeFromNib
+{
+ _webView = [[WKView alloc] initWithFrame:[containerView bounds] contextRef:_context pageGroupRef:_pageGroup];
+
+ [_webView setAutoresizingMask:(NSViewWidthSizable | NSViewHeightSizable)];
+ [containerView addSubview:_webView];
+
+ WKPageLoaderClient loadClient = {
+ kWKPageLoaderClientCurrentVersion,
+ self, /* clientInfo */
+ didStartProvisionalLoadForFrame,
+ didReceiveServerRedirectForProvisionalLoadForFrame,
+ didFailProvisionalLoadWithErrorForFrame,
+ didCommitLoadForFrame,
+ didFinishDocumentLoadForFrame,
+ didFinishLoadForFrame,
+ didFailLoadWithErrorForFrame,
+ didSameDocumentNavigationForFrame,
+ didReceiveTitleForFrame,
+ didFirstLayoutForFrame,
+ didFirstVisuallyNonEmptyLayoutForFrame,
+ didRemoveFrameFromHierarchy,
+ didDisplayInsecureContentForFrame,
+ didRunInsecureContentForFrame,
+ 0, // canAuthenticateAgainstProtectionSpaceInFrame
+ 0, // didReceiveAuthenticationChallengeInFrame
+ didStartProgress,
+ didChangeProgress,
+ didFinishProgress,
+ didBecomeUnresponsive,
+ didBecomeResponsive,
+ processDidExit,
+ didChangeBackForwardList,
+ 0, // shouldGoToBackForwardItem
+ 0, // didFailToInitializePlugin
+ didDetectXSSForFrame,
+ 0, // didNewFirstVisuallyNonEmptyLayout
+ 0, // willGoToBackForwardListItem
+ 0, // interactionOccurredWhileProcessUnresponsive
+ 0, // pluginDidFail
+ 0, // didReceiveIntentForFrame
+ 0, // registerIntentServiceForFrame
+ 0, // didLayout
+ };
+ WKPageSetPageLoaderClient(_webView.pageRef, &loadClient);
+
+ WKPagePolicyClient policyClient = {
+ kWKPagePolicyClientCurrentVersion,
+ self, /* clientInfo */
+ decidePolicyForNavigationAction,
+ decidePolicyForNewWindowAction,
+ decidePolicyForResponse,
+ 0 /* unableToImplementPolicy */
+ };
+ WKPageSetPagePolicyClient(_webView.pageRef, &policyClient);
+
+ WKPageUIClient uiClient = {
+ kWKPageUIClientCurrentVersion,
+ self, /* clientInfo */
+ 0, /* createNewPage_deprecatedForUseWithV0 */
+ showPage,
+ closePage,
+ 0, /* takeFocus */
+ 0, /* focus */
+ 0, /* unfocus */
+ runJavaScriptAlert,
+ runJavaScriptConfirm,
+ runJavaScriptPrompt,
+ setStatusText,
+ 0, /* mouseDidMoveOverElement_deprecatedForUseWithV0 */
+ 0, /* missingPluginButtonClicked */
+ 0, /* didNotHandleKeyEvent */
+ 0, /* didNotHandleWheelEvent */
+ 0, /* toolbarsAreVisible */
+ 0, /* setToolbarsAreVisible */
+ 0, /* menuBarIsVisible */
+ 0, /* setMenuBarIsVisible */
+ 0, /* statusBarIsVisible */
+ 0, /* setStatusBarIsVisible */
+ 0, /* isResizable */
+ 0, /* setIsResizable */
+ getWindowFrame,
+ setWindowFrame,
+ runBeforeUnloadConfirmPanel,
+ 0, /* didDraw */
+ 0, /* pageDidScroll */
+ 0, /* exceededDatabaseQuota */
+ runOpenPanel,
+ 0, /* decidePolicyForGeolocationPermissionRequest */
+ 0, // headerHeight
+ 0, // footerHeight
+ 0, // drawHeader
+ 0, // drawFooter
+ 0, // printFrame
+ 0, // showModal
+ 0, // didCompleteRubberBandForMainFrame
+ 0, // saveDataToFileInDownloadsFolder
+ 0, // shouldInterruptJavaScript
+ createNewPage,
+ mouseDidMoveOverElement,
+ 0, // decidePolicyForNotificationPermissionRequest
+ 0, // unavailablePluginButtonClicked
+ 0, // showColorPicker
+ 0, // hideColorPicker
+ };
+ WKPageSetPageUIClient(_webView.pageRef, &uiClient);
+}
+
+- (void)didStartProgress
+{
+ [progressIndicator setDoubleValue:0.0];
+ [progressIndicator setHidden:NO];
+}
+
+- (void)didChangeProgress:(double)value
+{
+ [progressIndicator setDoubleValue:value];
+}
+
+- (void)didFinishProgress
+{
+ [progressIndicator setHidden:YES];
+ [progressIndicator setDoubleValue:1.0];
+}
+
+- (void)updateProvisionalURLForFrame:(WKFrameRef)frame
+{
+ static WKURLRef emptyURL = 0;
+ if (!emptyURL)
+ emptyURL = WKURLCreateWithUTF8CString("");
+
+ WKURLRef url = WKFrameCopyProvisionalURL(frame);
+
+ if (!url)
+ return;
+
+ if (WKURLIsEqual(url, emptyURL)) {
+ WKRelease(url);
+ return;
+ }
+
+ CFURLRef cfSourceURL = WKURLCopyCFURL(0, url);
+ WKRelease(url);
+
+ [urlText setStringValue:(NSString*)CFURLGetString(cfSourceURL)];
+ CFRelease(cfSourceURL);
+}
+
+- (void)didStartProvisionalLoadForFrame:(WKFrameRef)frame
+{
+ if (!WKFrameIsMainFrame(frame))
+ return;
+
+ [self updateProvisionalURLForFrame:frame];
+}
+
+- (void)didReceiveServerRedirectForProvisionalLoadForFrame:(WKFrameRef)frame
+{
+ if (!WKFrameIsMainFrame(frame))
+ return;
+
+ [self updateProvisionalURLForFrame:frame];
+}
+
+- (void)didFailProvisionalLoadWithErrorForFrame:(WKFrameRef)frame
+{
+ if (!WKFrameIsMainFrame(frame))
+ return;
+
+ [self updateProvisionalURLForFrame:frame];
+}
+
+- (void)didFailLoadWithErrorForFrame:(WKFrameRef)frame
+{
+ if (!WKFrameIsMainFrame(frame))
+ return;
+
+ [self updateProvisionalURLForFrame:frame];
+}
+
+- (void)didSameDocumentNavigationForFrame:(WKFrameRef)frame
+{
+}
+
+- (void)didCommitLoadForFrame:(WKFrameRef)frame
+{
+}
+
+- (void)loadURLString:(NSString *)urlString
+{
+ // FIXME: We shouldn't have to set the url text here.
+ [urlText setStringValue:urlString];
+ [self fetch:nil];
+}
+
+- (IBAction)performFindPanelAction:(id)sender
+{
+ [findPanelWindow makeKeyAndOrderFront:sender];
}
-- (NSString *)addProtocolIfNecessary:(NSString *)address
+- (IBAction)find:(id)sender
{
- if ([address rangeOfString:@"://"].length > 0)
- return address;
+ WKStringRef string = WKStringCreateWithCFString((CFStringRef)[sender stringValue]);
- return [@"http://" stringByAppendingString:address];
+ WKPageFindString(_webView.pageRef, string, kWKFindOptionsCaseInsensitive | kWKFindOptionsWrapAround | kWKFindOptionsShowFindIndicator | kWKFindOptionsShowOverlay, 100);
}
@end
diff --git a/Tools/MiniBrowser/mac/MainMenu.xib b/Tools/MiniBrowser/mac/MainMenu.xib
index b713a00f5..164dba466 100644
--- a/Tools/MiniBrowser/mac/MainMenu.xib
+++ b/Tools/MiniBrowser/mac/MainMenu.xib
@@ -2,13 +2,13 @@
<archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="7.10">
<data>
<int key="IBDocument.SystemTarget">1080</int>
- <string key="IBDocument.SystemVersion">12C52</string>
- <string key="IBDocument.InterfaceBuilderVersion">4109</string>
- <string key="IBDocument.AppKitVersion">1187.34</string>
- <string key="IBDocument.HIToolboxVersion">625.00</string>
+ <string key="IBDocument.SystemVersion">12A256</string>
+ <string key="IBDocument.InterfaceBuilderVersion">2547</string>
+ <string key="IBDocument.AppKitVersion">1185</string>
+ <string key="IBDocument.HIToolboxVersion">622.00</string>
<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string key="NS.object.0">4109</string>
+ <string key="NS.object.0">2547</string>
</object>
<object class="NSArray" key="IBDocument.IntegratedClassDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -191,34 +191,12 @@
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSMenuItem" id="705341025">
<reference key="NSMenu" ref="720053764"/>
- <string key="NSTitle">Open Location </string>
- <string key="NSKeyEquiv">l</string>
- <int key="NSKeyEquivModMask">1048576</int>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="35465992"/>
- <reference key="NSMixedImage" ref="502551668"/>
- <int key="NSTag">1</int>
- </object>
- <object class="NSMenuItem" id="552626760">
- <reference key="NSMenu" ref="720053764"/>
- <string key="NSTitle">New WebKit1 Window</string>
+ <string key="NSTitle">New Window</string>
<string key="NSKeyEquiv">n</string>
<int key="NSKeyEquivModMask">1048576</int>
<int key="NSMnemonicLoc">2147483647</int>
<reference key="NSOnImage" ref="35465992"/>
<reference key="NSMixedImage" ref="502551668"/>
- <int key="NSTag">1</int>
- </object>
- <object class="NSMenuItem" id="632566413">
- <reference key="NSMenu" ref="720053764"/>
- <bool key="NSIsAlternate">YES</bool>
- <string key="NSTitle">New WebKit2 Window</string>
- <string key="NSKeyEquiv">n</string>
- <int key="NSKeyEquivModMask">1572864</int>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="35465992"/>
- <reference key="NSMixedImage" ref="502551668"/>
- <int key="NSTag">2</int>
</object>
<object class="NSMenuItem" id="722745758">
<reference key="NSMenu" ref="720053764"/>
@@ -1374,6 +1352,14 @@
</object>
<object class="IBConnectionRecord">
<object class="IBActionConnection" key="connection">
+ <string key="label">newWindow:</string>
+ <reference key="source" ref="1014"/>
+ <reference key="destination" ref="705341025"/>
+ </object>
+ <int key="connectionID">533</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBActionConnection" key="connection">
<string key="label">forceRepaint:</string>
<reference key="source" ref="1014"/>
<reference key="destination" ref="878165919"/>
@@ -1444,30 +1430,6 @@
</object>
<int key="connectionID">570</int>
</object>
- <object class="IBConnectionRecord">
- <object class="IBActionConnection" key="connection">
- <string key="label">newWindow:</string>
- <reference key="source" ref="1014"/>
- <reference key="destination" ref="632566413"/>
- </object>
- <int key="connectionID">572</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBActionConnection" key="connection">
- <string key="label">newWindow:</string>
- <reference key="source" ref="1014"/>
- <reference key="destination" ref="552626760"/>
- </object>
- <int key="connectionID">574</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBActionConnection" key="connection">
- <string key="label">openLocation:</string>
- <reference key="source" ref="1014"/>
- <reference key="destination" ref="705341025"/>
- </object>
- <int key="connectionID">575</int>
- </object>
</object>
<object class="IBMutableOrderedSet" key="objectRecords">
<object class="NSArray" key="orderedObjects">
@@ -1565,8 +1527,6 @@
<reference ref="425164168"/>
<reference ref="579971712"/>
<reference ref="1010469920"/>
- <reference ref="632566413"/>
- <reference ref="552626760"/>
</object>
<reference key="parent" ref="379814623"/>
</object>
@@ -2205,16 +2165,6 @@
<reference key="object" ref="15772092"/>
<reference key="parent" ref="865232259"/>
</object>
- <object class="IBObjectRecord">
- <int key="objectID">571</int>
- <reference key="object" ref="632566413"/>
- <reference key="parent" ref="720053764"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">573</int>
- <reference key="object" ref="552626760"/>
- <reference key="parent" ref="720053764"/>
- </object>
</object>
</object>
<object class="NSMutableDictionary" key="flattenedProperties">
@@ -2315,8 +2265,6 @@
<string>568.IBPluginDependency</string>
<string>569.IBPluginDependency</string>
<string>57.IBPluginDependency</string>
- <string>571.IBPluginDependency</string>
- <string>573.IBPluginDependency</string>
<string>58.IBPluginDependency</string>
<string>72.IBPluginDependency</string>
<string>73.IBPluginDependency</string>
@@ -2440,8 +2388,6 @@
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
</object>
</object>
<object class="NSMutableDictionary" key="unlocalizedProperties">
@@ -2456,7 +2402,7 @@
<reference key="dict.values" ref="0"/>
</object>
<nil key="sourceID"/>
- <int key="maxID">575</int>
+ <int key="maxID">570</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
@@ -2473,14 +2419,119 @@
<string key="className">BrowserWindowController</string>
<string key="superclassName">NSWindowController</string>
<object class="NSMutableDictionary" key="actions">
- <string key="NS.key.0">openLocation:</string>
- <string key="NS.object.0">id</string>
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSArray" key="dict.sortedKeys">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>dumpSourceToConsole:</string>
+ <string>fetch:</string>
+ <string>find:</string>
+ <string>forceRepaint:</string>
+ <string>goBack:</string>
+ <string>goForward:</string>
+ <string>reload:</string>
+ <string>removeReinsertWebView:</string>
+ <string>resetZoom:</string>
+ <string>showHideWebView:</string>
+ <string>togglePaginationMode:</string>
+ <string>toggleZoomMode:</string>
+ <string>zoomIn:</string>
+ <string>zoomOut:</string>
+ </object>
+ <object class="NSArray" key="dict.values">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ </object>
</object>
<object class="NSMutableDictionary" key="actionInfosByName">
- <string key="NS.key.0">openLocation:</string>
- <object class="IBActionInfo" key="NS.object.0">
- <string key="name">openLocation:</string>
- <string key="candidateClassName">id</string>
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSArray" key="dict.sortedKeys">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>dumpSourceToConsole:</string>
+ <string>fetch:</string>
+ <string>find:</string>
+ <string>forceRepaint:</string>
+ <string>goBack:</string>
+ <string>goForward:</string>
+ <string>reload:</string>
+ <string>removeReinsertWebView:</string>
+ <string>resetZoom:</string>
+ <string>showHideWebView:</string>
+ <string>togglePaginationMode:</string>
+ <string>toggleZoomMode:</string>
+ <string>zoomIn:</string>
+ <string>zoomOut:</string>
+ </object>
+ <object class="NSArray" key="dict.values">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="IBActionInfo">
+ <string key="name">dumpSourceToConsole:</string>
+ <string key="candidateClassName">id</string>
+ </object>
+ <object class="IBActionInfo">
+ <string key="name">fetch:</string>
+ <string key="candidateClassName">id</string>
+ </object>
+ <object class="IBActionInfo">
+ <string key="name">find:</string>
+ <string key="candidateClassName">id</string>
+ </object>
+ <object class="IBActionInfo">
+ <string key="name">forceRepaint:</string>
+ <string key="candidateClassName">id</string>
+ </object>
+ <object class="IBActionInfo">
+ <string key="name">goBack:</string>
+ <string key="candidateClassName">id</string>
+ </object>
+ <object class="IBActionInfo">
+ <string key="name">goForward:</string>
+ <string key="candidateClassName">id</string>
+ </object>
+ <object class="IBActionInfo">
+ <string key="name">reload:</string>
+ <string key="candidateClassName">id</string>
+ </object>
+ <object class="IBActionInfo">
+ <string key="name">removeReinsertWebView:</string>
+ <string key="candidateClassName">id</string>
+ </object>
+ <object class="IBActionInfo">
+ <string key="name">resetZoom:</string>
+ <string key="candidateClassName">id</string>
+ </object>
+ <object class="IBActionInfo">
+ <string key="name">showHideWebView:</string>
+ <string key="candidateClassName">id</string>
+ </object>
+ <object class="IBActionInfo">
+ <string key="name">togglePaginationMode:</string>
+ <string key="candidateClassName">id</string>
+ </object>
+ <object class="IBActionInfo">
+ <string key="name">toggleZoomMode:</string>
+ <string key="candidateClassName">id</string>
+ </object>
+ <object class="IBActionInfo">
+ <string key="name">zoomIn:</string>
+ <string key="candidateClassName">id</string>
+ </object>
+ <object class="IBActionInfo">
+ <string key="name">zoomOut:</string>
+ <string key="candidateClassName">id</string>
+ </object>
</object>
</object>
<object class="NSMutableDictionary" key="outlets">
@@ -2602,33 +2653,17 @@
</object>
</object>
<object class="IBPartialClassDescription">
- <string key="className">NSDocumentController</string>
- <object class="NSMutableDictionary" key="actions">
- <string key="NS.key.0">_openRecentDocument:</string>
- <string key="NS.object.0">id</string>
- </object>
- <object class="NSMutableDictionary" key="actionInfosByName">
- <string key="NS.key.0">_openRecentDocument:</string>
- <object class="IBActionInfo" key="NS.object.0">
- <string key="name">_openRecentDocument:</string>
- <string key="candidateClassName">id</string>
- </object>
- </object>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBProjectSource</string>
- <string key="minorKey">./Classes/NSDocumentController.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">WebView</string>
+ <string key="className">NSDocument</string>
<object class="NSMutableDictionary" key="actions">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
- <string>reloadFromOrigin:</string>
- <string>resetPageZoom:</string>
- <string>zoomPageIn:</string>
- <string>zoomPageOut:</string>
+ <string>printDocument:</string>
+ <string>revertDocumentToSaved:</string>
+ <string>runPageLayout:</string>
+ <string>saveDocument:</string>
+ <string>saveDocumentAs:</string>
+ <string>saveDocumentTo:</string>
</object>
<object class="NSArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -2636,40 +2671,70 @@
<string>id</string>
<string>id</string>
<string>id</string>
+ <string>id</string>
+ <string>id</string>
</object>
</object>
<object class="NSMutableDictionary" key="actionInfosByName">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
- <string>reloadFromOrigin:</string>
- <string>resetPageZoom:</string>
- <string>zoomPageIn:</string>
- <string>zoomPageOut:</string>
+ <string>printDocument:</string>
+ <string>revertDocumentToSaved:</string>
+ <string>runPageLayout:</string>
+ <string>saveDocument:</string>
+ <string>saveDocumentAs:</string>
+ <string>saveDocumentTo:</string>
</object>
<object class="NSArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBActionInfo">
- <string key="name">reloadFromOrigin:</string>
+ <string key="name">printDocument:</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBActionInfo">
- <string key="name">resetPageZoom:</string>
+ <string key="name">revertDocumentToSaved:</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBActionInfo">
- <string key="name">zoomPageIn:</string>
+ <string key="name">runPageLayout:</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBActionInfo">
- <string key="name">zoomPageOut:</string>
+ <string key="name">saveDocument:</string>
<string key="candidateClassName">id</string>
</object>
+ <object class="IBActionInfo">
+ <string key="name">saveDocumentAs:</string>
+ <string key="candidateClassName">id</string>
+ </object>
+ <object class="IBActionInfo">
+ <string key="name">saveDocumentTo:</string>
+ <string key="candidateClassName">id</string>
+ </object>
+ </object>
+ </object>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBProjectSource</string>
+ <string key="minorKey">./Classes/NSDocument.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">NSDocumentController</string>
+ <object class="NSMutableDictionary" key="actions">
+ <string key="NS.key.0">_openRecentDocument:</string>
+ <string key="NS.object.0">id</string>
+ </object>
+ <object class="NSMutableDictionary" key="actionInfosByName">
+ <string key="NS.key.0">_openRecentDocument:</string>
+ <object class="IBActionInfo" key="NS.object.0">
+ <string key="name">_openRecentDocument:</string>
+ <string key="candidateClassName">id</string>
</object>
</object>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
- <string key="minorKey">./Classes/WebView.h</string>
+ <string key="minorKey">./Classes/NSDocumentController.h</string>
</object>
</object>
</object>
diff --git a/Tools/MiniBrowser/mac/WK1BrowserWindowController.h b/Tools/MiniBrowser/mac/WK1BrowserWindowController.h
deleted file mode 100644
index fdae2ca27..000000000
--- a/Tools/MiniBrowser/mac/WK1BrowserWindowController.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright (C) 2010 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#import "BrowserWindowController.h"
-
-@class WebView;
-
-@interface WK1BrowserWindowController : BrowserWindowController<BrowserController> {
- WebView *_webView;
-}
-
-
-@end
diff --git a/Tools/MiniBrowser/mac/WK1BrowserWindowController.m b/Tools/MiniBrowser/mac/WK1BrowserWindowController.m
deleted file mode 100644
index 6ec612ffb..000000000
--- a/Tools/MiniBrowser/mac/WK1BrowserWindowController.m
+++ /dev/null
@@ -1,244 +0,0 @@
-/*
- * Copyright (C) 2010 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#import "WK1BrowserWindowController.h"
-
-#import <WebKit/WebKit.h>
-#import "AppDelegate.h"
-
-@interface WK1BrowserWindowController ()
-@end
-
-@implementation WK1BrowserWindowController
-
-- (void)awakeFromNib
-{
- _webView = [[WebView alloc] initWithFrame:[containerView bounds]];
- [_webView setAutoresizingMask:(NSViewWidthSizable | NSViewHeightSizable)];
-
- // Set the WebView delegates
- [_webView setFrameLoadDelegate:self];
- [_webView setUIDelegate:self];
- [_webView setResourceLoadDelegate:self];
-
- [containerView addSubview:_webView];
-}
-
-- (void)dealloc
-{
- [_webView release];
-
- [super dealloc];
-}
-
-- (void)loadURLString:(NSString *)urlString
-{
- // FIXME: We shouldn't have to set the url text here.
- [urlText setStringValue:urlString];
- [self fetch:nil];
-}
-
-- (IBAction)fetch:(id)sender
-{
- [urlText setStringValue:[self addProtocolIfNecessary:[urlText stringValue]]];
- NSURL *url = [NSURL URLWithString:[urlText stringValue]];
- [[_webView mainFrame] loadRequest:[NSURLRequest requestWithURL:url]];
-}
-
-- (IBAction)showHideWebView:(id)sender
-{
- BOOL hidden = ![_webView isHidden];
-
- [_webView setHidden:hidden];
-}
-
-- (IBAction)removeReinsertWebView:(id)sender
-{
- if ([_webView window]) {
- [_webView retain];
- [_webView removeFromSuperview];
- } else {
- [containerView addSubview:_webView];
- [_webView release];
- }
-}
-
-- (IBAction)reload:(id)sender
-{
- [_webView reload:sender];
-}
-
-- (IBAction)forceRepaint:(id)sender
-{
- [_webView setNeedsDisplay:YES];
-}
-
-- (IBAction)goBack:(id)sender
-{
- [_webView goBack:sender];
-}
-
-- (IBAction)goForward:(id)sender
-{
- [_webView goForward:sender];
-}
-
-- (BOOL)isPaginated
-{
- return NO;
-}
-
-- (BOOL)validateMenuItem:(NSMenuItem *)menuItem
-{
- SEL action = [menuItem action];
-
- if (action == @selector(zoomIn:))
- return [self canZoomIn];
- if (action == @selector(zoomOut:))
- return [self canZoomOut];
- if (action == @selector(resetZoom:))
- return [self canResetZoom];
-
- if (action == @selector(showHideWebView:))
- [menuItem setTitle:[_webView isHidden] ? @"Show Web View" : @"Hide Web View"];
- else if (action == @selector(removeReinsertWebView:))
- [menuItem setTitle:[_webView window] ? @"Remove Web View" : @"Insert Web View"];
- else if (action == @selector(toggleZoomMode:))
- [menuItem setState:_zoomTextOnly ? NSOnState : NSOffState];
- else if ([menuItem action] == @selector(togglePaginationMode:))
- [menuItem setState:[self isPaginated] ? NSOnState : NSOffState];
-
- return YES;
-}
-
-- (BOOL)validateUserInterfaceItem:(id <NSValidatedUserInterfaceItem>)item
-{
- SEL action = [item action];
-
- if (action == @selector(goBack:))
- return [_webView canGoBack];
-
- if (action == @selector(goForward:))
- return [_webView canGoForward];
-
- return YES;
-}
-
-- (void)validateToolbar
-{
- [toolbar validateVisibleItems];
-}
-
-- (BOOL)windowShouldClose:(id)sender
-{
- return YES;
-}
-
-- (void)windowWillClose:(NSNotification *)notification
-{
- [(BrowserAppDelegate *)[NSApp delegate] browserWindowWillClose:[self window]];
- [self autorelease];
-}
-
-- (void)applicationTerminating
-{
-}
-
-- (double)currentZoomFactor
-{
- return 1;
-}
-
-- (BOOL)canZoomIn
-{
- return [_webView canMakeTextLarger];
-}
-
-- (void)zoomIn:(id)sender
-{
- if (![self canZoomIn])
- return;
-
- [_webView makeTextLarger:sender];
-}
-
-- (BOOL)canZoomOut
-{
- return [_webView canMakeTextSmaller];
-}
-
-- (void)zoomOut:(id)sender
-{
- if (![self canZoomIn])
- return;
-
- [_webView makeTextSmaller:sender];
-}
-
-- (BOOL)canResetZoom
-{
- return [_webView canMakeTextStandardSize];
-}
-
-- (void)resetZoom:(id)sender
-{
- if (![self canResetZoom])
- return;
-
- [_webView makeTextStandardSize:sender];
-}
-
-- (IBAction)toggleZoomMode:(id)sender
-{
- // FIXME: non-text zoom not implemented.
- _zoomTextOnly = !_zoomTextOnly;
-}
-
-- (IBAction)togglePaginationMode:(id)sender
-{
-}
-
-- (IBAction)find:(id)sender
-{
-}
-
-- (IBAction)dumpSourceToConsole:(id)sender
-{
-}
-
-// WebFrameLoadDelegate Methods
-- (void)webView:(WebView *)sender didStartProvisionalLoadForFrame:(WebFrame *)frame
-{
-}
-
-- (void)webView:(WebView *)sender didReceiveTitle:(NSString *)title forFrame:(WebFrame *)frame
-{
- if (frame != [sender mainFrame])
- return;
-
- [[self window] setTitle:[title stringByAppendingString:@" [WK1]"]];
-}
-
-@end
diff --git a/Tools/MiniBrowser/mac/WK2BrowserWindowController.h b/Tools/MiniBrowser/mac/WK2BrowserWindowController.h
deleted file mode 100644
index 840f08273..000000000
--- a/Tools/MiniBrowser/mac/WK2BrowserWindowController.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright (C) 2010 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#import "BrowserWindowController.h"
-
-@interface WK2BrowserWindowController : BrowserWindowController<BrowserController> {
- WKContextRef _context;
- WKPageGroupRef _pageGroup;
- WKView *_webView;
-}
-
-- (id)initWithContext:(WKContextRef)context pageGroup:(WKPageGroupRef)pageGroup;
-
-@end
diff --git a/Tools/MiniBrowser/mac/WK2BrowserWindowController.m b/Tools/MiniBrowser/mac/WK2BrowserWindowController.m
deleted file mode 100644
index 8db9a2408..000000000
--- a/Tools/MiniBrowser/mac/WK2BrowserWindowController.m
+++ /dev/null
@@ -1,809 +0,0 @@
-/*
- * Copyright (C) 2010 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#import "WK2BrowserWindowController.h"
-
-#import "AppDelegate.h"
-#import <WebKit2/WKPagePrivate.h>
-#import <WebKit2/WKStringCF.h>
-#import <WebKit2/WKURLCF.h>
-#import <WebKit2/WKViewPrivate.h>
-
-@interface WK2BrowserWindowController ()
-- (void)didStartProgress;
-- (void)didChangeProgress:(double)value;
-- (void)didFinishProgress;
-- (void)didStartProvisionalLoadForFrame:(WKFrameRef)frame;
-- (void)didCommitLoadForFrame:(WKFrameRef)frame;
-- (void)didReceiveServerRedirectForProvisionalLoadForFrame:(WKFrameRef)frame;
-- (void)didFailProvisionalLoadWithErrorForFrame:(WKFrameRef)frame;
-- (void)didFailLoadWithErrorForFrame:(WKFrameRef)frame;
-- (void)didSameDocumentNavigationForFrame:(WKFrameRef)frame;
-- (BOOL)isPaginated;
-@end
-
-@implementation WK2BrowserWindowController
-
-- (id)initWithContext:(WKContextRef)context pageGroup:(WKPageGroupRef)pageGroup
-{
- if ((self = [super initWithWindowNibName:@"BrowserWindow"])) {
- _context = WKRetain(context);
- _pageGroup = WKRetain(pageGroup);
- _zoomTextOnly = NO;
- }
-
- return self;
-}
-
-- (void)dealloc
-{
- WKRelease(_context);
- WKRelease(_pageGroup);
- [_webView release];
-
- [super dealloc];
-}
-
-- (IBAction)fetch:(id)sender
-{
- [urlText setStringValue:[self addProtocolIfNecessary:[urlText stringValue]]];
-
- CFURLRef cfURL = CFURLCreateWithString(0, (CFStringRef)[urlText stringValue], 0);
- if (!cfURL)
- return;
-
- WKURLRef url = WKURLCreateWithCFURL(cfURL);
- CFRelease(cfURL);
-
- WKPageLoadURL(_webView.pageRef, url);
- WKRelease(url);
-}
-
-- (IBAction)showHideWebView:(id)sender
-{
- BOOL hidden = ![_webView isHidden];
-
- [_webView setHidden:hidden];
-}
-
-- (IBAction)removeReinsertWebView:(id)sender
-{
- if ([_webView window]) {
- [_webView retain];
- [_webView removeFromSuperview];
- } else {
- [containerView addSubview:_webView];
- [_webView release];
- }
-}
-
-- (BOOL)validateMenuItem:(NSMenuItem *)menuItem
-{
- SEL action = [menuItem action];
-
- if (action == @selector(zoomIn:))
- return [self canZoomIn];
- if (action == @selector(zoomOut:))
- return [self canZoomOut];
- if (action == @selector(resetZoom:))
- return [self canResetZoom];
-
- if (action == @selector(showHideWebView:))
- [menuItem setTitle:[_webView isHidden] ? @"Show Web View" : @"Hide Web View"];
- else if (action == @selector(removeReinsertWebView:))
- [menuItem setTitle:[_webView window] ? @"Remove Web View" : @"Insert Web View"];
- else if (action == @selector(toggleZoomMode:))
- [menuItem setState:_zoomTextOnly ? NSOnState : NSOffState];
- else if ([menuItem action] == @selector(togglePaginationMode:))
- [menuItem setState:[self isPaginated] ? NSOnState : NSOffState];
-
- return YES;
-}
-
-- (IBAction)reload:(id)sender
-{
- WKPageReload(_webView.pageRef);
-}
-
-- (IBAction)forceRepaint:(id)sender
-{
- [_webView setNeedsDisplay:YES];
-}
-
-- (IBAction)goBack:(id)sender
-{
- WKPageGoBack(_webView.pageRef);
-}
-
-- (IBAction)goForward:(id)sender
-{
- WKPageGoForward(_webView.pageRef);
-}
-
-- (BOOL)validateUserInterfaceItem:(id <NSValidatedUserInterfaceItem>)item
-{
- SEL action = [item action];
-
- if (action == @selector(goBack:))
- return _webView && WKPageCanGoBack(_webView.pageRef);
-
- if (action == @selector(goForward:))
- return _webView && WKPageCanGoForward(_webView.pageRef);
-
- return YES;
-}
-
-- (void)validateToolbar
-{
- [toolbar validateVisibleItems];
-}
-
-- (BOOL)windowShouldClose:(id)sender
-{
- LOG(@"windowShouldClose");
- BOOL canCloseImmediately = WKPageTryClose(_webView.pageRef);
- return canCloseImmediately;
-}
-
-- (void)windowWillClose:(NSNotification *)notification
-{
- [(BrowserAppDelegate *)[NSApp delegate] browserWindowWillClose:[self window]];
- [self autorelease];
-}
-
-- (void)applicationTerminating
-{
- // FIXME: Why are we bothering to close the page? This doesn't even prevent LEAK output.
- WKPageClose(_webView.pageRef);
-}
-
-#define DefaultMinimumZoomFactor (.5)
-#define DefaultMaximumZoomFactor (3.0)
-#define DefaultZoomFactorRatio (1.2)
-
-- (double)currentZoomFactor
-{
- return _zoomTextOnly ? WKPageGetTextZoomFactor(_webView.pageRef) : WKPageGetPageZoomFactor(_webView.pageRef);
-}
-
-- (void)setCurrentZoomFactor:(double)factor
-{
- _zoomTextOnly ? WKPageSetTextZoomFactor(_webView.pageRef, factor) : WKPageSetPageZoomFactor(_webView.pageRef, factor);
-}
-
-- (BOOL)canZoomIn
-{
- return [self currentZoomFactor] * DefaultZoomFactorRatio < DefaultMaximumZoomFactor;
-}
-
-- (void)zoomIn:(id)sender
-{
- if (![self canZoomIn])
- return;
-
- double factor = [self currentZoomFactor] * DefaultZoomFactorRatio;
- [self setCurrentZoomFactor:factor];
-}
-
-- (BOOL)canZoomOut
-{
- return [self currentZoomFactor] / DefaultZoomFactorRatio > DefaultMinimumZoomFactor;
-}
-
-- (void)zoomOut:(id)sender
-{
- if (![self canZoomIn])
- return;
-
- double factor = [self currentZoomFactor] / DefaultZoomFactorRatio;
- [self setCurrentZoomFactor:factor];
-}
-
-- (BOOL)canResetZoom
-{
- return _zoomTextOnly ? (WKPageGetTextZoomFactor(_webView.pageRef) != 1) : (WKPageGetPageZoomFactor(_webView.pageRef) != 1);
-}
-
-- (void)resetZoom:(id)sender
-{
- if (![self canResetZoom])
- return;
-
- if (_zoomTextOnly)
- WKPageSetTextZoomFactor(_webView.pageRef, 1);
- else
- WKPageSetPageZoomFactor(_webView.pageRef, 1);
-}
-
-- (IBAction)toggleZoomMode:(id)sender
-{
- if (_zoomTextOnly) {
- _zoomTextOnly = NO;
- double currentTextZoom = WKPageGetTextZoomFactor(_webView.pageRef);
- WKPageSetPageAndTextZoomFactors(_webView.pageRef, currentTextZoom, 1);
- } else {
- _zoomTextOnly = YES;
- double currentPageZoom = WKPageGetPageZoomFactor(_webView.pageRef);
- WKPageSetPageAndTextZoomFactors(_webView.pageRef, 1, currentPageZoom);
- }
-}
-
-- (BOOL)isPaginated
-{
- return WKPageGetPaginationMode(_webView.pageRef) != kWKPaginationModeUnpaginated;
-}
-
-- (IBAction)togglePaginationMode:(id)sender
-{
- if ([self isPaginated])
- WKPageSetPaginationMode(_webView.pageRef, kWKPaginationModeUnpaginated);
- else {
- WKPageSetPaginationMode(_webView.pageRef, kWKPaginationModeLeftToRight);
- WKPageSetPageLength(_webView.pageRef, _webView.bounds.size.width / 2);
- WKPageSetGapBetweenPages(_webView.pageRef, 10);
- }
-}
-
-- (IBAction)dumpSourceToConsole:(id)sender
-{
- WKPageGetSourceForFrame_b(_webView.pageRef, WKPageGetMainFrame(_webView.pageRef), ^(WKStringRef result, WKErrorRef error) {
- CFStringRef cfResult = WKStringCopyCFString(0, result);
- LOG(@"Main frame source\n \"%@\"", (NSString *)cfResult);
- CFRelease(cfResult);
- });
-}
-
-// MARK: Loader Client Callbacks
-
-static void didStartProvisionalLoadForFrame(WKPageRef page, WKFrameRef frame, WKTypeRef userData, const void *clientInfo)
-{
- [(WK2BrowserWindowController *)clientInfo didStartProvisionalLoadForFrame:frame];
-}
-
-static void didReceiveServerRedirectForProvisionalLoadForFrame(WKPageRef page, WKFrameRef frame, WKTypeRef userData, const void *clientInfo)
-{
- [(WK2BrowserWindowController *)clientInfo didReceiveServerRedirectForProvisionalLoadForFrame:frame];
-}
-
-static void didFailProvisionalLoadWithErrorForFrame(WKPageRef page, WKFrameRef frame, WKErrorRef error, WKTypeRef userData, const void *clientInfo)
-{
- [(WK2BrowserWindowController *)clientInfo didFailProvisionalLoadWithErrorForFrame:frame];
-}
-
-static void didCommitLoadForFrame(WKPageRef page, WKFrameRef frame, WKTypeRef userData, const void *clientInfo)
-{
- [(WK2BrowserWindowController *)clientInfo didCommitLoadForFrame:frame];
-}
-
-static void didFinishDocumentLoadForFrame(WKPageRef page, WKFrameRef frame, WKTypeRef userData, const void *clientInfo)
-{
- LOG(@"didFinishDocumentLoadForFrame");
-}
-
-static void didFinishLoadForFrame(WKPageRef page, WKFrameRef frame, WKTypeRef userData, const void *clientInfo)
-{
- LOG(@"didFinishLoadForFrame");
-}
-
-static void didFailLoadWithErrorForFrame(WKPageRef page, WKFrameRef frame, WKErrorRef error, WKTypeRef userData, const void *clientInfo)
-{
- [(WK2BrowserWindowController *)clientInfo didFailLoadWithErrorForFrame:frame];
-}
-
-static void didSameDocumentNavigationForFrame(WKPageRef page, WKFrameRef frame, WKSameDocumentNavigationType type, WKTypeRef userData, const void *clientInfo)
-{
- [(WK2BrowserWindowController *)clientInfo didSameDocumentNavigationForFrame:frame];
-}
-
-static void didReceiveTitleForFrame(WKPageRef page, WKStringRef title, WKFrameRef frame, WKTypeRef userData, const void *clientInfo)
-{
- if (!WKFrameIsMainFrame(frame))
- return;
-
- WK2BrowserWindowController* controller = (WK2BrowserWindowController*)clientInfo;
- CFStringRef cfTitle = WKStringCopyCFString(0, title);
- [[controller window] setTitle:[(NSString *)cfTitle stringByAppendingString:@" [WK2]"]];
- CFRelease(cfTitle);
-}
-
-static void didFirstLayoutForFrame(WKPageRef page, WKFrameRef frame, WKTypeRef userData, const void *clientInfo)
-{
- LOG(@"didFirstLayoutForFrame");
-}
-
-static void didFirstVisuallyNonEmptyLayoutForFrame(WKPageRef page, WKFrameRef frame, WKTypeRef userData, const void *clientInfo)
-{
- LOG(@"didFirstVisuallyNonEmptyLayoutForFrame");
-}
-
-static void didRemoveFrameFromHierarchy(WKPageRef page, WKFrameRef frame, WKTypeRef userData, const void *clientInfo)
-{
- LOG(@"didRemoveFrameFromHierarchy");
-}
-
-static void didDisplayInsecureContentForFrame(WKPageRef page, WKFrameRef frame, WKTypeRef userData, const void *clientInfo)
-{
- LOG(@"didDisplayInsecureContentForFrame");
-}
-
-static void didRunInsecureContentForFrame(WKPageRef page, WKFrameRef frame, WKTypeRef userData, const void *clientInfo)
-{
- LOG(@"didRunInsecureContentForFrame");
-}
-
-static void didDetectXSSForFrame(WKPageRef page, WKFrameRef frame, WKTypeRef userData, const void *clientInfo)
-{
- LOG(@"didDetectXSSForFrame");
-}
-
-static void didStartProgress(WKPageRef page, const void *clientInfo)
-{
- [(WK2BrowserWindowController *)clientInfo didStartProgress];
-}
-
-static void didChangeProgress(WKPageRef page, const void *clientInfo)
-{
- [(WK2BrowserWindowController *)clientInfo didChangeProgress:WKPageGetEstimatedProgress(page)];
-}
-
-static void didFinishProgress(WKPageRef page, const void *clientInfo)
-{
- [(WK2BrowserWindowController *)clientInfo didFinishProgress];
-}
-
-static void didBecomeUnresponsive(WKPageRef page, const void *clientInfo)
-{
- LOG(@"didBecomeUnresponsive");
-}
-
-static void didBecomeResponsive(WKPageRef page, const void *clientInfo)
-{
- LOG(@"didBecomeResponsive");
-}
-
-static void processDidExit(WKPageRef page, const void *clientInfo)
-{
- LOG(@"processDidExit");
-}
-
-static void didChangeBackForwardList(WKPageRef page, WKBackForwardListItemRef addedItem, WKArrayRef removedItems, const void *clientInfo)
-{
- [(WK2BrowserWindowController *)clientInfo validateToolbar];
-}
-
-// MARK: Policy Client Callbacks
-
-static void decidePolicyForNavigationAction(WKPageRef page, WKFrameRef frame, WKFrameNavigationType navigationType, WKEventModifiers modifiers, WKEventMouseButton mouseButton, WKURLRequestRef request, WKFramePolicyListenerRef listener, WKTypeRef userData, const void* clientInfo)
-{
- LOG(@"decidePolicyForNavigationAction");
- WKFramePolicyListenerUse(listener);
-}
-
-static void decidePolicyForNewWindowAction(WKPageRef page, WKFrameRef frame, WKFrameNavigationType navigationType, WKEventModifiers modifiers, WKEventMouseButton mouseButton, WKURLRequestRef request, WKStringRef frameName, WKFramePolicyListenerRef listener, WKTypeRef userData, const void* clientInfo)
-{
- LOG(@"decidePolicyForNewWindowAction");
- WKFramePolicyListenerUse(listener);
-}
-
-static void decidePolicyForResponse(WKPageRef page, WKFrameRef frame, WKURLResponseRef response, WKURLRequestRef request, WKFramePolicyListenerRef listener, WKTypeRef userData, const void* clientInfo)
-{
- WKFramePolicyListenerUse(listener);
-}
-
-// MARK: UI Client Callbacks
-
-static WKPageRef createNewPage(WKPageRef page, WKURLRequestRef request, WKDictionaryRef features, WKEventModifiers modifiers, WKEventMouseButton button, const void* clientInfo)
-{
- LOG(@"createNewPage");
- WK2BrowserWindowController *controller = [[WK2BrowserWindowController alloc] initWithContext:WKPageGetContext(page) pageGroup:WKPageGetPageGroup(page)];
- [controller loadWindow];
-
- return WKRetain(controller->_webView.pageRef);
-}
-
-static void showPage(WKPageRef page, const void *clientInfo)
-{
- LOG(@"showPage");
- [[(BrowserWindowController *)clientInfo window] orderFront:nil];
-}
-
-static void closePage(WKPageRef page, const void *clientInfo)
-{
- LOG(@"closePage");
- WKPageClose(page);
- [[(BrowserWindowController *)clientInfo window] close];
-}
-
-static void runJavaScriptAlert(WKPageRef page, WKStringRef message, WKFrameRef frame, const void* clientInfo)
-{
- NSAlert* alert = [[NSAlert alloc] init];
-
- WKURLRef wkURL = WKFrameCopyURL(frame);
- CFURLRef cfURL = WKURLCopyCFURL(0, wkURL);
- WKRelease(wkURL);
-
- [alert setMessageText:[NSString stringWithFormat:@"JavaScript alert dialog from %@.", [(NSURL *)cfURL absoluteString]]];
- CFRelease(cfURL);
-
- CFStringRef cfMessage = WKStringCopyCFString(0, message);
- [alert setInformativeText:(NSString *)cfMessage];
- CFRelease(cfMessage);
-
- [alert addButtonWithTitle:@"OK"];
-
- [alert runModal];
- [alert release];
-}
-
-static bool runJavaScriptConfirm(WKPageRef page, WKStringRef message, WKFrameRef frame, const void* clientInfo)
-{
- NSAlert* alert = [[NSAlert alloc] init];
-
- WKURLRef wkURL = WKFrameCopyURL(frame);
- CFURLRef cfURL = WKURLCopyCFURL(0, wkURL);
- WKRelease(wkURL);
-
- [alert setMessageText:[NSString stringWithFormat:@"JavaScript confirm dialog from %@.", [(NSURL *)cfURL absoluteString]]];
- CFRelease(cfURL);
-
- CFStringRef cfMessage = WKStringCopyCFString(0, message);
- [alert setInformativeText:(NSString *)cfMessage];
- CFRelease(cfMessage);
-
- [alert addButtonWithTitle:@"OK"];
- [alert addButtonWithTitle:@"Cancel"];
-
- NSInteger button = [alert runModal];
- [alert release];
-
- return button == NSAlertFirstButtonReturn;
-}
-
-static WKStringRef runJavaScriptPrompt(WKPageRef page, WKStringRef message, WKStringRef defaultValue, WKFrameRef frame, const void* clientInfo)
-{
- NSAlert* alert = [[NSAlert alloc] init];
-
- WKURLRef wkURL = WKFrameCopyURL(frame);
- CFURLRef cfURL = WKURLCopyCFURL(0, wkURL);
- WKRelease(wkURL);
-
- [alert setMessageText:[NSString stringWithFormat:@"JavaScript prompt dialog from %@.", [(NSURL *)cfURL absoluteString]]];
- CFRelease(cfURL);
-
- CFStringRef cfMessage = WKStringCopyCFString(0, message);
- [alert setInformativeText:(NSString *)cfMessage];
- CFRelease(cfMessage);
-
- [alert addButtonWithTitle:@"OK"];
- [alert addButtonWithTitle:@"Cancel"];
-
- NSTextField* input = [[NSTextField alloc] initWithFrame:NSMakeRect(0, 0, 200, 24)];
- CFStringRef cfDefaultValue = WKStringCopyCFString(0, defaultValue);
- [input setStringValue:(NSString *)cfDefaultValue];
- CFRelease(cfDefaultValue);
-
- [alert setAccessoryView:input];
-
- NSInteger button = [alert runModal];
-
- NSString* result = nil;
- if (button == NSAlertFirstButtonReturn) {
- [input validateEditing];
- result = [input stringValue];
- }
-
- [alert release];
-
- if (!result)
- return 0;
- return WKStringCreateWithCFString((CFStringRef)result);
-}
-
-static void setStatusText(WKPageRef page, WKStringRef text, const void* clientInfo)
-{
- LOG(@"setStatusText");
-}
-
-static void mouseDidMoveOverElement(WKPageRef page, WKHitTestResultRef hitTestResult, WKEventModifiers modifiers, WKTypeRef userData, const void *clientInfo)
-{
- LOG(@"mouseDidMoveOverElement");
-}
-
-static WKRect getWindowFrame(WKPageRef page, const void* clientInfo)
-{
- NSRect rect = [[(BrowserWindowController *)clientInfo window] frame];
- WKRect wkRect;
- wkRect.origin.x = rect.origin.x;
- wkRect.origin.y = rect.origin.y;
- wkRect.size.width = rect.size.width;
- wkRect.size.height = rect.size.height;
- return wkRect;
-}
-
-static void setWindowFrame(WKPageRef page, WKRect rect, const void* clientInfo)
-{
- [[(BrowserWindowController *)clientInfo window] setFrame:NSMakeRect(rect.origin.x, rect.origin.y, rect.size.width, rect.size.height) display:YES];
-}
-
-static bool runBeforeUnloadConfirmPanel(WKPageRef page, WKStringRef message, WKFrameRef frame, const void* clientInfo)
-{
- NSAlert *alert = [[NSAlert alloc] init];
-
- WKURLRef wkURL = WKFrameCopyURL(frame);
- CFURLRef cfURL = WKURLCopyCFURL(0, wkURL);
- WKRelease(wkURL);
-
- [alert setMessageText:[NSString stringWithFormat:@"BeforeUnload confirm dialog from %@.", [(NSURL *)cfURL absoluteString]]];
- CFRelease(cfURL);
-
- CFStringRef cfMessage = WKStringCopyCFString(0, message);
- [alert setInformativeText:(NSString *)cfMessage];
- CFRelease(cfMessage);
-
- [alert addButtonWithTitle:@"OK"];
- [alert addButtonWithTitle:@"Cancel"];
-
- NSInteger button = [alert runModal];
- [alert release];
-
- return button == NSAlertFirstButtonReturn;
-}
-
-static void runOpenPanel(WKPageRef page, WKFrameRef frame, WKOpenPanelParametersRef parameters, WKOpenPanelResultListenerRef listener, const void* clientInfo)
-{
- NSOpenPanel *openPanel = [NSOpenPanel openPanel];
- [openPanel setAllowsMultipleSelection:WKOpenPanelParametersGetAllowsMultipleFiles(parameters)];
-
- WKRetain(listener);
-
- [openPanel beginSheetModalForWindow:[(BrowserWindowController *)clientInfo window] completionHandler:^(NSInteger result) {
- if (result == NSFileHandlingPanelOKButton) {
- WKMutableArrayRef fileURLs = WKMutableArrayCreate();
-
- NSURL *nsURL;
- for (nsURL in [openPanel URLs]) {
- WKURLRef wkURL = WKURLCreateWithCFURL((CFURLRef)nsURL);
- WKArrayAppendItem(fileURLs, wkURL);
- WKRelease(wkURL);
- }
-
- WKOpenPanelResultListenerChooseFiles(listener, fileURLs);
-
- WKRelease(fileURLs);
- } else
- WKOpenPanelResultListenerCancel(listener);
-
- WKRelease(listener);
- }];
-}
-
-- (void)awakeFromNib
-{
- _webView = [[WKView alloc] initWithFrame:[containerView bounds] contextRef:_context pageGroupRef:_pageGroup];
-
- [_webView setAutoresizingMask:(NSViewWidthSizable | NSViewHeightSizable)];
- [containerView addSubview:_webView];
-
- WKPageLoaderClient loadClient = {
- kWKPageLoaderClientCurrentVersion,
- self, /* clientInfo */
- didStartProvisionalLoadForFrame,
- didReceiveServerRedirectForProvisionalLoadForFrame,
- didFailProvisionalLoadWithErrorForFrame,
- didCommitLoadForFrame,
- didFinishDocumentLoadForFrame,
- didFinishLoadForFrame,
- didFailLoadWithErrorForFrame,
- didSameDocumentNavigationForFrame,
- didReceiveTitleForFrame,
- didFirstLayoutForFrame,
- didFirstVisuallyNonEmptyLayoutForFrame,
- didRemoveFrameFromHierarchy,
- didDisplayInsecureContentForFrame,
- didRunInsecureContentForFrame,
- 0, // canAuthenticateAgainstProtectionSpaceInFrame
- 0, // didReceiveAuthenticationChallengeInFrame
- didStartProgress,
- didChangeProgress,
- didFinishProgress,
- didBecomeUnresponsive,
- didBecomeResponsive,
- processDidExit,
- didChangeBackForwardList,
- 0, // shouldGoToBackForwardItem
- 0, // didFailToInitializePlugin
- didDetectXSSForFrame,
- 0, // didNewFirstVisuallyNonEmptyLayout
- 0, // willGoToBackForwardListItem
- 0, // interactionOccurredWhileProcessUnresponsive
- 0, // pluginDidFail
- 0, // didReceiveIntentForFrame
- 0, // registerIntentServiceForFrame
- 0, // didLayout
- };
- WKPageSetPageLoaderClient(_webView.pageRef, &loadClient);
-
- WKPagePolicyClient policyClient = {
- kWKPagePolicyClientCurrentVersion,
- self, /* clientInfo */
- decidePolicyForNavigationAction,
- decidePolicyForNewWindowAction,
- decidePolicyForResponse,
- 0 /* unableToImplementPolicy */
- };
- WKPageSetPagePolicyClient(_webView.pageRef, &policyClient);
-
- WKPageUIClient uiClient = {
- kWKPageUIClientCurrentVersion,
- self, /* clientInfo */
- 0, /* createNewPage_deprecatedForUseWithV0 */
- showPage,
- closePage,
- 0, /* takeFocus */
- 0, /* focus */
- 0, /* unfocus */
- runJavaScriptAlert,
- runJavaScriptConfirm,
- runJavaScriptPrompt,
- setStatusText,
- 0, /* mouseDidMoveOverElement_deprecatedForUseWithV0 */
- 0, /* missingPluginButtonClicked */
- 0, /* didNotHandleKeyEvent */
- 0, /* didNotHandleWheelEvent */
- 0, /* toolbarsAreVisible */
- 0, /* setToolbarsAreVisible */
- 0, /* menuBarIsVisible */
- 0, /* setMenuBarIsVisible */
- 0, /* statusBarIsVisible */
- 0, /* setStatusBarIsVisible */
- 0, /* isResizable */
- 0, /* setIsResizable */
- getWindowFrame,
- setWindowFrame,
- runBeforeUnloadConfirmPanel,
- 0, /* didDraw */
- 0, /* pageDidScroll */
- 0, /* exceededDatabaseQuota */
- runOpenPanel,
- 0, /* decidePolicyForGeolocationPermissionRequest */
- 0, // headerHeight
- 0, // footerHeight
- 0, // drawHeader
- 0, // drawFooter
- 0, // printFrame
- 0, // showModal
- 0, // didCompleteRubberBandForMainFrame
- 0, // saveDataToFileInDownloadsFolder
- 0, // shouldInterruptJavaScript
- createNewPage,
- mouseDidMoveOverElement,
- 0, // decidePolicyForNotificationPermissionRequest
- 0, // unavailablePluginButtonClicked
- 0, // showColorPicker
- 0, // hideColorPicker
- };
- WKPageSetPageUIClient(_webView.pageRef, &uiClient);
-}
-
-- (void)didStartProgress
-{
- [progressIndicator setDoubleValue:0.0];
- [progressIndicator setHidden:NO];
-}
-
-- (void)didChangeProgress:(double)value
-{
- [progressIndicator setDoubleValue:value];
-}
-
-- (void)didFinishProgress
-{
- [progressIndicator setHidden:YES];
- [progressIndicator setDoubleValue:1.0];
-}
-
-- (void)updateProvisionalURLForFrame:(WKFrameRef)frame
-{
- static WKURLRef emptyURL = 0;
- if (!emptyURL)
- emptyURL = WKURLCreateWithUTF8CString("");
-
- WKURLRef url = WKFrameCopyProvisionalURL(frame);
-
- if (!url)
- return;
-
- if (WKURLIsEqual(url, emptyURL)) {
- WKRelease(url);
- return;
- }
-
- CFURLRef cfSourceURL = WKURLCopyCFURL(0, url);
- WKRelease(url);
-
- [urlText setStringValue:(NSString*)CFURLGetString(cfSourceURL)];
- CFRelease(cfSourceURL);
-}
-
-- (void)didStartProvisionalLoadForFrame:(WKFrameRef)frame
-{
- if (!WKFrameIsMainFrame(frame))
- return;
-
- [self updateProvisionalURLForFrame:frame];
-}
-
-- (void)didReceiveServerRedirectForProvisionalLoadForFrame:(WKFrameRef)frame
-{
- if (!WKFrameIsMainFrame(frame))
- return;
-
- [self updateProvisionalURLForFrame:frame];
-}
-
-- (void)didFailProvisionalLoadWithErrorForFrame:(WKFrameRef)frame
-{
- if (!WKFrameIsMainFrame(frame))
- return;
-
- [self updateProvisionalURLForFrame:frame];
-}
-
-- (void)didFailLoadWithErrorForFrame:(WKFrameRef)frame
-{
- if (!WKFrameIsMainFrame(frame))
- return;
-
- [self updateProvisionalURLForFrame:frame];
-}
-
-- (void)didSameDocumentNavigationForFrame:(WKFrameRef)frame
-{
-}
-
-- (void)didCommitLoadForFrame:(WKFrameRef)frame
-{
-}
-
-- (void)loadURLString:(NSString *)urlString
-{
- // FIXME: We shouldn't have to set the url text here.
- [urlText setStringValue:urlString];
- [self fetch:nil];
-}
-
-- (IBAction)performFindPanelAction:(id)sender
-{
- [findPanelWindow makeKeyAndOrderFront:sender];
-}
-
-- (IBAction)find:(id)sender
-{
- WKStringRef string = WKStringCreateWithCFString((CFStringRef)[sender stringValue]);
-
- WKPageFindString(_webView.pageRef, string, kWKFindOptionsCaseInsensitive | kWKFindOptionsWrapAround | kWKFindOptionsShowFindIndicator | kWKFindOptionsShowOverlay, 100);
-}
-
-@end
diff --git a/Tools/MiniBrowser/qt/MiniBrowser.pro b/Tools/MiniBrowser/qt/MiniBrowser.pro
index f5c1803fa..31a39eb6b 100644
--- a/Tools/MiniBrowser/qt/MiniBrowser.pro
+++ b/Tools/MiniBrowser/qt/MiniBrowser.pro
@@ -31,7 +31,7 @@ DESTDIR = $${ROOT_BUILD_DIR}/bin
have?(FONTCONFIG): PKGCONFIG += fontconfig
-QT += network gui-private quick quick-private webkitwidgets webkitwidgets-private
+QT += network gui-private quick quick-private webkit webkit-private
macx: QT += xml
RESOURCES += MiniBrowser.qrc
diff --git a/Tools/MiniBrowser/qt/raw/Target.pri b/Tools/MiniBrowser/qt/raw/Target.pri
index afc38ce5f..ff9052f2a 100644
--- a/Tools/MiniBrowser/qt/raw/Target.pri
+++ b/Tools/MiniBrowser/qt/raw/Target.pri
@@ -9,6 +9,6 @@ SOURCES += \
DESTDIR = $${ROOT_BUILD_DIR}/bin
-QT = core gui network webkitwidgets
+QT = core gui network webkit
WEBKIT += wtf javascriptcore webkit2