2010-03-28 16:56:39 +04:00
|
|
|
/*
|
|
|
|
* Copyright 2005-2007 James Bursa <bursa@users.sourceforge.net>
|
|
|
|
* Copyright 2003 Philip Pemberton <philpem@users.sourceforge.net>
|
|
|
|
*
|
|
|
|
* 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/>.
|
|
|
|
*/
|
|
|
|
|
2019-05-06 00:46:40 +03:00
|
|
|
/**
|
|
|
|
* \file
|
|
|
|
* Protected interface to Content handling.
|
2010-03-28 16:56:39 +04:00
|
|
|
*
|
|
|
|
* The content functions manipulate struct contents, which correspond to URLs.
|
|
|
|
*/
|
|
|
|
|
2020-05-07 01:38:50 +03:00
|
|
|
#ifndef NETSURF_CONTENT_CONTENT_PROTECTED_H_
|
|
|
|
#define NETSURF_CONTENT_CONTENT_PROTECTED_H_
|
2010-03-28 16:56:39 +04:00
|
|
|
|
2016-04-19 01:04:16 +03:00
|
|
|
#include <stdio.h>
|
2020-05-07 22:55:44 +03:00
|
|
|
#include <libwapcaplet/libwapcaplet.h>
|
2016-04-19 01:04:16 +03:00
|
|
|
|
2016-06-06 10:59:23 +03:00
|
|
|
#include "netsurf/content_type.h"
|
2020-05-07 22:55:44 +03:00
|
|
|
#include "desktop/search.h" /* search flags enum */
|
|
|
|
#include "netsurf/mouse.h" /* mouse state enums */
|
2016-06-06 10:59:23 +03:00
|
|
|
|
2020-05-07 01:38:50 +03:00
|
|
|
struct nsurl;
|
2016-06-06 10:59:23 +03:00
|
|
|
struct content_redraw_data;
|
2020-05-07 22:55:44 +03:00
|
|
|
union content_msg_data;
|
2016-04-19 01:04:16 +03:00
|
|
|
struct http_parameter;
|
2020-05-07 01:38:50 +03:00
|
|
|
struct llcache_handle;
|
|
|
|
struct object_params;
|
2020-05-07 22:55:44 +03:00
|
|
|
struct content;
|
|
|
|
struct redraw_context;
|
|
|
|
struct rect;
|
|
|
|
struct browser_window_features;
|
|
|
|
|
|
|
|
typedef struct content_handler content_handler;
|
2010-03-28 16:56:39 +04:00
|
|
|
|
2020-05-07 01:38:50 +03:00
|
|
|
/**
|
|
|
|
* Content operation function table
|
|
|
|
*
|
|
|
|
* function table implementing a content type.
|
|
|
|
*/
|
2011-05-07 00:40:09 +04:00
|
|
|
struct content_handler {
|
2011-09-16 02:47:50 +04:00
|
|
|
void (*fini)(void);
|
|
|
|
|
2016-06-06 10:59:23 +03:00
|
|
|
nserror (*create)(const struct content_handler *handler,
|
2016-04-19 01:04:16 +03:00
|
|
|
lwc_string *imime_type,
|
|
|
|
const struct http_parameter *params,
|
2016-06-06 10:59:23 +03:00
|
|
|
struct llcache_handle *llcache,
|
2016-04-19 01:04:16 +03:00
|
|
|
const char *fallback_charset, bool quirks,
|
|
|
|
struct content **c);
|
2011-05-07 00:40:09 +04:00
|
|
|
|
2020-05-07 01:38:50 +03:00
|
|
|
bool (*process_data)(struct content *c,
|
2011-05-07 00:40:09 +04:00
|
|
|
const char *data, unsigned int size);
|
2011-05-09 19:32:34 +04:00
|
|
|
bool (*data_complete)(struct content *c);
|
2011-05-07 00:40:09 +04:00
|
|
|
void (*reformat)(struct content *c, int width, int height);
|
|
|
|
void (*destroy)(struct content *c);
|
|
|
|
void (*stop)(struct content *c);
|
2019-11-13 01:48:00 +03:00
|
|
|
nserror (*mouse_track)(struct content *c, struct browser_window *bw,
|
2011-05-07 00:40:09 +04:00
|
|
|
browser_mouse_state mouse, int x, int y);
|
2019-11-13 01:48:00 +03:00
|
|
|
nserror (*mouse_action)(struct content *c, struct browser_window *bw,
|
2011-05-07 00:40:09 +04:00
|
|
|
browser_mouse_state mouse, int x, int y);
|
2013-02-22 16:19:35 +04:00
|
|
|
bool (*keypress)(struct content *c, uint32_t key);
|
2011-06-29 00:17:39 +04:00
|
|
|
bool (*redraw)(struct content *c, struct content_redraw_data *data,
|
2011-06-30 19:48:07 +04:00
|
|
|
const struct rect *clip,
|
|
|
|
const struct redraw_context *ctx);
|
2019-07-10 18:42:52 +03:00
|
|
|
nserror (*open)(struct content *c, struct browser_window *bw,
|
2012-08-20 17:22:28 +04:00
|
|
|
struct content *page, struct object_params *params);
|
2019-07-10 18:42:52 +03:00
|
|
|
nserror (*close)(struct content *c);
|
2013-02-22 16:19:35 +04:00
|
|
|
void (*clear_selection)(struct content *c);
|
|
|
|
char * (*get_selection)(struct content *c);
|
2014-11-02 18:46:42 +03:00
|
|
|
nserror (*get_contextual_content)(struct content *c, int x, int y,
|
|
|
|
struct browser_window_features *data);
|
2011-11-29 21:47:29 +04:00
|
|
|
bool (*scroll_at_point)(struct content *c, int x, int y,
|
|
|
|
int scrx, int scry);
|
2011-12-02 01:49:57 +04:00
|
|
|
bool (*drop_file_at_point)(struct content *c, int x, int y,
|
|
|
|
char *file);
|
2014-03-19 02:32:52 +04:00
|
|
|
void (*search)(struct content *c, void *context, search_flags_t flags,
|
|
|
|
const char *string);
|
2013-05-07 17:41:40 +04:00
|
|
|
void (*search_clear)(struct content *c);
|
2014-08-04 03:36:14 +04:00
|
|
|
nserror (*debug_dump)(struct content *c, FILE *f, enum content_debug op);
|
2014-11-07 01:51:46 +03:00
|
|
|
nserror (*debug)(struct content *c, enum content_debug op);
|
2011-05-07 00:40:09 +04:00
|
|
|
nserror (*clone)(const struct content *old, struct content **newc);
|
|
|
|
bool (*matches_quirks)(const struct content *c, bool quirks);
|
2014-11-07 15:33:34 +03:00
|
|
|
const char *(*get_encoding)(const struct content *c, enum content_encoding_type op);
|
2011-09-03 13:27:42 +04:00
|
|
|
content_type (*type)(void);
|
2015-10-31 17:32:22 +03:00
|
|
|
void (*add_user)(struct content *c);
|
|
|
|
void (*remove_user)(struct content *c);
|
2019-05-05 17:37:56 +03:00
|
|
|
bool (*exec)(struct content *c, const char *src, size_t srclen);
|
2019-12-01 18:49:08 +03:00
|
|
|
bool (*saw_insecure_objects)(struct content *c);
|
2011-08-31 16:12:41 +04:00
|
|
|
|
2020-05-07 01:38:50 +03:00
|
|
|
/**
|
|
|
|
* handler dependant content sensitive internal data interface.
|
|
|
|
*/
|
2011-08-31 16:12:41 +04:00
|
|
|
void * (*get_internal)(const struct content *c, void *context);
|
|
|
|
|
2020-05-07 01:38:50 +03:00
|
|
|
/**
|
|
|
|
* There must be one content per user for this type.
|
|
|
|
*/
|
2011-05-07 00:40:09 +04:00
|
|
|
bool no_share;
|
|
|
|
};
|
|
|
|
|
2020-05-07 01:38:50 +03:00
|
|
|
/**
|
|
|
|
* Linked list of users of a content.
|
|
|
|
*/
|
2010-03-28 16:56:39 +04:00
|
|
|
struct content_user
|
|
|
|
{
|
2017-08-26 18:38:18 +03:00
|
|
|
void (*callback)(
|
|
|
|
struct content *c,
|
|
|
|
content_msg msg,
|
|
|
|
const union content_msg_data *data,
|
|
|
|
void *pw);
|
2010-03-28 16:56:39 +04:00
|
|
|
void *pw;
|
|
|
|
|
|
|
|
struct content_user *next;
|
|
|
|
};
|
|
|
|
|
2020-05-07 01:38:50 +03:00
|
|
|
/**
|
|
|
|
* Content which corresponds to a single URL.
|
|
|
|
*/
|
2010-03-28 16:56:39 +04:00
|
|
|
struct content {
|
2020-05-07 01:38:50 +03:00
|
|
|
/**
|
|
|
|
* Low-level cache object
|
|
|
|
*/
|
|
|
|
struct llcache_handle *llcache;
|
2010-03-28 16:56:39 +04:00
|
|
|
|
2020-05-07 01:38:50 +03:00
|
|
|
/**
|
|
|
|
* Original MIME type of data
|
|
|
|
*/
|
|
|
|
lwc_string *mime_type;
|
2011-05-07 00:40:09 +04:00
|
|
|
|
2020-05-07 01:38:50 +03:00
|
|
|
/**
|
|
|
|
* Handler for content
|
|
|
|
*/
|
|
|
|
const struct content_handler *handler;
|
2010-03-28 16:56:39 +04:00
|
|
|
|
2020-05-07 01:38:50 +03:00
|
|
|
/**
|
|
|
|
* Current status.
|
|
|
|
*/
|
|
|
|
content_status status;
|
2010-03-28 16:56:39 +04:00
|
|
|
|
2020-05-07 01:38:50 +03:00
|
|
|
/**
|
|
|
|
* Width dimension, if applicable.
|
|
|
|
*/
|
|
|
|
int width;
|
|
|
|
/**
|
|
|
|
* Height dimension, if applicable.
|
|
|
|
*/
|
|
|
|
int height;
|
|
|
|
/**
|
|
|
|
* Viewport width.
|
|
|
|
*/
|
|
|
|
int available_width;
|
|
|
|
/**
|
|
|
|
* Viewport height.
|
|
|
|
*/
|
|
|
|
int available_height;
|
2010-03-28 16:56:39 +04:00
|
|
|
|
2020-05-07 01:38:50 +03:00
|
|
|
/**
|
|
|
|
* Content is in quirks mode
|
|
|
|
*/
|
|
|
|
bool quirks;
|
|
|
|
/**
|
|
|
|
* Fallback charset, or NULL
|
|
|
|
*/
|
|
|
|
char *fallback_charset;
|
2010-03-28 16:56:39 +04:00
|
|
|
|
2020-05-07 01:38:50 +03:00
|
|
|
/**
|
|
|
|
* URL for refresh request
|
|
|
|
*/
|
|
|
|
struct nsurl *refresh;
|
2010-03-28 16:56:39 +04:00
|
|
|
|
2020-05-07 01:38:50 +03:00
|
|
|
/**
|
|
|
|
* list of metadata links
|
|
|
|
*/
|
|
|
|
struct content_rfc5988_link *links;
|
2011-10-07 22:12:47 +04:00
|
|
|
|
2020-05-07 01:38:50 +03:00
|
|
|
/**
|
|
|
|
* Creation timestamp when LOADING or READY. Total time in ms
|
|
|
|
* when DONE.
|
2016-04-21 00:58:48 +03:00
|
|
|
*/
|
|
|
|
uint64_t time;
|
2010-03-28 16:56:39 +04:00
|
|
|
|
2020-05-07 01:38:50 +03:00
|
|
|
/**
|
|
|
|
* Earliest time to attempt a period reflow while fetching a
|
|
|
|
* page's objects.
|
|
|
|
*/
|
|
|
|
uint64_t reformat_time;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Estimated size of all data associated with this content
|
|
|
|
*/
|
|
|
|
unsigned int size;
|
|
|
|
/**
|
|
|
|
* Title for browser window.
|
|
|
|
*/
|
|
|
|
char *title;
|
|
|
|
/**
|
|
|
|
* Number of child fetches or conversions currently in progress.
|
|
|
|
*/
|
|
|
|
unsigned int active;
|
|
|
|
/**
|
|
|
|
* List of users.
|
|
|
|
*/
|
|
|
|
struct content_user *user_list;
|
|
|
|
/**
|
|
|
|
* Full text for status bar.
|
|
|
|
*/
|
|
|
|
char status_message[120];
|
|
|
|
/**
|
|
|
|
* Status of content.
|
|
|
|
*/
|
|
|
|
char sub_status[80];
|
|
|
|
/**
|
|
|
|
* Content is being processed: data structures may be
|
|
|
|
* inconsistent and content must not be redrawn or modified.
|
|
|
|
*/
|
2010-03-28 16:56:39 +04:00
|
|
|
bool locked;
|
|
|
|
|
2020-05-07 01:38:50 +03:00
|
|
|
/**
|
|
|
|
* Total data size, 0 if unknown.
|
|
|
|
*/
|
|
|
|
unsigned long total_size;
|
|
|
|
/**
|
|
|
|
* HTTP status code, 0 if not HTTP.
|
|
|
|
*/
|
|
|
|
long http_code;
|
2010-03-28 16:56:39 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
extern const char * const content_type_name[];
|
|
|
|
extern const char * const content_status_name[];
|
|
|
|
|
2020-05-07 01:38:50 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Initialise a new base content structure.
|
|
|
|
*
|
|
|
|
* \param c Content to initialise
|
|
|
|
* \param handler Content handler
|
|
|
|
* \param imime_type MIME type of content
|
|
|
|
* \param params HTTP parameters
|
|
|
|
* \param llcache Source data handle
|
|
|
|
* \param fallback_charset Fallback charset
|
|
|
|
* \param quirks Quirkiness of content
|
|
|
|
* \return NSERROR_OK on success, appropriate error otherwise
|
|
|
|
*/
|
2016-06-06 10:59:23 +03:00
|
|
|
nserror content__init(struct content *c, const struct content_handler *handler,
|
2016-04-19 01:04:16 +03:00
|
|
|
lwc_string *imime_type, const struct http_parameter *params,
|
2011-05-07 00:40:09 +04:00
|
|
|
struct llcache_handle *llcache, const char *fallback_charset,
|
|
|
|
bool quirks);
|
2020-05-07 01:38:50 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Clone a content's data members
|
|
|
|
*
|
|
|
|
* \param c Content to clone
|
|
|
|
* \param nc Content to populate
|
|
|
|
* \return NSERROR_OK on success, appropriate error otherwise
|
|
|
|
*/
|
2011-05-07 00:40:09 +04:00
|
|
|
nserror content__clone(const struct content *c, struct content *nc);
|
|
|
|
|
2020-05-07 01:38:50 +03:00
|
|
|
/**
|
|
|
|
* Put a content in status CONTENT_STATUS_READY and unlock the content.
|
|
|
|
*/
|
2010-04-09 22:52:44 +04:00
|
|
|
void content_set_ready(struct content *c);
|
2020-05-07 01:38:50 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Put a content in status CONTENT_STATUS_DONE.
|
|
|
|
*/
|
2010-03-28 16:56:39 +04:00
|
|
|
void content_set_done(struct content *c);
|
2020-05-07 01:38:50 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Put a content in status CONTENT_STATUS_ERROR and unlock the content.
|
|
|
|
*
|
|
|
|
* \note We expect the caller to broadcast an error report if needed.
|
|
|
|
*/
|
2011-07-21 01:39:51 +04:00
|
|
|
void content_set_error(struct content *c);
|
|
|
|
|
2020-05-07 01:38:50 +03:00
|
|
|
/**
|
|
|
|
* Updates content with new status.
|
|
|
|
*
|
|
|
|
* The textual status contained in the content is updated with given string.
|
|
|
|
*
|
|
|
|
* \param c The content to set status in.
|
|
|
|
* \param status_message new textual status
|
|
|
|
*/
|
2012-08-15 14:50:08 +04:00
|
|
|
void content_set_status(struct content *c, const char *status_message);
|
2020-05-07 01:38:50 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Send a message to all users.
|
|
|
|
*/
|
|
|
|
void content_broadcast(struct content *c, content_msg msg, const union content_msg_data *data);
|
|
|
|
|
2012-11-26 20:24:48 +04:00
|
|
|
/**
|
2019-08-05 17:25:15 +03:00
|
|
|
* Send an error message to all users.
|
|
|
|
*
|
|
|
|
* \param c The content whose users should be informed of an error
|
|
|
|
* \param errorcode The nserror code to send
|
|
|
|
* \param msg The error message to send alongside
|
2012-11-26 20:24:48 +04:00
|
|
|
*/
|
2019-08-05 17:25:15 +03:00
|
|
|
void content_broadcast_error(struct content *c, nserror errorcode, const char *msg);
|
2012-11-26 20:24:48 +04:00
|
|
|
|
2020-05-07 01:38:50 +03:00
|
|
|
/**
|
|
|
|
* associate a metadata link with a content.
|
|
|
|
*
|
|
|
|
* \param c content to add link to
|
|
|
|
* \param link The rfc5988 link to add
|
|
|
|
*/
|
|
|
|
bool content__add_rfc5988_link(struct content *c, const struct content_rfc5988_link *link);
|
2011-10-07 22:12:47 +04:00
|
|
|
|
2020-05-07 01:38:50 +03:00
|
|
|
/**
|
|
|
|
* free a rfc5988 link
|
|
|
|
*
|
|
|
|
* \param link The link to free
|
|
|
|
* \return The next link in the chain
|
|
|
|
*/
|
|
|
|
struct content_rfc5988_link *content__free_rfc5988_link(struct content_rfc5988_link *link);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* cause a content to be reformatted.
|
|
|
|
*
|
|
|
|
* \param c content to be reformatted
|
|
|
|
* \param background perform reformat in background
|
|
|
|
* \param width The available width to reformat content in
|
|
|
|
* \param height The available height to reformat content in
|
|
|
|
*/
|
|
|
|
void content__reformat(struct content *c, bool background, int width, int height);
|
2010-03-28 16:56:39 +04:00
|
|
|
|
2020-05-07 01:38:50 +03:00
|
|
|
/**
|
|
|
|
* Request a redraw of an area of a content
|
|
|
|
*
|
|
|
|
* \param c Content
|
|
|
|
* \param x x co-ord of left edge
|
|
|
|
* \param y y co-ord of top edge
|
|
|
|
* \param width Width of rectangle
|
|
|
|
* \param height Height of rectangle
|
|
|
|
*/
|
|
|
|
void content__request_redraw(struct content *c, int x, int y, int width, int height);
|
2010-03-28 16:56:39 +04:00
|
|
|
|
2014-11-09 01:08:29 +03:00
|
|
|
/**
|
|
|
|
* Retrieve mime-type of content
|
|
|
|
*
|
|
|
|
* \param c Content to retrieve mime-type of
|
|
|
|
* \return Pointer to referenced mime-type, or NULL if not found.
|
|
|
|
*/
|
2011-05-07 00:40:09 +04:00
|
|
|
lwc_string *content__get_mime_type(struct content *c);
|
2014-11-09 01:08:29 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Set title associated with content
|
|
|
|
*
|
|
|
|
* \param c Content to set title on.
|
2014-11-09 15:50:30 +03:00
|
|
|
* \param title The new title to set.
|
2014-11-09 01:08:29 +03:00
|
|
|
* \return true on sucess else false.
|
|
|
|
*/
|
|
|
|
bool content__set_title(struct content *c, const char *title);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Retrieve title associated with content
|
|
|
|
*
|
|
|
|
* \param c Content to retrieve title from
|
|
|
|
* \return Pointer to title, or NULL if not found.
|
|
|
|
*/
|
2010-03-28 16:56:39 +04:00
|
|
|
const char *content__get_title(struct content *c);
|
2014-11-09 01:08:29 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Retrieve status message associated with content
|
|
|
|
*
|
|
|
|
* \param c Content to retrieve status message from
|
|
|
|
* \return Pointer to status message, or NULL if not found.
|
|
|
|
*/
|
2010-03-28 16:56:39 +04:00
|
|
|
const char *content__get_status_message(struct content *c);
|
2014-11-09 01:08:29 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Retrieve width of content
|
|
|
|
*
|
|
|
|
* \param c Content to retrieve width of
|
|
|
|
* \return Content width
|
|
|
|
*/
|
2010-03-28 16:56:39 +04:00
|
|
|
int content__get_width(struct content *c);
|
2014-11-09 01:08:29 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Retrieve height of content
|
|
|
|
*
|
|
|
|
* \param c Content to retrieve height of
|
|
|
|
* \return Content height
|
|
|
|
*/
|
2010-03-28 16:56:39 +04:00
|
|
|
int content__get_height(struct content *c);
|
2014-11-09 01:08:29 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Retrieve available width of content
|
|
|
|
*
|
|
|
|
* \param c content to get available width of.
|
|
|
|
* \return Available width of content.
|
|
|
|
*/
|
2010-03-28 16:56:39 +04:00
|
|
|
int content__get_available_width(struct content *c);
|
2014-11-09 01:08:29 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Retrieve source of content.
|
|
|
|
*
|
|
|
|
* \param c Content to retrieve source of.
|
|
|
|
* \param size Pointer to location to receive byte size of source.
|
|
|
|
* \return Pointer to source data.
|
|
|
|
*/
|
2019-05-06 00:46:40 +03:00
|
|
|
const uint8_t *content__get_source_data(struct content *c, size_t *size);
|
2014-11-08 19:49:32 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Invalidate content reuse data.
|
|
|
|
*
|
|
|
|
* causes subsequent requests for content URL to query server to
|
|
|
|
* determine if content can be reused. This is required behaviour for
|
|
|
|
* forced reloads etc.
|
|
|
|
*
|
|
|
|
* \param c Content to invalidate.
|
|
|
|
*/
|
2010-03-28 16:56:39 +04:00
|
|
|
void content__invalidate_reuse_data(struct content *c);
|
2014-11-08 19:49:32 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Retrieve the refresh URL for a content
|
|
|
|
*
|
|
|
|
* \param c Content to retrieve refresh URL from
|
|
|
|
* \return Pointer to URL or NULL if none
|
|
|
|
*/
|
2020-05-07 01:38:50 +03:00
|
|
|
struct nsurl *content__get_refresh_url(struct content *c);
|
2014-11-08 19:49:32 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Retrieve the bitmap contained in an image content
|
|
|
|
*
|
|
|
|
* \param c Content to retrieve opacity from
|
|
|
|
* \return Pointer to bitmap or NULL if none.
|
|
|
|
*/
|
2010-03-28 16:56:39 +04:00
|
|
|
struct bitmap *content__get_bitmap(struct content *c);
|
2014-11-08 19:49:32 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Determine if a content is opaque
|
|
|
|
*
|
|
|
|
* \param c Content to retrieve opacity from
|
|
|
|
* \return false if the content is not opaque or information is not
|
|
|
|
* known else true.
|
|
|
|
*/
|
2011-08-31 16:12:41 +04:00
|
|
|
bool content__get_opaque(struct content *c);
|
2014-11-08 19:49:32 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Retrieve the encoding of a content
|
|
|
|
*
|
|
|
|
* \param c the content to examine the encoding of.
|
|
|
|
* \param op encoding operation.
|
|
|
|
* \return Pointer to content info or NULL if none.
|
|
|
|
*/
|
2014-11-07 15:33:34 +03:00
|
|
|
const char *content__get_encoding(struct content *c, enum content_encoding_type op);
|
2014-11-08 19:49:32 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Return whether a content is currently locked
|
|
|
|
*
|
|
|
|
* \param c Content to test
|
|
|
|
* \return true iff locked, else false
|
|
|
|
*/
|
2010-04-07 22:50:18 +04:00
|
|
|
bool content__is_locked(struct content *c);
|
|
|
|
|
2020-05-07 22:55:44 +03:00
|
|
|
/**
|
|
|
|
* Destroy and free a content.
|
|
|
|
*
|
|
|
|
* Calls the destroy function for the content, and frees the structure.
|
|
|
|
*/
|
|
|
|
void content_destroy(struct content *c);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Register a user for callbacks.
|
|
|
|
*
|
|
|
|
* \param c the content to register
|
|
|
|
* \param callback the user callback function
|
|
|
|
* \param pw callback private data
|
|
|
|
* \return true on success, false otherwise on memory exhaustion
|
|
|
|
*
|
|
|
|
* The callback will be called when content_broadcast() is
|
|
|
|
* called with the content.
|
|
|
|
*/
|
|
|
|
bool content_add_user(struct content *h,
|
|
|
|
void (*callback)(
|
|
|
|
struct content *c,
|
|
|
|
content_msg msg,
|
|
|
|
const union content_msg_data *data,
|
|
|
|
void *pw),
|
|
|
|
void *pw);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Remove a callback user.
|
|
|
|
*
|
|
|
|
* The callback function and pw must be identical to those passed to
|
|
|
|
* content_add_user().
|
|
|
|
*
|
|
|
|
* \param c Content to remove user from
|
|
|
|
* \param callback passed when added
|
|
|
|
* \param ctx Context passed when added
|
|
|
|
*/
|
|
|
|
void content_remove_user(struct content *c,
|
|
|
|
void (*callback)(
|
|
|
|
struct content *c,
|
|
|
|
content_msg msg,
|
|
|
|
const union content_msg_data *data,
|
|
|
|
void *pw),
|
|
|
|
void *ctx);
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Count users for the content.
|
|
|
|
*
|
|
|
|
* \param c Content to consider
|
|
|
|
*/
|
|
|
|
uint32_t content_count_users(struct content *c);
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Determine if quirks mode matches
|
|
|
|
*
|
|
|
|
* \param c Content to consider
|
|
|
|
* \param quirks Quirks mode to match
|
|
|
|
* \return True if quirks match, false otherwise
|
|
|
|
*/
|
|
|
|
bool content_matches_quirks(struct content *c, bool quirks);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Determine if a content is shareable
|
|
|
|
*
|
|
|
|
* \param c Content to consider
|
|
|
|
* \return True if content is shareable, false otherwise
|
|
|
|
*/
|
|
|
|
bool content_is_shareable(struct content *c);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Retrieve the low-level cache handle for a content
|
|
|
|
*
|
|
|
|
* \note only used by hlcache
|
|
|
|
*
|
|
|
|
* \param c Content to retrieve from
|
|
|
|
* \return Low-level cache handle
|
|
|
|
*/
|
|
|
|
const struct llcache_handle *content_get_llcache_handle(struct content *c);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Retrieve URL associated with content
|
|
|
|
*
|
|
|
|
* \param c Content to retrieve URL from
|
|
|
|
* \return Pointer to URL, or NULL if not found.
|
|
|
|
*/
|
|
|
|
struct nsurl *content_get_url(struct content *c);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Clone a content object in its current state.
|
|
|
|
*
|
|
|
|
* \param c Content to clone
|
|
|
|
* \return Clone of \a c
|
|
|
|
*/
|
|
|
|
struct content *content_clone(struct content *c);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Abort a content object
|
|
|
|
*
|
|
|
|
* \param c The content object to abort
|
|
|
|
* \return NSERROR_OK on success, otherwise appropriate error
|
|
|
|
*/
|
|
|
|
nserror content_abort(struct content *c);
|
|
|
|
|
2010-03-28 16:56:39 +04:00
|
|
|
#endif
|