summaryrefslogtreecommitdiff
path: root/desktop/gui_factory.c
diff options
context:
space:
mode:
Diffstat (limited to 'desktop/gui_factory.c')
-rw-r--r--desktop/gui_factory.c119
1 files changed, 47 insertions, 72 deletions
diff --git a/desktop/gui_factory.c b/desktop/gui_factory.c
index ca9eff1da..0d4d9a904 100644
--- a/desktop/gui_factory.c
+++ b/desktop/gui_factory.c
@@ -19,10 +19,13 @@
#include <stdlib.h>
#include <stdint.h>
#include <stdbool.h>
+#include <string.h>
+#include <unistd.h>
#include "utils/config.h"
#include "utils/errors.h"
#include "utils/file.h"
+#include "utils/inet.h"
#include "netsurf/bitmap.h"
#include "content/hlcache.h"
#include "content/backing_store.h"
@@ -55,14 +58,6 @@ static nserror gui_default_window_set_url(struct gui_window *g, struct nsurl *ur
return NSERROR_OK;
}
-static void gui_default_window_start_throbber(struct gui_window *g)
-{
-}
-
-static void gui_default_window_stop_throbber(struct gui_window *g)
-{
-}
-
static bool gui_default_window_drag_start(struct gui_window *g,
gui_drag_type type,
const struct rect *rect)
@@ -82,17 +77,6 @@ static void gui_default_window_set_icon(struct gui_window *g,
{
}
-
-static void gui_default_window_new_content(struct gui_window *g)
-{
-}
-
-
-static bool gui_default_window_scroll_start(struct gui_window *g)
-{
- return true;
-}
-
static void gui_default_window_set_pointer(struct gui_window *g,
gui_pointer_shape shape)
{
@@ -109,10 +93,6 @@ static void gui_default_window_place_caret(struct gui_window *g,
{
}
-static void gui_default_window_remove_caret(struct gui_window *g)
-{
-}
-
static void gui_default_window_create_form_select_menu(struct gui_window *g,
struct form_control *control)
{
@@ -135,7 +115,13 @@ static void gui_default_window_drag_save_selection(struct gui_window *g,
{
}
-static void gui_default_window_start_selection(struct gui_window *g)
+
+static void
+gui_default_console_log(struct gui_window *gw,
+ browser_window_console_source src,
+ const char *msg,
+ size_t msglen,
+ browser_window_console_flags flags)
{
}
@@ -167,7 +153,7 @@ static nserror verify_window_register(struct gui_window_table *gwt)
if (gwt->get_dimensions == NULL) {
return NSERROR_BAD_PARAMETER;
}
- if (gwt->update_extent == NULL) {
+ if (gwt->event == NULL) {
return NSERROR_BAD_PARAMETER;
}
@@ -191,27 +177,12 @@ static nserror verify_window_register(struct gui_window_table *gwt)
if (gwt->place_caret == NULL) {
gwt->place_caret = gui_default_window_place_caret;
}
- if (gwt->remove_caret == NULL) {
- gwt->remove_caret = gui_default_window_remove_caret;
- }
- if (gwt->start_throbber == NULL) {
- gwt->start_throbber = gui_default_window_start_throbber;
- }
- if (gwt->stop_throbber == NULL) {
- gwt->stop_throbber = gui_default_window_stop_throbber;
- }
if (gwt->drag_start == NULL) {
gwt->drag_start = gui_default_window_drag_start;
}
if (gwt->save_link == NULL) {
gwt->save_link = gui_default_window_save_link;
}
- if (gwt->new_content == NULL) {
- gwt->new_content = gui_default_window_new_content;
- }
- if (gwt->scroll_start == NULL) {
- gwt->scroll_start = gui_default_window_scroll_start;
- }
if (gwt->create_form_select_menu == NULL) {
gwt->create_form_select_menu =
gui_default_window_create_form_select_menu;
@@ -225,8 +196,8 @@ static nserror verify_window_register(struct gui_window_table *gwt)
if (gwt->drag_save_selection == NULL) {
gwt->drag_save_selection = gui_default_window_drag_save_selection;
}
- if (gwt->start_selection == NULL) {
- gwt->start_selection = gui_default_window_start_selection;
+ if (gwt->console_log == NULL) {
+ gwt->console_log = gui_default_console_log;
}
return NSERROR_OK;
@@ -503,6 +474,16 @@ static char *gui_default_mimetype(const char *path)
return strdup(guit->fetch->filetype(path));
}
+static int gui_default_socket_open(int domain, int type, int protocol)
+{
+ return (int) socket(domain, type, protocol);
+}
+
+static int gui_default_socket_close(int fd)
+{
+ return (int) ns_close_socket(fd);
+}
+
/** verify fetch table is valid */
static nserror verify_fetch_register(struct gui_fetch_table *gft)
{
@@ -529,6 +510,12 @@ static nserror verify_fetch_register(struct gui_fetch_table *gft)
if (gft->mimetype == NULL) {
gft->mimetype = gui_default_mimetype;
}
+ if (gft->socket_open == NULL) {
+ gft->socket_open = gui_default_socket_open;
+ }
+ if (gft->socket_close == NULL) {
+ gft->socket_close = gui_default_socket_close;
+ }
return NSERROR_OK;
}
@@ -565,7 +552,7 @@ static nserror verify_file_register(struct gui_file_table *gft)
* verify bitmap table is valid
*
* \param gbt The bitmap table to verify.
- * \return NSERROR_OK if teh table is valid else NSERROR_BAD_PARAMETER.
+ * \return NSERROR_OK if the table is valid else NSERROR_BAD_PARAMETER.
*/
static nserror verify_bitmap_register(struct gui_bitmap_table *gbt)
{
@@ -591,10 +578,6 @@ static nserror verify_bitmap_register(struct gui_bitmap_table *gbt)
return NSERROR_BAD_PARAMETER;
}
- if (gbt->test_opaque == NULL) {
- return NSERROR_BAD_PARAMETER;
- }
-
if (gbt->get_buffer == NULL) {
return NSERROR_BAD_PARAMETER;
}
@@ -611,14 +594,6 @@ static nserror verify_bitmap_register(struct gui_bitmap_table *gbt)
return NSERROR_BAD_PARAMETER;
}
- if (gbt->get_bpp == NULL) {
- return NSERROR_BAD_PARAMETER;
- }
-
- if (gbt->save == NULL) {
- return NSERROR_BAD_PARAMETER;
- }
-
if (gbt->modified == NULL) {
return NSERROR_BAD_PARAMETER;
}
@@ -670,21 +645,18 @@ static nserror gui_default_launch_url(struct nsurl *url)
}
-static nserror gui_default_cert_verify(nsurl *url,
- const struct ssl_cert_info *certs,
- unsigned long num,
- nserror (*cb)(bool proceed, void *pw),
- void *cbpw)
+static nserror gui_default_401login_open(
+ nsurl *url, const char *realm,
+ const char *username, const char *password,
+ nserror (*cb)(nsurl *url, const char * realm,
+ const char *username,
+ const char *password,
+ void *pw),
+ void *cbpw)
{
return NSERROR_NOT_IMPLEMENTED;
}
-static void gui_default_401login_open(nsurl *url, const char *realm,
- nserror (*cb)(bool proceed, void *pw), void *cbpw)
-{
- cb(false, cbpw);
-}
-
static void
gui_default_pdf_password(char **owner_pass, char **user_pass, char *path)
{
@@ -692,6 +664,12 @@ gui_default_pdf_password(char **owner_pass, char **user_pass, char *path)
save_pdf(path);
}
+static nserror
+gui_default_present_cookies(const char *search_term)
+{
+ return NSERROR_NOT_IMPLEMENTED;
+}
+
/** verify misc table is valid */
static nserror verify_misc_register(struct gui_misc_table *gmt)
{
@@ -704,9 +682,6 @@ static nserror verify_misc_register(struct gui_misc_table *gmt)
if (gmt->schedule == NULL) {
return NSERROR_BAD_PARAMETER;
}
- if (gmt->warning == NULL) {
- return NSERROR_BAD_PARAMETER;
- }
/* fill in the optional entries with defaults */
if (gmt->quit == NULL) {
@@ -715,15 +690,15 @@ static nserror verify_misc_register(struct gui_misc_table *gmt)
if (gmt->launch_url == NULL) {
gmt->launch_url = gui_default_launch_url;
}
- if (gmt->cert_verify == NULL) {
- gmt->cert_verify = gui_default_cert_verify;
- }
if (gmt->login == NULL) {
gmt->login = gui_default_401login_open;
}
if (gmt->pdf_password == NULL) {
gmt->pdf_password = gui_default_pdf_password;
}
+ if (gmt->present_cookies == NULL) {
+ gmt->present_cookies = gui_default_present_cookies;
+ }
return NSERROR_OK;
}