Subversion Repositories Kolibri OS

Rev

Blame | Last modification | View Log | Download | RSS feed

  1. /*
  2.  * Copyright 2011 John-Mark Bell <jmb@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. #ifndef NETSURF_CONTENT_CONTENT_FACTORY_H_
  20. #define NETSURF_CONTENT_CONTENT_FACTORY_H_
  21.  
  22. #include <stdbool.h>
  23.  
  24. #include <libwapcaplet/libwapcaplet.h>
  25.  
  26. #include "content/content_type.h"
  27. #include "utils/errors.h"
  28. #include "utils/utils.h"
  29.  
  30. #define CONTENT_FACTORY_REGISTER_TYPES(HNAME, HTYPELIST, HHANDLER)      \
  31.                                                                         \
  32. nserror HNAME##_init(void)                                              \
  33. {                                                                       \
  34.         uint32_t i;                                                     \
  35.         nserror error = NSERROR_OK;                                     \
  36.                                                                         \
  37.         for (i = 0; i < NOF_ELEMENTS(HTYPELIST); i++) {                 \
  38.                 error = content_factory_register_handler(               \
  39.                         HTYPELIST[i],                                   \
  40.                         &HHANDLER);                                     \
  41.                 if (error != NSERROR_OK)                                \
  42.                         break;                                          \
  43.         }                                                               \
  44.                                                                         \
  45.         return error;                                                   \
  46. }
  47.  
  48. struct content;
  49. struct llcache_handle;
  50.  
  51. typedef struct content_handler content_handler;
  52.  
  53. void content_factory_fini(void);
  54.  
  55. nserror content_factory_register_handler(const char *mime_type,
  56.                 const content_handler *handler);
  57.  
  58. struct content *content_factory_create_content(struct llcache_handle *llcache,
  59.                 const char *fallback_charset, bool quirks,
  60.                 lwc_string *effective_type);
  61.  
  62. content_type content_factory_type_from_mime_type(lwc_string *mime_type);
  63.  
  64. #endif
  65.