misc: Add a present_cookies to guit->misc and use it

In order that we present the cookies window usefully, change
browser_window to request presentation of the cookies window
via a gui misc callback.

Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
This commit is contained in:
Daniel Silverstone 2020-05-23 20:55:36 +01:00
parent cafb428a49
commit 26df6ab7dd
No known key found for this signature in database
GPG Key ID: C30DF439F2987D74
3 changed files with 18 additions and 3 deletions

View File

@ -4802,9 +4802,7 @@ nserror browser_window_show_cookies(
lwc_string *host = nsurl_get_component(url, NSURL_HOST);
const char *string = (host != NULL) ? lwc_string_data(host) : NULL;
/** \todo Ensure cookie manager is open. (Ask front end.) */
err = cookie_manager_set_search_string(string);
err = guit->misc->present_cookies(string);
if (host != NULL) {
lwc_string_unref(host);

View File

@ -657,6 +657,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)
{
@ -683,6 +689,9 @@ static nserror verify_misc_register(struct gui_misc_table *gmt)
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;
}

View File

@ -116,6 +116,14 @@ struct gui_misc_table {
*/
void (*pdf_password)(char **owner_pass, char **user_pass, char *path);
/**
* Request that the cookie manager be displayed
*
* \param search_term The search term to be set (NULL if no search)
*
* \return NSERROR_OK on success
*/
nserror (*present_cookies)(const char *search_term);
};
#endif