move 401 login into operation table

This commit is contained in:
Vincent Sanders 2014-01-16 00:52:17 +00:00
parent 38cb39339a
commit d47fed4524
28 changed files with 69 additions and 122 deletions

View File

@ -5159,6 +5159,7 @@ static struct gui_browser_table amiga_browser_table = {
.cert_verify = gui_cert_verify,
.filename_from_path = filename_from_path,
.path_add_part = path_add_part,
.login = gui_401login_open,
};
/** Normal entry point from OS */

View File

@ -16,7 +16,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "desktop/401login.h"
#include "amiga/os3support.h"
#include "amiga/gui.h"
#include "amiga/object.h"

View File

@ -24,4 +24,8 @@
struct gui_login_window;
BOOL ami_401login_event(struct gui_login_window *lw);
void gui_401login_open(nsurl *url, const char *realm,
nserror (*cb)(bool proceed, void *pw), void *cbpw);
#endif

View File

@ -38,7 +38,6 @@
#include "desktop/local_history.h"
#include "desktop/plotters.h"
#include "desktop/netsurf.h"
#include "desktop/401login.h"
#include "utils/nsoption.h"
#include "desktop/save_complete.h"
@ -742,7 +741,7 @@ static void gui_set_clipboard(const char *buffer, size_t length,
}
}
void gui_401login_open(nsurl *url, const char *realm,
static void gui_401login_open(nsurl *url, const char *realm,
nserror (*cb)(bool proceed, void *pw), void *cbpw)
{
bool bres;
@ -1078,6 +1077,7 @@ static struct gui_browser_table atari_browser_table = {
.cert_verify = gui_cert_verify,
.filename_from_path = filename_from_path,
.path_add_part = path_add_part,
.login = gui_401login_open,
};
/* #define WITH_DBG_LOGFILE 1 */

View File

@ -16,18 +16,17 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "desktop/401login.h"
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
#include <cflib.h>
#include "utils/config.h"
#include "content/content.h"
#include "content/hlcache.h"
#include "content/urldb.h"
#include "desktop/browser.h"
#include "desktop/401login.h"
#include "desktop/gui.h"
#include "utils/errors.h"
#include "utils/utils.h"

View File

@ -49,7 +49,6 @@ extern "C" {
#include "content/fetchers/curl.h"
#include "content/fetchers/resource.h"
#include "content/urldb.h"
#include "desktop/401login.h"
#include "desktop/browser_private.h"
#include "desktop/gui.h"
#include "desktop/netsurf.h"
@ -1071,6 +1070,7 @@ static struct gui_browser_table beos_browser_table = {
.launch_url = gui_launch_url,
.filename_from_path = filename_from_path,
.path_add_part = path_add_part,
.login = gui_401login_open,
};

View File

@ -32,6 +32,9 @@
extern bool replicated;
int gui_init_replicant(int argc, char** argv);
extern "C" void gui_401login_open(nsurl *url, const char *realm,
nserror (*cb)(bool proceed, void *pw), void *cbpw);
extern char *options_file_location;

View File

@ -31,7 +31,6 @@ extern "C" {
#include "content/content.h"
#include "content/urldb.h"
#include "desktop/browser.h"
#include "desktop/401login.h"
#include "desktop/gui.h"
#include "utils/messages.h"
#include "utils/url.h"

View File

@ -31,7 +31,6 @@
#import "desktop/browser_private.h"
#import "utils/nsoption.h"
#import "desktop/textinput.h"
#import "desktop/401login.h"
#import "utils/utils.h"
#import "utils/log.h"
#import "image/ico.h"
@ -274,13 +273,6 @@ static void gui_cert_verify(nsurl *url, const struct ssl_cert_info *certs,
cb( false, cbpw );
}
void gui_401login_open(nsurl *url, const char *realm,
nserror (*cb)(bool proceed, void *pw), void *cbpw)
{
cb( false, cbpw );
}
static char *filename_from_path(char *path)
{
return strdup( [[[NSString stringWithUTF8String: path] lastPathComponent] UTF8String] );

View File

@ -1,31 +0,0 @@
/*
* Copyright 2003 John M Bell <jmb202@ecs.soton.ac.uk>
*
* This file is part of NetSurf, http://www.netsurf-browser.org/
*
* NetSurf is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* NetSurf is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef NETSURF_DESKTOP_401LOGIN_H
#define NETSURF_DESKTOP_401LOGIN_H
#include <stdbool.h>
#include "utils/config.h"
#include "utils/nsurl.h"
#include "utils/errors.h"
void gui_401login_open(nsurl *url, const char *realm,
nserror (*cb)(bool proceed, void *pw), void *cbpw);
#endif

View File

@ -41,7 +41,6 @@
#include "content/fetch.h"
#include "content/hlcache.h"
#include "content/urldb.h"
#include "desktop/401login.h"
#include "desktop/browser_private.h"
#include "desktop/download.h"
#include "desktop/frames.h"

View File

@ -301,6 +301,23 @@ struct gui_browser_table {
*/
void (*poll)(bool active);
/**
* Return the filename part of a full path
*
* \param path full path and filename
* \return filename (will be freed with free())
*/
char *(*filename_from_path)(char *path);
/**
* Add a path component/filename to an existing path
*
* \param path buffer containing path + free space
* \param length length of buffer "path"
* \param newpart string containing path component to add to path
* \return true on success
*/
bool (*path_add_part)(char *path, int length, const char *newpart);
/* Optional entries */
@ -345,22 +362,10 @@ struct gui_browser_table {
void (*cert_verify)(nsurl *url, const struct ssl_cert_info *certs, unsigned long num, nserror (*cb)(bool proceed, void *pw), void *cbpw);
/**
* Return the filename part of a full path
*
* \param path full path and filename
* \return filename (will be freed with free())
* Prompt user for login
*/
char *(*filename_from_path)(char *path);
/**
* Add a path component/filename to an existing path
*
* \param path buffer containing path + free space
* \param length length of buffer "path"
* \param newpart string containing path component to add to path
* \return true on success
*/
bool (*path_add_part)(char *path, int length, const char *newpart);
void (*login)(nsurl *url, const char *realm,
nserror (*cb)(bool proceed, void *pw), void *cbpw);
};

View File

@ -304,6 +304,12 @@ static void gui_default_cert_verify(nsurl *url,
cb(false, cbpw);
}
static void gui_default_401login_open(nsurl *url, const char *realm,
nserror (*cb)(bool proceed, void *pw), void *cbpw)
{
cb(false, cbpw);
}
static nserror verify_browser_register(struct gui_browser_table *gbt)
{
@ -343,6 +349,9 @@ static nserror verify_browser_register(struct gui_browser_table *gbt)
if (gbt->cert_verify == NULL) {
gbt->cert_verify = gui_default_cert_verify;
}
if (gbt->login == NULL) {
gbt->login = gui_default_401login_open;
}
return NSERROR_OK;
}

View File

@ -37,10 +37,8 @@
#include "image/image.h"
#include "image/image_cache.h"
#include "desktop/netsurf.h"
#include "desktop/401login.h"
#include "desktop/browser.h"
#include "desktop/system_colour.h"
#include "desktop/gui.h"
#include "desktop/gui_factory.h"
#include "utils/nsoption.h"
#include "desktop/searchweb.h"
@ -96,7 +94,7 @@ static nserror netsurf_llcache_query_handler(const llcache_query *query,
{
switch (query->type) {
case LLCACHE_QUERY_AUTH:
gui_401login_open(query->url, query->data.auth.realm, cb, cbpw);
guit->browser->login(query->url, query->data.auth.realm, cb, cbpw);
break;
case LLCACHE_QUERY_REDIRECT:
/** \todo Need redirect query dialog */

View File

@ -135,7 +135,7 @@ $(eval $(foreach V,$(filter FB_IMAGE_%,$(.VARIABLES)),$(call convert_image,$($(V
# S_FRAMEBUFFER are sources purely for the framebuffer build
S_FRAMEBUFFER := gui.c framebuffer.c schedule.c \
thumbnail.c misc.c bitmap.c filetype.c login.c findfile.c \
thumbnail.c misc.c bitmap.c filetype.c findfile.c \
localhistory.c clipboard.c
S_FRAMEBUFFER_FBTK := fbtk.c event.c fill.c bitmap.c user.c window.c \

View File

@ -1,25 +0,0 @@
/*
* Copyright 2008 Vincent Sanders <vince@simtec.co.uk>
*
* This file is part of NetSurf, http://www.netsurf-browser.org/
*
* NetSurf is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* NetSurf is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "desktop/401login.h"
void gui_401login_open(nsurl *url, const char *realm,
nserror (*cb)(bool proceed, void *pw), void *cbpw)
{
cb(false, cbpw);
}

View File

@ -1143,6 +1143,7 @@ static struct gui_browser_table nsgtk_browser_table = {
.cert_verify = gui_cert_verify,
.filename_from_path = filename_from_path,
.path_add_part = path_add_part,
.login = gui_401login_open,
};
/**

View File

@ -29,7 +29,8 @@
#include <inttypes.h>
#include <stdbool.h>
#include <gtk/gtk.h>
//#include <glade/glade.h>
#include "utils/nsurl.h"
struct glade_file_location_s {
char *netsurf;
@ -60,5 +61,8 @@ extern GdkPixbuf *favicon_pixbuf; /* favicon default pixbuf */
uint32_t gtk_gui_gdkkey_to_nskey(GdkEventKey *);
extern void gui_401login_open(nsurl *url, const char *realm,
nserror (*cb)(bool proceed, void *pw), void *cbpw);
#endif /* GTK_GUI_H */

View File

@ -28,7 +28,6 @@
#include "content/hlcache.h"
#include "content/urldb.h"
#include "desktop/browser.h"
#include "desktop/401login.h"
#include "desktop/gui.h"
#include "utils/messages.h"
#include "utils/url.h"

View File

@ -16,12 +16,13 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "desktop/401login.h"
#include "utils/ring.h"
#include <stdlib.h>
#include <stdio.h>
#include "monkey/401login.h"
typedef struct monkey401 {
struct monkey401 *r_next, *r_prev;
uint32_t num;

9
monkey/401login.h Normal file
View File

@ -0,0 +1,9 @@
#include <stdbool.h>
#include "utils/nsurl.h"
#include "utils/errors.h"
void gui_401login_open(nsurl *url, const char *realm,
nserror (*cb)(bool proceed, void *pw), void *cbpw);

View File

@ -26,6 +26,7 @@
#include "monkey/dispatch.h"
#include "monkey/browser.h"
#include "monkey/cert.h"
#include "monkey/401login.h"
#include "content/urldb.h"
#include "content/fetchers/resource.h"
@ -161,6 +162,7 @@ static struct gui_browser_table monkey_browser_table = {
.cert_verify = gui_cert_verify,
.filename_from_path = filename_from_path,
.path_add_part = path_add_part,
.login = gui_401login_open,
};
int

View File

@ -27,7 +27,6 @@
#include "content/hlcache.h"
#include "content/urldb.h"
#include "desktop/browser.h"
#include "desktop/401login.h"
#include "desktop/gui.h"
#include "riscos/dialog.h"
#include "riscos/wimp_event.h"

View File

@ -2362,6 +2362,7 @@ static struct gui_browser_table riscos_browser_table = {
.cert_verify = gui_cert_verify,
.filename_from_path = filename_from_path,
.path_add_part = path_add_part,
.login = gui_401login_open,
};

View File

@ -127,6 +127,8 @@ extern struct gui_download_table *riscos_download_table;
/* in 401login.c */
void ro_gui_401login_init(void);
void gui_401login_open(nsurl *url, const char *realm,
nserror (*cb)(bool proceed, void *pw), void *cbpw);
/* in window.c */
bool ro_gui_window_dataload(struct gui_window *g, wimp_message *message);

View File

@ -184,9 +184,11 @@ inline static char digit2uppercase_hex(unsigned char digit) {
/* Platform specific functions */
void die(const char * const error);
void warn_user(const char *warning, const char *detail);
void PDF_Password(char **owner_pass, char **user_pass, char *path);
/* only riscos */
query_id query_user(const char *query, const char *detail,
const query_callback *cb, void *pw, const char *yes, const char *no);
void query_close(query_id);
void PDF_Password(char **owner_pass, char **user_pass, char *path);
#endif

View File

@ -65,7 +65,7 @@ S_RESOURCES := windows_resource.o
# S_WINDOWS are sources purely for the windows build
S_WINDOWS := main.c window.c gui.c drawable.c misc.c plot.c findfile.c \
font.c bitmap.c about.c prefs.c download.c filetype.c \
localhistory.c login.c schedule.c thumbnail.c windbg.c
localhistory.c schedule.c thumbnail.c windbg.c
S_WINDOWS := $(addprefix windows/,$(S_WINDOWS))
# This is the final source build list

View File

@ -1,25 +0,0 @@
/*
* Copyright 2008 Vincent Sanders <vince@simtec.co.uk>
*
* This file is part of NetSurf, http://www.netsurf-browser.org/
*
* NetSurf is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* NetSurf is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "desktop/401login.h"
void gui_401login_open(nsurl *url, const char *realm,
nserror (*cb)(bool proceed, void *pw), void *cbpw)
{
cb(false, cbpw);
}