NetSurf
misc.h
Go to the documentation of this file.
1/*
2 * Copyright 2014 Vincent Sanders <vince@netsurf-browser.org>
3 *
4 * This file is part of NetSurf, http://www.netsurf-browser.org/
5 *
6 * NetSurf is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License.
9 *
10 * NetSurf is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19/**
20 * \file
21 *
22 * Interface to platform-specific miscellaneous browser operation table.
23 */
24
25#ifndef NETSURF_MISC_H_
26#define NETSURF_MISC_H_
27
28struct form_control;
29struct gui_window;
30struct cert_chain;
31struct nsurl;
32
33/**
34 * Graphical user interface browser misc function table.
35 *
36 * function table implementing GUI interface to miscelaneous browser
37 * functionality
38 */
40 /* Mandantory entries */
41
42 /**
43 * Schedule a callback.
44 *
45 * \param t interval before the callback should be made in ms or
46 * negative value to remove any existing callback.
47 * \param callback callback function
48 * \param p user parameter passed to callback function
49 * \return NSERROR_OK on sucess or appropriate error on faliure
50 *
51 * The callback function will be called as soon as possible
52 * after the timeout has elapsed.
53 *
54 * Additional calls with the same callback and user parameter will
55 * reset the callback time to the newly specified value.
56 *
57 */
58 nserror (*schedule)(int t, void (*callback)(void *p), void *p);
59
60
61 /* Optional entries */
62
63 /**
64 * called to allow the gui to cleanup.
65 */
66 void (*quit)(void);
67
68 /**
69 * core has no fetcher for url
70 */
71 nserror (*launch_url)(struct nsurl *url);
72
73 /**
74 * Retrieve username/password for a given url+realm if there is one
75 * stored in a frontend-specific way (e.g. gnome-keyring)
76 *
77 * To respond, call the callback with the url, realm, username,
78 * and password. Pass "" if the empty string
79 * is required.
80 *
81 * To keep hold of the url, remember to nsurl_ref() it, and to keep
82 * the realm, you will need to strdup() it.
83 *
84 * If the front end returns NSERROR_OK for this function, they may,
85 * at some future time, call the `cb` with `cbpw` callback exactly once.
86 *
87 * If the front end returns other than NSERROR_OK, they should not
88 * call the `cb` callback.
89 *
90 * The callback should not be called immediately upon receipt of this
91 * call as the browser window may not be reentered.
92 *
93 * **NOTE** The lifetime of the cbpw is not well defined. In general
94 * do not use the cb if *any* browser window has navigated or been
95 * destroyed.
96 *
97 * \param url The URL being verified.
98 * \param realm The authorization realm.
99 * \param username Any current username (or empty string).
100 * \param password Any current password (or empty string).
101 * \param cb Callback upon user decision.
102 * \param cbpw Context pointer passed to cb
103 * \return NSERROR_OK on sucess else error and cb never called
104 */
105 nserror (*login)(struct nsurl *url, const char *realm,
106 const char *username, const char *password,
107 nserror (*cb)(struct nsurl *url,
108 const char *realm,
109 const char *username,
110 const char *password,
111 void *pw),
112 void *cbpw);
113
114 /**
115 * Prompt the user for a password for a PDF.
116 */
117 void (*pdf_password)(char **owner_pass, char **user_pass, char *path);
118
119 /**
120 * Request that the cookie manager be displayed
121 *
122 * \param search_term The search term to be set (NULL if no search)
123 *
124 * \return NSERROR_OK on success
125 */
126 nserror (*present_cookies)(const char *search_term);
127};
128
129#endif
nserror
Enumeration of error codes.
Definition: errors.h:29
struct nsurl nsurl
NetSurf URL object.
Definition: nsurl.h:31
X509 certificate chain.
Definition: ssl_certs.h:59
Form control.
Definition: form_internal.h:73
Graphical user interface browser misc function table.
Definition: misc.h:39
nserror(* schedule)(int t, void(*callback)(void *p), void *p)
Schedule a callback.
Definition: misc.h:58
nserror(* launch_url)(struct nsurl *url)
core has no fetcher for url
Definition: misc.h:71
nserror(* login)(struct nsurl *url, const char *realm, const char *username, const char *password, nserror(*cb)(struct nsurl *url, const char *realm, const char *username, const char *password, void *pw), void *cbpw)
Retrieve username/password for a given url+realm if there is one stored in a frontend-specific way (e...
Definition: misc.h:105
void(* quit)(void)
called to allow the gui to cleanup.
Definition: misc.h:66
nserror(* present_cookies)(const char *search_term)
Request that the cookie manager be displayed.
Definition: misc.h:126
void(* pdf_password)(char **owner_pass, char **user_pass, char *path)
Prompt the user for a password for a PDF.
Definition: misc.h:117
first entry in window list
Definition: gui.c:297
static nserror path(const struct redraw_context *ctx, const plot_style_t *pstyle, const float *p, unsigned int n, const float transform[6])
Plots a path.
Definition: plot.c:821