NetSurf
Functions
cookie_manager.h File Reference

Cookie Manager (interface). More...

#include <stdbool.h>
#include <stdint.h>
#include "utils/errors.h"
#include "netsurf/mouse.h"
Include dependency graph for cookie_manager.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

nserror cookie_manager_init (struct core_window_callback_table *cw_t, void *core_window_handle)
 Initialise the cookie manager. More...
 
nserror cookie_manager_fini (void)
 Finalise the cookie manager. More...
 
bool cookie_manager_add (const struct cookie_data *data)
 Add/update a cookie to the viewer. More...
 
void cookie_manager_remove (const struct cookie_data *data)
 Remove a cookie from viewer. More...
 
nserror cookie_manager_set_search_string (const char *string)
 Set the cookie manager search string. More...
 
void cookie_manager_redraw (int x, int y, struct rect *clip, const struct redraw_context *ctx)
 Redraw the cookies manager. More...
 
void cookie_manager_mouse_action (enum browser_mouse_state mouse, int x, int y)
 Handles all kinds of mouse action. More...
 
bool cookie_manager_keypress (uint32_t key)
 Key press handling. More...
 
bool cookie_manager_has_selection (void)
 Determine whether there is a selection. More...
 
nserror cookie_manager_expand (bool only_folders)
 Expand the treeview's nodes. More...
 
nserror cookie_manager_contract (bool all)
 Contract the treeview's nodes. More...
 

Detailed Description

Cookie Manager (interface).

Definition in file cookie_manager.h.

Function Documentation

◆ cookie_manager_add()

bool cookie_manager_add ( const struct cookie_data data)

Add/update a cookie to the viewer.

(Called by urldb.)

Parameters
dataData of cookie being added/updated.
Returns
true (for urldb_iterate_entries)

Definition at line 467 of file cookie_manager.c.

References cm_ctx, cookie_manager_create_cookie_node(), cookie_manager_create_domain_folder(), cookie_manager_find_entry(), cookie_manager_find_folder(), cookie_manager_update_cookie_node(), cookie_manager_entry::data, NSERROR_OK, parent, and cookie_manager_ctx::tree.

Referenced by cookie_manager_init(), urldb_get_cookie(), and urldb_insert_cookie().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cookie_manager_contract()

nserror cookie_manager_contract ( bool  all)

Contract the treeview's nodes.

Parameters
allIff false, only entries are contracted.
Returns
NSERROR_OK on success, appropriate error otherwise

Definition at line 918 of file cookie_manager.c.

References cm_ctx, cookie_manager_ctx::tree, and treeview_contract().

Referenced by cookie_menu_select(), cookie_toolbar_click(), HOOKF(), and MENUHANDLER().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cookie_manager_expand()

nserror cookie_manager_expand ( bool  only_folders)

Expand the treeview's nodes.

Parameters
only_foldersIff true, only folders are expanded.
Returns
NSERROR_OK on success, appropriate error otherwise

Definition at line 911 of file cookie_manager.c.

References cm_ctx, cookie_manager_ctx::tree, and treeview_expand().

Referenced by cookie_menu_select(), cookie_toolbar_click(), HOOKF(), and MENUHANDLER().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cookie_manager_fini()

nserror cookie_manager_fini ( void  )

Finalise the cookie manager.

This destroys the cookie manager treeview and the cookie manager module's internal data. After calling this if the cookie manager is required again, cookie_manager_init must be called.

Returns
NSERROR_OK on success, appropriate error otherwise

Definition at line 847 of file cookie_manager.c.

References cookie_manager_ctx::built, cm_ctx, COOKIE_M_N_FIELDS, COOKIE_M_N_VALUES, treeview_field_desc::field, cookie_manager_ctx::fields, NSERROR_OK, NSLOG, cookie_manager_ctx::tree, treeview_destroy(), treeview_fini(), treeview_field_data::value, and cookie_manager_ctx::values.

Referenced by ami_cookies_destroy(), atari_cookie_manager_finish(), nsgtk_cookies_destroy(), nsw32_cookies_finalise(), and ro_gui_cookies_finalise().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cookie_manager_has_selection()

bool cookie_manager_has_selection ( void  )

Determine whether there is a selection.

Returns
true iff there is a selection

Definition at line 904 of file cookie_manager.c.

References cm_ctx, cookie_manager_ctx::tree, and treeview_has_selection().

