2013-07-25 19:07:46 +04:00
|
|
|
/*
|
|
|
|
* Copyright 2013 Michael Drake <tlsa@netsurf-browser.org>
|
|
|
|
*
|
|
|
|
* 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/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/** \file
|
|
|
|
* Cookie Manager (implementation).
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
|
|
|
#include "content/urldb.h"
|
|
|
|
#include "desktop/cookie_manager.h"
|
|
|
|
#include "desktop/treeview.h"
|
|
|
|
#include "utils/messages.h"
|
|
|
|
#include "utils/utils.h"
|
|
|
|
#include "utils/log.h"
|
|
|
|
|
2013-07-26 01:22:36 +04:00
|
|
|
enum cookie_manager_field {
|
2013-07-26 18:20:19 +04:00
|
|
|
COOKIE_M_NAME,
|
|
|
|
COOKIE_M_CONTENT,
|
|
|
|
COOKIE_M_DOMAIN,
|
|
|
|
COOKIE_M_PATH,
|
|
|
|
COOKIE_M_EXPIRES,
|
|
|
|
COOKIE_M_LAST_USED,
|
|
|
|
COOKIE_M_RESTRICTIONS,
|
|
|
|
COOKIE_M_VERSION,
|
|
|
|
COOKIE_M_PERSISTENT,
|
|
|
|
COOKIE_M_DOMAIN_FOLDER,
|
|
|
|
COOKIE_M_N_FIELDS
|
2013-07-25 19:07:46 +04:00
|
|
|
};
|
|
|
|
|
2013-07-26 15:11:14 +04:00
|
|
|
enum cookie_manager_value {
|
2013-07-26 18:20:19 +04:00
|
|
|
COOKIE_M_HTTPS,
|
|
|
|
COOKIE_M_SECURE,
|
|
|
|
COOKIE_M_HTTP,
|
|
|
|
COOKIE_M_NONE,
|
|
|
|
COOKIE_M_NETSCAPE,
|
|
|
|
COOKIE_M_RFC2109,
|
|
|
|
COOKIE_M_RFC2965,
|
|
|
|
COOKIE_M_YES,
|
|
|
|
COOKIE_M_NO,
|
|
|
|
COOKIE_M_N_VALUES
|
2013-07-26 15:11:14 +04:00
|
|
|
};
|
|
|
|
|
2013-07-25 19:07:46 +04:00
|
|
|
struct cookie_manager_folder {
|
|
|
|
treeview_node *folder;
|
|
|
|
struct treeview_field_data data;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct cookie_manager_ctx {
|
|
|
|
treeview *tree;
|
2013-07-26 18:20:19 +04:00
|
|
|
struct treeview_field_desc fields[COOKIE_M_N_FIELDS];
|
|
|
|
struct treeview_field_data values[COOKIE_M_N_VALUES];
|
2013-07-25 19:07:46 +04:00
|
|
|
bool built;
|
|
|
|
};
|
|
|
|
struct cookie_manager_ctx cm_ctx;
|
|
|
|
|
|
|
|
struct cookie_manager_entry {
|
|
|
|
bool user_delete;
|
|
|
|
|
|
|
|
treeview_node *entry;
|
|
|
|
|
2013-07-26 18:20:19 +04:00
|
|
|
struct treeview_field_data data[COOKIE_M_N_FIELDS - 1];
|
2013-07-25 19:07:46 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
struct treeview_walk_ctx {
|
|
|
|
const char *title;
|
2013-07-26 01:31:27 +04:00
|
|
|
size_t title_len;
|
2013-07-25 19:07:46 +04:00
|
|
|
struct cookie_manager_folder *folder;
|
|
|
|
struct cookie_manager_entry *entry;
|
|
|
|
};
|
|
|
|
/** Callback for treeview_walk */
|
|
|
|
static nserror cookie_manager_walk_cb(void *ctx, void *node_data,
|
|
|
|
enum treeview_node_type type, bool *abort)
|
|
|
|
{
|
|
|
|
struct treeview_walk_ctx *tw = ctx;
|
|
|
|
|
|
|
|
if (type == TREE_NODE_ENTRY) {
|
|
|
|
struct cookie_manager_entry *entry = node_data;
|
|
|
|
|
2013-07-26 18:20:19 +04:00
|
|
|
if (entry->data[COOKIE_M_NAME].value_len == tw->title_len &&
|
2013-07-26 01:31:27 +04:00
|
|
|
strcmp(tw->title,
|
2013-07-26 18:20:19 +04:00
|
|
|
entry->data[COOKIE_M_NAME].value) == 0) {
|
2013-07-25 19:07:46 +04:00
|
|
|
/* Found what we're looking for */
|
|
|
|
tw->entry = entry;
|
|
|
|
*abort = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
} else if (type == TREE_NODE_FOLDER) {
|
|
|
|
struct cookie_manager_folder *folder = node_data;
|
|
|
|
|
2013-07-26 01:31:27 +04:00
|
|
|
if (folder->data.value_len == tw->title_len &&
|
|
|
|
strcmp(tw->title, folder->data.value) == 0) {
|
2013-07-25 19:07:46 +04:00
|
|
|
/* Found what we're looking for */
|
|
|
|
tw->folder = folder;
|
|
|
|
*abort = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return NSERROR_OK;
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
* Find a cookie entry in the cookie manager's treeview
|
|
|
|
*
|
|
|
|
* \param root Search root node, or NULL to search from tree's root
|
|
|
|
* \param title ID of the node to look for
|
2013-07-26 01:31:27 +04:00
|
|
|
* \param title_len Byte length of title string
|
2013-07-25 19:07:46 +04:00
|
|
|
* \param found Updated to the matching node's cookie maanger entry
|
|
|
|
* \return NSERROR_OK on success, appropriate error otherwise
|
|
|
|
*/
|
|
|
|
static nserror cookie_manager_find_entry(treeview_node *root,
|
2013-07-26 01:31:27 +04:00
|
|
|
const char *title, size_t title_len,
|
|
|
|
struct cookie_manager_entry **found)
|
2013-07-25 19:07:46 +04:00
|
|
|
{
|
|
|
|
nserror err;
|
|
|
|
struct treeview_walk_ctx tw = {
|
|
|
|
.title = title,
|
2013-07-26 01:31:27 +04:00
|
|
|
.title_len = title_len,
|
2013-07-25 19:07:46 +04:00
|
|
|
.folder = NULL,
|
|
|
|
.entry = NULL
|
|
|
|
};
|
|
|
|
|
2013-08-22 19:05:03 +04:00
|
|
|
err = treeview_walk(cm_ctx.tree, root, cookie_manager_walk_cb, NULL,
|
|
|
|
&tw, TREE_NODE_ENTRY);
|
2013-07-25 19:07:46 +04:00
|
|
|
if (err != NSERROR_OK)
|
|
|
|
return err;
|
|
|
|
|
|
|
|
*found = tw.entry;
|
|
|
|
|
|
|
|
return NSERROR_OK;
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
* Find a cookie domain folder in the cookie manager's treeview
|
|
|
|
*
|
|
|
|
* \param root Search root node, or NULL to search from tree's root
|
|
|
|
* \param title ID of the node to look for
|
2013-07-26 01:31:27 +04:00
|
|
|
* \param title_len Byte length of title string
|
2013-07-25 19:07:46 +04:00
|
|
|
* \param found Updated to the matching node's cookie maanger folder
|
|
|
|
* \return NSERROR_OK on success, appropriate error otherwise
|
|
|
|
*/
|
|
|
|
static nserror cookie_manager_find_folder(treeview_node *root,
|
2013-07-26 01:31:27 +04:00
|
|
|
const char *title, size_t title_len,
|
|
|
|
struct cookie_manager_folder **found)
|
2013-07-25 19:07:46 +04:00
|
|
|
{
|
|
|
|
nserror err;
|
|
|
|
struct treeview_walk_ctx tw = {
|
|
|
|
.title = title,
|
2013-07-26 01:31:27 +04:00
|
|
|
.title_len = title_len,
|
2013-07-25 19:07:46 +04:00
|
|
|
.folder = NULL,
|
|
|
|
.entry = NULL
|
|
|
|
};
|
|
|
|
|
2013-08-22 19:05:03 +04:00
|
|
|
err = treeview_walk(cm_ctx.tree, root, cookie_manager_walk_cb, NULL,
|
|
|
|
&tw, TREE_NODE_FOLDER);
|
2013-07-25 19:07:46 +04:00
|
|
|
if (err != NSERROR_OK)
|
|
|
|
return err;
|
|
|
|
|
|
|
|
*found = tw.folder;
|
|
|
|
|
|
|
|
return NSERROR_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Free a cookie manager entry's treeview field data.
|
|
|
|
*
|
|
|
|
* \param e Cookie manager entry to free data from
|
|
|
|
*/
|
|
|
|
static void cookie_manager_free_treeview_field_data(
|
|
|
|
struct cookie_manager_entry *e)
|
|
|
|
{
|
|
|
|
/* Eww */
|
2013-07-26 18:20:19 +04:00
|
|
|
free((void *)e->data[COOKIE_M_NAME].value);
|
|
|
|
free((void *)e->data[COOKIE_M_CONTENT].value);
|
|
|
|
free((void *)e->data[COOKIE_M_DOMAIN].value);
|
|
|
|
free((void *)e->data[COOKIE_M_PATH].value);
|
|
|
|
free((void *)e->data[COOKIE_M_EXPIRES].value);
|
|
|
|
free((void *)e->data[COOKIE_M_LAST_USED].value);
|
2013-07-25 19:07:46 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-07-26 01:22:36 +04:00
|
|
|
/**
|
|
|
|
* Build a cookie manager treeview field from given text
|
|
|
|
*
|
|
|
|
* \param field Cookie manager treeview field to build
|
2013-07-26 15:11:14 +04:00
|
|
|
* \param data Cookie manager entry field data to set
|
2013-07-26 15:23:00 +04:00
|
|
|
* \param value Text to set in field, ownership yielded
|
2013-07-26 01:22:36 +04:00
|
|
|
* \return NSERROR_OK on success, appropriate error otherwise
|
|
|
|
*/
|
|
|
|
static inline nserror cookie_manager_field_builder(
|
|
|
|
enum cookie_manager_field field,
|
2013-07-26 15:11:14 +04:00
|
|
|
struct treeview_field_data *data,
|
2013-07-26 01:22:36 +04:00
|
|
|
const char *value)
|
|
|
|
{
|
|
|
|
data->field = cm_ctx.fields[field].field;
|
2013-07-26 15:23:00 +04:00
|
|
|
data->value = value;
|
2013-07-26 01:22:36 +04:00
|
|
|
data->value_len = (value != NULL) ? strlen(value) : 0;
|
|
|
|
|
|
|
|
return NSERROR_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-07-25 19:07:46 +04:00
|
|
|
/**
|
|
|
|
* Set a cookie manager entry's data from the cookie_data.
|
|
|
|
*
|
|
|
|
* \param e Cookie manager entry to set up
|
|
|
|
* \param data Data associated with entry's cookie
|
|
|
|
* \return NSERROR_OK on success, appropriate error otherwise
|
|
|
|
*/
|
|
|
|
static nserror cookie_manager_set_treeview_field_data(
|
|
|
|
struct cookie_manager_entry *e,
|
|
|
|
const struct cookie_data *data)
|
|
|
|
{
|
|
|
|
const char *date;
|
|
|
|
char *date2;
|
|
|
|
|
|
|
|
assert(e != NULL);
|
|
|
|
assert(data != NULL);
|
|
|
|
|
2013-07-26 01:22:36 +04:00
|
|
|
/* Set the fields up */
|
2013-07-26 18:20:19 +04:00
|
|
|
cookie_manager_field_builder(COOKIE_M_NAME,
|
|
|
|
&e->data[COOKIE_M_NAME], strdup(data->name));
|
|
|
|
cookie_manager_field_builder(COOKIE_M_CONTENT,
|
|
|
|
&e->data[COOKIE_M_CONTENT], strdup(data->value));
|
|
|
|
cookie_manager_field_builder(COOKIE_M_DOMAIN,
|
|
|
|
&e->data[COOKIE_M_DOMAIN], strdup(data->domain));
|
|
|
|
cookie_manager_field_builder(COOKIE_M_PATH,
|
|
|
|
&e->data[COOKIE_M_PATH], strdup(data->path));
|
2013-07-26 01:22:36 +04:00
|
|
|
|
|
|
|
/* Set the Expires date field */
|
2013-07-25 19:07:46 +04:00
|
|
|
date = ctime(&data->expires);
|
|
|
|
date2 = strdup(date);
|
|
|
|
if (date2 != NULL) {
|
|
|
|
assert(date2[24] == '\n');
|
|
|
|
date2[24] = '\0';
|
|
|
|
}
|
2013-07-26 18:20:19 +04:00
|
|
|
cookie_manager_field_builder(COOKIE_M_EXPIRES,
|
|
|
|
&e->data[COOKIE_M_EXPIRES], date2);
|
2013-07-25 19:07:46 +04:00
|
|
|
|
2013-07-26 01:22:36 +04:00
|
|
|
/* Set the Last used date field */
|
2013-07-25 19:07:46 +04:00
|
|
|
date = ctime(&data->last_used);
|
|
|
|
date2 = strdup(date);
|
|
|
|
if (date2 != NULL) {
|
|
|
|
assert(date2[24] == '\n');
|
|
|
|
date2[24] = '\0';
|
|
|
|
}
|
2013-07-26 18:20:19 +04:00
|
|
|
cookie_manager_field_builder(COOKIE_M_LAST_USED,
|
|
|
|
&e->data[COOKIE_M_LAST_USED], date2);
|
2013-07-25 19:07:46 +04:00
|
|
|
|
|
|
|
/* Set the Restrictions text */
|
|
|
|
if (data->secure && data->http_only)
|
2013-07-26 18:20:19 +04:00
|
|
|
e->data[COOKIE_M_RESTRICTIONS] = cm_ctx.values[COOKIE_M_HTTPS];
|
2013-07-25 19:07:46 +04:00
|
|
|
else if (data->secure)
|
2013-07-26 18:20:19 +04:00
|
|
|
e->data[COOKIE_M_RESTRICTIONS] = cm_ctx.values[COOKIE_M_SECURE];
|
2013-07-25 19:07:46 +04:00
|
|
|
else if (data->http_only)
|
2013-07-26 18:20:19 +04:00
|
|
|
e->data[COOKIE_M_RESTRICTIONS] = cm_ctx.values[COOKIE_M_HTTP];
|
2013-07-25 19:07:46 +04:00
|
|
|
else
|
2013-07-26 18:20:19 +04:00
|
|
|
e->data[COOKIE_M_RESTRICTIONS] = cm_ctx.values[COOKIE_M_NONE];
|
2013-07-25 19:07:46 +04:00
|
|
|
|
|
|
|
/* Set the Version text */
|
2013-07-26 15:11:14 +04:00
|
|
|
switch (data->version) {
|
|
|
|
case COOKIE_NETSCAPE:
|
2013-07-26 18:20:19 +04:00
|
|
|
e->data[COOKIE_M_VERSION] = cm_ctx.values[COOKIE_M_NETSCAPE];
|
2013-07-26 15:11:14 +04:00
|
|
|
break;
|
|
|
|
case COOKIE_RFC2109:
|
2013-07-26 18:20:19 +04:00
|
|
|
e->data[COOKIE_M_VERSION] = cm_ctx.values[COOKIE_M_RFC2109];
|
2013-07-26 15:11:14 +04:00
|
|
|
break;
|
|
|
|
case COOKIE_RFC2965:
|
2013-07-26 18:20:19 +04:00
|
|
|
e->data[COOKIE_M_VERSION] = cm_ctx.values[COOKIE_M_RFC2965];
|
2013-07-26 15:11:14 +04:00
|
|
|
break;
|
|
|
|
}
|
2013-07-25 19:07:46 +04:00
|
|
|
|
|
|
|
/* Set the Persistent text */
|
2013-07-26 15:11:14 +04:00
|
|
|
if (data->no_destroy)
|
2013-07-26 18:20:19 +04:00
|
|
|
e->data[COOKIE_M_PERSISTENT] = cm_ctx.values[COOKIE_M_YES];
|
2013-07-26 15:11:14 +04:00
|
|
|
else
|
2013-07-26 18:20:19 +04:00
|
|
|
e->data[COOKIE_M_PERSISTENT] = cm_ctx.values[COOKIE_M_NO];
|
2013-07-25 19:07:46 +04:00
|
|
|
|
|
|
|
return NSERROR_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Creates an empty tree entry for a cookie, and links it into the tree.
|
|
|
|
*
|
|
|
|
* All information is copied from the cookie_data, and as such can
|
|
|
|
* be edited and should be freed.
|
|
|
|
*
|
|
|
|
* \param parent the node to link to
|
|
|
|
* \param data the cookie data to use
|
|
|
|
* \return NSERROR_OK on success, appropriate error otherwise
|
|
|
|
*/
|
|
|
|
static nserror cookie_manager_create_cookie_node(
|
|
|
|
struct cookie_manager_folder *parent,
|
|
|
|
const struct cookie_data *data)
|
|
|
|
{
|
|
|
|
nserror err;
|
|
|
|
struct cookie_manager_entry *cookie;
|
|
|
|
|
|
|
|
/* Create new cookie manager entry */
|
|
|
|
cookie = malloc(sizeof(struct cookie_manager_entry));
|
|
|
|
if (cookie == NULL) {
|
|
|
|
return NSERROR_NOMEM;
|
|
|
|
}
|
|
|
|
|
|
|
|
cookie->user_delete = false;
|
|
|
|
|
|
|
|
err = cookie_manager_set_treeview_field_data(cookie, data);
|
|
|
|
if (err != NSERROR_OK) {
|
|
|
|
free(cookie);
|
|
|
|
return err;
|
|
|
|
}
|
|
|
|
|
|
|
|
err = treeview_create_node_entry(cm_ctx.tree, &(cookie->entry),
|
|
|
|
parent->folder, TREE_REL_FIRST_CHILD,
|
|
|
|
cookie->data, cookie,
|
2013-08-30 15:51:40 +04:00
|
|
|
cm_ctx.built ? TREE_OPTION_NONE :
|
|
|
|
TREE_OPTION_SUPPRESS_RESIZE |
|
|
|
|
TREE_OPTION_SUPPRESS_REDRAW);
|
2013-07-25 19:07:46 +04:00
|
|
|
if (err != NSERROR_OK) {
|
|
|
|
cookie_manager_free_treeview_field_data(cookie);
|
|
|
|
free(cookie);
|
|
|
|
return err;
|
|
|
|
}
|
|
|
|
|
|
|
|
return NSERROR_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Updates a cookie manager entry for updated cookie_data.
|
|
|
|
*
|
|
|
|
* All information is copied from the cookie_data, and as such can
|
|
|
|
* be edited and should be freed.
|
|
|
|
*
|
|
|
|
* \param e the entry to update
|
|
|
|
* \param data the cookie data to use
|
|
|
|
* \return NSERROR_OK on success, appropriate error otherwise
|
|
|
|
*/
|
|
|
|
static nserror cookie_manager_update_cookie_node(
|
|
|
|
struct cookie_manager_entry *e,
|
|
|
|
const struct cookie_data *data)
|
|
|
|
{
|
|
|
|
nserror err;
|
|
|
|
|
|
|
|
assert(e != NULL);
|
|
|
|
|
|
|
|
/* Reset to defaults */
|
|
|
|
e->user_delete = false;
|
|
|
|
cookie_manager_free_treeview_field_data(e);
|
|
|
|
|
|
|
|
/* Set new field values from the cookie_data */
|
|
|
|
err = cookie_manager_set_treeview_field_data(e, data);
|
|
|
|
if (err != NSERROR_OK) {
|
|
|
|
return err;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Update the treeview */
|
|
|
|
err = treeview_update_node_entry(cm_ctx.tree, e->entry, e->data, e);
|
|
|
|
if (err != NSERROR_OK) {
|
|
|
|
return err;
|
|
|
|
}
|
|
|
|
|
|
|
|
return NSERROR_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Creates an empty tree folder for a cookie domain, and links it into the tree.
|
|
|
|
*
|
|
|
|
* All information is copied from the cookie_data, and as such can
|
|
|
|
* be edited and should be freed.
|
|
|
|
*
|
|
|
|
* \param folder updated to the new folder
|
|
|
|
* \param data the cookie data to use
|
|
|
|
* \return NSERROR_OK on success, appropriate error otherwise
|
|
|
|
*/
|
|
|
|
static nserror cookie_manager_create_domain_folder(
|
|
|
|
struct cookie_manager_folder **folder,
|
|
|
|
const struct cookie_data *data)
|
|
|
|
{
|
|
|
|
nserror err;
|
|
|
|
struct cookie_manager_folder *f;
|
|
|
|
|
|
|
|
/* Create new cookie manager entry */
|
|
|
|
f = malloc(sizeof(struct cookie_manager_folder));
|
|
|
|
if (f == NULL) {
|
|
|
|
return NSERROR_NOMEM;
|
|
|
|
}
|
|
|
|
|
2013-07-26 18:20:19 +04:00
|
|
|
f->data.field = cm_ctx.fields[COOKIE_M_N_FIELDS - 1].field;
|
2013-07-25 19:07:46 +04:00
|
|
|
f->data.value = strdup(data->domain);
|
|
|
|
f->data.value_len = (f->data.value != NULL) ?
|
|
|
|
strlen(data->domain) : 0;
|
|
|
|
|
|
|
|
err = treeview_create_node_folder(cm_ctx.tree, &(f->folder),
|
|
|
|
NULL, TREE_REL_FIRST_CHILD, &f->data, f,
|
2013-08-30 15:51:40 +04:00
|
|
|
cm_ctx.built ? TREE_OPTION_NONE :
|
|
|
|
TREE_OPTION_SUPPRESS_RESIZE |
|
|
|
|
TREE_OPTION_SUPPRESS_REDRAW);
|
2013-07-25 19:07:46 +04:00
|
|
|
if (err != NSERROR_OK) {
|
|
|
|
free((void *)f->data.value);
|
|
|
|
free(f);
|
|
|
|
return err;
|
|
|
|
}
|
|
|
|
|
|
|
|
*folder = f;
|
|
|
|
|
|
|
|
return NSERROR_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* exported interface documented in cookie_manager.h */
|
|
|
|
bool cookie_manager_add(const struct cookie_data *data)
|
|
|
|
{
|
|
|
|
struct cookie_manager_folder *parent = NULL;
|
|
|
|
struct cookie_manager_entry *cookie = NULL;
|
|
|
|
nserror err;
|
|
|
|
|
|
|
|
assert(data != NULL);
|
|
|
|
|
|
|
|
/* If we don't have a cookie manager at the moment, just return true */
|
|
|
|
if (cm_ctx.tree == NULL)
|
|
|
|
return true;
|
|
|
|
|
2013-07-26 01:31:27 +04:00
|
|
|
err = cookie_manager_find_folder(NULL, data->domain,
|
|
|
|
strlen(data->domain), &parent);
|
2013-07-25 19:07:46 +04:00
|
|
|
if (err != NSERROR_OK) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (parent == NULL) {
|
|
|
|
/* Need to create domain directory */
|
|
|
|
err = cookie_manager_create_domain_folder(&parent, data);
|
|
|
|
if (err != NSERROR_OK || parent == NULL)
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Create cookie node */
|
2013-07-26 01:31:27 +04:00
|
|
|
err = cookie_manager_find_entry(parent->folder, data->name,
|
|
|
|
strlen(data->name), &cookie);
|
2013-07-25 19:07:46 +04:00
|
|
|
if (err != NSERROR_OK)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
if (cookie == NULL) {
|
|
|
|
err = cookie_manager_create_cookie_node(parent, data);
|
|
|
|
} else {
|
|
|
|
err = cookie_manager_update_cookie_node(cookie, data);
|
|
|
|
}
|
|
|
|
if (err != NSERROR_OK)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* exported interface documented in cookie_manager.h */
|
|
|
|
void cookie_manager_remove(const struct cookie_data *data)
|
|
|
|
{
|
|
|
|
struct cookie_manager_folder *parent = NULL;
|
|
|
|
struct cookie_manager_entry *cookie = NULL;
|
|
|
|
nserror err;
|
|
|
|
|
|
|
|
assert(data != NULL);
|
|
|
|
|
|
|
|
/* If we don't have a cookie manager at the moment, just return */
|
|
|
|
if (cm_ctx.tree == NULL)
|
|
|
|
return;
|
|
|
|
|
2013-07-26 01:31:27 +04:00
|
|
|
err = cookie_manager_find_folder(NULL, data->domain,
|
|
|
|
strlen(data->domain), &parent);
|
2013-07-25 19:07:46 +04:00
|
|
|
if (err != NSERROR_OK || parent == NULL) {
|
|
|
|
/* Nothing to delete */
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2013-07-26 01:31:27 +04:00
|
|
|
err = cookie_manager_find_entry(parent->folder, data->name,
|
|
|
|
strlen(data->name), &cookie);
|
2013-07-25 19:07:46 +04:00
|
|
|
if (err != NSERROR_OK || cookie == NULL) {
|
|
|
|
/* Nothing to delete */
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Delete the node */
|
2013-08-30 15:51:40 +04:00
|
|
|
treeview_delete_node(cm_ctx.tree, cookie->entry, TREE_OPTION_NONE);
|
2013-07-25 19:07:46 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Initialise the treeview entry feilds
|
|
|
|
*
|
|
|
|
* \return true on success, false on memory exhaustion
|
|
|
|
*/
|
|
|
|
static nserror cookie_manager_init_entry_fields(void)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
const char *label;
|
|
|
|
|
2013-07-26 18:20:19 +04:00
|
|
|
for (i = 0; i < COOKIE_M_N_FIELDS; i++)
|
2013-07-25 19:07:46 +04:00
|
|
|
cm_ctx.fields[i].field = NULL;
|
|
|
|
|
2013-07-26 18:20:19 +04:00
|
|
|
cm_ctx.fields[COOKIE_M_NAME].flags = TREE_FLAG_DEFAULT;
|
2013-07-25 19:07:46 +04:00
|
|
|
label = "TreeviewLabelName";
|
|
|
|
label = messages_get(label);
|
|
|
|
if (lwc_intern_string(label, strlen(label),
|
2013-07-26 18:20:19 +04:00
|
|
|
&cm_ctx.fields[COOKIE_M_NAME].field) !=
|
2013-07-25 19:07:46 +04:00
|
|
|
lwc_error_ok) {
|
|
|
|
goto error;
|
|
|
|
}
|
|
|
|
|
2013-07-26 18:20:19 +04:00
|
|
|
cm_ctx.fields[COOKIE_M_CONTENT].flags = TREE_FLAG_SHOW_NAME;
|
2013-07-25 19:07:46 +04:00
|
|
|
label = "TreeviewLabelContent";
|
|
|
|
label = messages_get(label);
|
|
|
|
if (lwc_intern_string(label, strlen(label),
|
2013-07-26 18:20:19 +04:00
|
|
|
&cm_ctx.fields[COOKIE_M_CONTENT].field) !=
|
2013-07-25 19:07:46 +04:00
|
|
|
lwc_error_ok) {
|
|
|
|
goto error;
|
|
|
|
}
|
|
|
|
|
2013-07-26 18:20:19 +04:00
|
|
|
cm_ctx.fields[COOKIE_M_DOMAIN].flags = TREE_FLAG_SHOW_NAME;
|
2013-07-25 19:07:46 +04:00
|
|
|
label = "TreeviewLabelDomain";
|
|
|
|
label = messages_get(label);
|
|
|
|
if (lwc_intern_string(label, strlen(label),
|
2013-07-26 18:20:19 +04:00
|
|
|
&cm_ctx.fields[COOKIE_M_DOMAIN].field) !=
|
2013-07-25 19:07:46 +04:00
|
|
|
lwc_error_ok) {
|
|
|
|
goto error;
|
|
|
|
}
|
|
|
|
|
2013-07-26 18:20:19 +04:00
|
|
|
cm_ctx.fields[COOKIE_M_PATH].flags = TREE_FLAG_SHOW_NAME;
|
2013-07-25 19:07:46 +04:00
|
|
|
label = "TreeviewLabelPath";
|
|
|
|
label = messages_get(label);
|
|
|
|
if (lwc_intern_string(label, strlen(label),
|
2013-07-26 18:20:19 +04:00
|
|
|
&cm_ctx.fields[COOKIE_M_PATH].field) !=
|
2013-07-25 19:07:46 +04:00
|
|
|
lwc_error_ok) {
|
|
|
|
goto error;
|
|
|
|
}
|
|
|
|
|
2013-07-26 18:20:19 +04:00
|
|
|
cm_ctx.fields[COOKIE_M_EXPIRES].flags = TREE_FLAG_SHOW_NAME;
|
2013-07-25 19:07:46 +04:00
|
|
|
label = "TreeviewLabelExpires";
|
|
|
|
label = messages_get(label);
|
|
|
|
if (lwc_intern_string(label, strlen(label),
|
2013-07-26 18:20:19 +04:00
|
|
|
&cm_ctx.fields[COOKIE_M_EXPIRES].field) !=
|
2013-07-25 19:07:46 +04:00
|
|
|
lwc_error_ok) {
|
|
|
|
goto error;
|
|
|
|
}
|
|
|
|
|
2013-07-26 18:20:19 +04:00
|
|
|
cm_ctx.fields[COOKIE_M_LAST_USED].flags = TREE_FLAG_SHOW_NAME;
|
2013-07-25 19:07:46 +04:00
|
|
|
label = "TreeviewLabelLastUsed";
|
|
|
|
label = messages_get(label);
|
|
|
|
if (lwc_intern_string(label, strlen(label),
|
2013-07-26 18:20:19 +04:00
|
|
|
&cm_ctx.fields[COOKIE_M_LAST_USED].field) !=
|
2013-07-25 19:07:46 +04:00
|
|
|
lwc_error_ok) {
|
|
|
|
goto error;
|
|
|
|
}
|
|
|
|
|
2013-07-26 18:20:19 +04:00
|
|
|
cm_ctx.fields[COOKIE_M_RESTRICTIONS].flags = TREE_FLAG_SHOW_NAME;
|
2013-07-25 19:07:46 +04:00
|
|
|
label = "TreeviewLabelRestrictions";
|
|
|
|
label = messages_get(label);
|
|
|
|
if (lwc_intern_string(label, strlen(label),
|
2013-07-26 18:20:19 +04:00
|
|
|
&cm_ctx.fields[COOKIE_M_RESTRICTIONS].field) !=
|
2013-07-25 19:07:46 +04:00
|
|
|
lwc_error_ok) {
|
|
|
|
goto error;
|
|
|
|
}
|
|
|
|
|
2013-07-26 18:20:19 +04:00
|
|
|
cm_ctx.fields[COOKIE_M_VERSION].flags = TREE_FLAG_SHOW_NAME;
|
2013-07-25 19:07:46 +04:00
|
|
|
label = "TreeviewLabelVersion";
|
|
|
|
label = messages_get(label);
|
|
|
|
if (lwc_intern_string(label, strlen(label),
|
2013-07-26 18:20:19 +04:00
|
|
|
&cm_ctx.fields[COOKIE_M_VERSION].field) !=
|
2013-07-25 19:07:46 +04:00
|
|
|
lwc_error_ok) {
|
|
|
|
goto error;
|
|
|
|
}
|
|
|
|
|
2013-07-26 18:20:19 +04:00
|
|
|
cm_ctx.fields[COOKIE_M_PERSISTENT].flags = TREE_FLAG_SHOW_NAME;
|
2013-07-25 19:07:46 +04:00
|
|
|
label = "TreeviewLabelPersistent";
|
|
|
|
label = messages_get(label);
|
|
|
|
if (lwc_intern_string(label, strlen(label),
|
2013-07-26 18:20:19 +04:00
|
|
|
&cm_ctx.fields[COOKIE_M_PERSISTENT].field) !=
|
2013-07-25 19:07:46 +04:00
|
|
|
lwc_error_ok) {
|
|
|
|
goto error;
|
|
|
|
}
|
|
|
|
|
2013-07-26 18:20:19 +04:00
|
|
|
cm_ctx.fields[COOKIE_M_DOMAIN_FOLDER].flags = TREE_FLAG_DEFAULT;
|
2013-07-25 19:07:46 +04:00
|
|
|
label = "TreeviewLabelDomainFolder";
|
|
|
|
label = messages_get(label);
|
|
|
|
if (lwc_intern_string(label, strlen(label),
|
2013-07-26 18:20:19 +04:00
|
|
|
&cm_ctx.fields[COOKIE_M_DOMAIN_FOLDER].field) !=
|
2013-07-25 19:07:46 +04:00
|
|
|
lwc_error_ok) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
return NSERROR_OK;
|
|
|
|
|
|
|
|
error:
|
2013-07-26 18:20:19 +04:00
|
|
|
for (i = 0; i < COOKIE_M_N_FIELDS; i++)
|
2013-07-25 19:07:46 +04:00
|
|
|
if (cm_ctx.fields[i].field != NULL)
|
|
|
|
lwc_string_unref(cm_ctx.fields[i].field);
|
|
|
|
|
|
|
|
return NSERROR_UNKNOWN;
|
|
|
|
}
|
|
|
|
|
2013-07-26 15:11:14 +04:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Initialise the common entry values
|
|
|
|
*
|
|
|
|
* \return true on success, false on memory exhaustion
|
|
|
|
*/
|
|
|
|
static nserror cookie_manager_init_common_values(void)
|
|
|
|
{
|
|
|
|
const char *temp;
|
|
|
|
|
|
|
|
/* Set the Restrictions text */
|
2013-07-26 15:49:41 +04:00
|
|
|
temp = messages_get("CookieManagerHTTPS");
|
2013-07-26 18:20:19 +04:00
|
|
|
cookie_manager_field_builder(COOKIE_M_RESTRICTIONS,
|
|
|
|
&cm_ctx.values[COOKIE_M_HTTPS], strdup(temp));
|
2013-07-26 15:11:14 +04:00
|
|
|
|
2013-07-26 15:49:41 +04:00
|
|
|
temp = messages_get("CookieManagerSecure");
|
2013-07-26 18:20:19 +04:00
|
|
|
cookie_manager_field_builder(COOKIE_M_RESTRICTIONS,
|
|
|
|
&cm_ctx.values[COOKIE_M_SECURE], strdup(temp));
|
2013-07-26 15:11:14 +04:00
|
|
|
|
2013-07-26 15:49:41 +04:00
|
|
|
temp = messages_get("CookieManagerHTTP");
|
2013-07-26 18:20:19 +04:00
|
|
|
cookie_manager_field_builder(COOKIE_M_RESTRICTIONS,
|
|
|
|
&cm_ctx.values[COOKIE_M_HTTP], strdup(temp));
|
2013-07-26 15:11:14 +04:00
|
|
|
|
2013-07-26 15:49:41 +04:00
|
|
|
temp = messages_get("None");
|
2013-07-26 18:20:19 +04:00
|
|
|
cookie_manager_field_builder(COOKIE_M_RESTRICTIONS,
|
|
|
|
&cm_ctx.values[COOKIE_M_NONE], strdup(temp));
|
2013-07-26 15:11:14 +04:00
|
|
|
|
|
|
|
/* Set the Cookie version text */
|
2013-07-26 15:16:53 +04:00
|
|
|
assert(COOKIE_NETSCAPE == 0);
|
|
|
|
temp = messages_get("TreeVersion0");
|
2013-07-26 18:20:19 +04:00
|
|
|
cookie_manager_field_builder(COOKIE_M_VERSION,
|
|
|
|
&cm_ctx.values[COOKIE_M_NETSCAPE], strdup(temp));
|
2013-07-26 15:11:14 +04:00
|
|
|
|
2013-07-26 15:16:53 +04:00
|
|
|
assert(COOKIE_RFC2109 == 1);
|
|
|
|
temp = messages_get("TreeVersion1");
|
2013-07-26 18:20:19 +04:00
|
|
|
cookie_manager_field_builder(COOKIE_M_VERSION,
|
|
|
|
&cm_ctx.values[COOKIE_M_RFC2109], strdup(temp));
|
2013-07-26 15:11:14 +04:00
|
|
|
|
2013-07-26 15:16:53 +04:00
|
|
|
assert(COOKIE_RFC2965 == 2);
|
|
|
|
temp = messages_get("TreeVersion2");
|
2013-07-26 18:20:19 +04:00
|
|
|
cookie_manager_field_builder(COOKIE_M_VERSION,
|
|
|
|
&cm_ctx.values[COOKIE_M_RFC2965], strdup(temp));
|
2013-07-26 15:11:14 +04:00
|
|
|
|
|
|
|
/* Set the Persistent value text */
|
|
|
|
temp = messages_get("Yes");
|
2013-07-26 18:20:19 +04:00
|
|
|
cookie_manager_field_builder(COOKIE_M_PERSISTENT,
|
|
|
|
&cm_ctx.values[COOKIE_M_YES], strdup(temp));
|
2013-07-26 15:11:14 +04:00
|
|
|
|
|
|
|
temp = messages_get("No");
|
2013-07-26 18:20:19 +04:00
|
|
|
cookie_manager_field_builder(COOKIE_M_PERSISTENT,
|
|
|
|
&cm_ctx.values[COOKIE_M_NO], strdup(temp));
|
2013-07-26 15:11:14 +04:00
|
|
|
|
|
|
|
return NSERROR_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-07-25 19:07:46 +04:00
|
|
|
/**
|
|
|
|
* Delete cookie manager entries (and optionally delete from urldb)
|
|
|
|
*
|
|
|
|
* \param e Cookie manager entry to delete.
|
|
|
|
*/
|
|
|
|
static void cookie_manager_delete_entry(struct cookie_manager_entry *e)
|
|
|
|
{
|
|
|
|
const char *domain;
|
|
|
|
const char *path;
|
|
|
|
const char *name;
|
|
|
|
|
|
|
|
if (e->user_delete) {
|
|
|
|
/* Delete the cookie from URLdb */
|
2013-07-26 18:20:19 +04:00
|
|
|
domain = e->data[COOKIE_M_DOMAIN].value;
|
|
|
|
path = e->data[COOKIE_M_PATH].value;
|
|
|
|
name = e->data[COOKIE_M_NAME].value;
|
2013-07-25 19:07:46 +04:00
|
|
|
|
|
|
|
if ((domain != NULL) && (path != NULL) && (name != NULL)) {
|
|
|
|
|
|
|
|
urldb_delete_cookie(domain, path, name);
|
|
|
|
} else {
|
|
|
|
LOG(("Delete cookie fail: "
|
|
|
|
"need domain, path, and name."));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Delete the cookie manager entry */
|
|
|
|
cookie_manager_free_treeview_field_data(e);
|
|
|
|
free(e);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static nserror cookie_manager_tree_node_folder_cb(
|
|
|
|
struct treeview_node_msg msg, void *data)
|
|
|
|
{
|
|
|
|
struct cookie_manager_folder *f = data;
|
|
|
|
|
|
|
|
switch (msg.msg) {
|
|
|
|
case TREE_MSG_NODE_DELETE:
|
|
|
|
free(f);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case TREE_MSG_NODE_EDIT:
|
|
|
|
break;
|
|
|
|
|
|
|
|
case TREE_MSG_NODE_LAUNCH:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return NSERROR_OK;
|
|
|
|
}
|
|
|
|
static nserror cookie_manager_tree_node_entry_cb(
|
|
|
|
struct treeview_node_msg msg, void *data)
|
|
|
|
{
|
|
|
|
struct cookie_manager_entry *e = data;
|
|
|
|
|
|
|
|
switch (msg.msg) {
|
|
|
|
case TREE_MSG_NODE_DELETE:
|
|
|
|
e->entry = NULL;
|
|
|
|
e->user_delete = msg.data.delete.user;
|
|
|
|
cookie_manager_delete_entry(e);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case TREE_MSG_NODE_EDIT:
|
|
|
|
break;
|
|
|
|
|
|
|
|
case TREE_MSG_NODE_LAUNCH:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return NSERROR_OK;
|
|
|
|
}
|
|
|
|
struct treeview_callback_table cm_tree_cb_t = {
|
|
|
|
.folder = cookie_manager_tree_node_folder_cb,
|
|
|
|
.entry = cookie_manager_tree_node_entry_cb
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/* Exported interface, documented in cookie_manager.h */
|
|
|
|
nserror cookie_manager_init(struct core_window_callback_table *cw_t,
|
|
|
|
void *core_window_handle)
|
|
|
|
{
|
|
|
|
nserror err;
|
|
|
|
|
|
|
|
LOG(("Generating cookie manager data"));
|
|
|
|
|
|
|
|
/* Init. cookie manager treeview entry fields */
|
|
|
|
err = cookie_manager_init_entry_fields();
|
|
|
|
if (err != NSERROR_OK) {
|
|
|
|
cm_ctx.tree = NULL;
|
|
|
|
return err;
|
|
|
|
}
|
|
|
|
|
2013-07-26 15:11:14 +04:00
|
|
|
/* Init. common treeview field values */
|
|
|
|
err = cookie_manager_init_common_values();
|
|
|
|
if (err != NSERROR_OK) {
|
|
|
|
cm_ctx.tree = NULL;
|
|
|
|
return err;
|
|
|
|
}
|
|
|
|
|
2013-07-25 19:07:46 +04:00
|
|
|
/* Create the cookie manager treeview */
|
|
|
|
err = treeview_create(&cm_ctx.tree, &cm_tree_cb_t,
|
2013-07-26 18:20:19 +04:00
|
|
|
COOKIE_M_N_FIELDS, cm_ctx.fields,
|
2013-07-25 19:07:46 +04:00
|
|
|
cw_t, core_window_handle,
|
|
|
|
TREEVIEW_NO_MOVES | TREEVIEW_DEL_EMPTY_DIRS);
|
|
|
|
if (err != NSERROR_OK) {
|
|
|
|
cm_ctx.tree = NULL;
|
|
|
|
return err;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Load the cookies */
|
|
|
|
urldb_iterate_cookies(cookie_manager_add);
|
|
|
|
|
|
|
|
/* Cookie manager is built
|
|
|
|
* We suppress the treeview height callback on entry insertion before
|
|
|
|
* the treeview is built. */
|
|
|
|
cm_ctx.built = true;
|
|
|
|
|
2013-09-03 17:38:01 +04:00
|
|
|
/* Inform client of window height */
|
|
|
|
treeview_get_height(cm_ctx.tree);
|
|
|
|
|
2013-07-25 19:07:46 +04:00
|
|
|
LOG(("Generated cookie manager data"));
|
|
|
|
|
|
|
|
return NSERROR_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Exported interface, documented in cookie_manager.h */
|
|
|
|
nserror cookie_manager_fini(void)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
nserror err;
|
|
|
|
|
|
|
|
LOG(("Finalising cookie manager"));
|
|
|
|
|
|
|
|
cm_ctx.built = false;
|
|
|
|
|
|
|
|
/* Destroy the cookie manager treeview */
|
|
|
|
err = treeview_destroy(cm_ctx.tree);
|
|
|
|
|
|
|
|
/* Free cookie manager treeview entry fields */
|
2013-07-26 18:20:19 +04:00
|
|
|
for (i = 0; i < COOKIE_M_N_FIELDS; i++)
|
2013-07-25 19:07:46 +04:00
|
|
|
if (cm_ctx.fields[i].field != NULL)
|
|
|
|
lwc_string_unref(cm_ctx.fields[i].field);
|
|
|
|
|
2013-07-26 15:11:14 +04:00
|
|
|
/* Free cookie manager treeview common entry values */
|
2013-07-26 18:20:19 +04:00
|
|
|
for (i = 0; i < COOKIE_M_N_VALUES; i++)
|
2013-07-26 15:11:14 +04:00
|
|
|
if (cm_ctx.values[i].value != NULL)
|
|
|
|
free((void *) cm_ctx.values[i].value);
|
|
|
|
|
2013-07-25 19:07:46 +04:00
|
|
|
LOG(("Finalised cookie manager"));
|
|
|
|
|
|
|
|
return err;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Exported interface, documented in cookie_manager.h */
|
|
|
|
void cookie_manager_redraw(int x, int y, struct rect *clip,
|
|
|
|
const struct redraw_context *ctx)
|
|
|
|
{
|
|
|
|
treeview_redraw(cm_ctx.tree, x, y, clip, ctx);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Exported interface, documented in cookie_manager.h */
|
2014-05-18 20:30:53 +04:00
|
|
|
void cookie_manager_mouse_action(enum browser_mouse_state mouse, int x, int y)
|
2013-07-25 19:07:46 +04:00
|
|
|
{
|
|
|
|
treeview_mouse_action(cm_ctx.tree, mouse, x, y);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Exported interface, documented in cookie_manager.h */
|
|
|
|
void cookie_manager_keypress(uint32_t key)
|
|
|
|
{
|
|
|
|
treeview_keypress(cm_ctx.tree, key);
|
|
|
|
}
|
|
|
|
|
2013-08-28 17:23:22 +04:00
|
|
|
|
|
|
|
/* Exported interface, documented in cookie_manager.h */
|
|
|
|
bool cookie_manager_has_selection(void)
|
|
|
|
{
|
|
|
|
return treeview_has_selection(cm_ctx.tree);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-09-03 14:28:02 +04:00
|
|
|
/* Exported interface, documented in cookie_manager.h */
|
|
|
|
nserror cookie_manager_expand(bool only_folders)
|
|
|
|
{
|
|
|
|
return treeview_expand(cm_ctx.tree, only_folders);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Exported interface, documented in cookie_manager.h */
|
|
|
|
nserror cookie_manager_contract(bool all)
|
|
|
|
{
|
|
|
|
return treeview_contract(cm_ctx.tree, all);
|
|
|
|
}
|
|
|
|
|