Referenced by cookie_menu_prepare(), and cookie_toolbar_update().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cookie_manager_init()

nserror cookie_manager_init ( struct core_window_callback_table cw_t,
void *  core_window_handle 
)

Initialise the cookie manager.

This iterates through the URL database, enumerating the cookies and creates a treeview.

This must be called before any other cookie_manager_* function.

Parameters
cw_tCallback table for core_window containing the treeview
core_window_handleThe core_window in which the treeview is shown
Returns
NSERROR_OK on success, appropriate error otherwise

Definition at line 791 of file cookie_manager.c.

References cookie_manager_ctx::built, cm_ctx, cm_tree_cb_t, COOKIE_M_N_FIELDS, cookie_manager_add(), cookie_manager_init_common_values(), cookie_manager_init_entry_fields(), cw_t, cookie_manager_ctx::fields, NSERROR_OK, NSLOG, cookie_manager_ctx::tree, treeview_create(), TREEVIEW_DEL_EMPTY_DIRS, treeview_get_height(), treeview_init(), TREEVIEW_NO_MOVES, TREEVIEW_SEARCHABLE, and urldb_iterate_cookies().

Referenced by ami_cookies_present(), atari_cookie_manager_init_phase2(), nsgtk_cookies_init(), nsw32_cookie_init(), and ro_cookie_init().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cookie_manager_keypress()

bool cookie_manager_keypress ( uint32_t  key)

Key press handling.

Parameters
keyThe ucs4 character codepoint
Returns
true if the keypress is dealt with, false otherwise.

Definition at line 897 of file cookie_manager.c.

References cm_ctx, cookie_manager_ctx::tree, and treeview_keypress().

Referenced by ami_cookies_key(), atari_cookie_manager_keypress(), cookie_key(), cookie_menu_select(), cookie_toolbar_click(), HOOKF(), MENUHANDLER(), nsgtk_cookies_key(), nsw32_cookie_key(), and ro_gui_window_menu_select().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cookie_manager_mouse_action()

void cookie_manager_mouse_action ( enum browser_mouse_state  mouse,
int  x,
int  y 
)

Handles all kinds of mouse action.

Parameters
mouseThe current mouse state
xX coordinate
yY coordinate

Definition at line 890 of file cookie_manager.c.

References cm_ctx, cookie_manager_ctx::tree, and treeview_mouse_action().

Referenced by ami_cookies_mouse(), atari_cookie_manager_mouse_action(), cookie_mouse(), nsgtk_cookies_mouse(), and nsw32_cookie_mouse().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cookie_manager_redraw()

void cookie_manager_redraw ( int  x,
int  y,
struct rect clip,
const struct redraw_context ctx 
)

Redraw the cookies manager.

Parameters
xX coordinate to render treeview at
yY coordinate to render treeview at
clipCurrent clip rectangle (wrt tree origin)
ctxCurrent redraw context

Definition at line 882 of file cookie_manager.c.

References clip(), cm_ctx, cookie_manager_ctx::tree, and treeview_redraw().

Referenced by ami_cookies_draw(), atari_cookie_manager_draw(), cookie_draw(), nsgtk_cookies_draw(), and nsw32_cookie_draw().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cookie_manager_remove()

void cookie_manager_remove ( const struct cookie_data data)

Remove a cookie from viewer.

(Called by urldb.)

Parameters
dataData of cookie being removed.

Definition at line 511 of file cookie_manager.c.

References cm_ctx, cookie_manager_find_entry(), cookie_manager_find_folder(), cookie_manager_entry::data, cookie_manager_entry::entry, NSERROR_OK, parent, cookie_manager_ctx::tree, TREE_OPTION_NONE, and treeview_delete_node().

Referenced by urldb_insert_cookie().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cookie_manager_set_search_string()

nserror cookie_manager_set_search_string ( const char *  string)

Set the cookie manager search string.

Parameters
stringSering to set as search string.
Returns
NSERROR_OK on success, appropriate error otherwise

Definition at line 543 of file cookie_manager.c.

References cm_ctx, NSERROR_NOT_FOUND, cookie_manager_ctx::tree, and treeview_set_search_string().

Referenced by ami_cookies_present(), nsgtk_cookies_present(), nsw32_cookies_present(), and ro_gui_cookies_present().

Here is the call graph for this function:
Here is the caller graph for this function: