1/* 2 * Copyright (C) 2012 Samsung Electronics. All rights reserved. 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions 6 * are met: 7 * 1. Redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer. 9 * 2. Redistributions in binary form must reproduce the above copyright 10 * notice, this list of conditions and the following disclaimer in the 11 * documentation and/or other materials provided with the distribution. 12 * 13 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 14 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 15 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 22 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 */ 25 26/** 27 * @file ewk_storage_manager.h 28 * @brief Describes the Ewk Storage Manager API. 29 * 30 * Ewk Storage Manager manages web storage. 31 */ 32 33#ifndef ewk_storage_manager_h 34#define ewk_storage_manager_h 35 36#include "ewk_security_origin.h" 37#include <Eina.h> 38 39#ifdef __cplusplus 40extern "C" { 41#endif 42 43/** Creates a type name for Ewk_Storage_Manager. */ 44typedef struct EwkStorageManager Ewk_Storage_Manager; 45 46/** 47 * @typedef Ewk_Storage_Origins_Async_Get_Cb Ewk_Storage_Origins_Async_Get_Cb 48 * @brief Callback type for use with ewk_storage_manager_origins_async_get(). 49 * 50 * @param origins @c Eina_List containing @c Ewk_Security_Origin elements. 51 * 52 * @note The @a origins should be freed like below code after use. 53 * 54 * @code 55 * 56 * static void 57 * _origins_get_cb(Eina_List* origins, data) 58 * { 59 * // ... 60 * 61 * void *origin; 62 * EINA_LIST_FREE(origins, origin) 63 * ewk_object_unref((Ewk_Object*)origin); 64 * } 65 * 66 * @endcode 67 */ 68typedef void (*Ewk_Storage_Origins_Async_Get_Cb)(Eina_List *origins, void *user_data); 69 70/** 71 * Gets list of origins that are stored in storage db asynchronously. 72 * 73 * This function allocates memory for context structure made from callback and user_data. 74 * 75 * @param manager Ewk_Storage_Manager object 76 * @param callback callback to get storage origins 77 * @param user_data user_data will be passed when result_callback is called, 78 * -i.e., user data will be kept until callback is called 79 * 80 * @return @c EINA_TRUE on success, @c EINA_FALSE on failure 81 */ 82EAPI Eina_Bool ewk_storage_manager_origins_async_get(const Ewk_Storage_Manager *manager, Ewk_Storage_Origins_Async_Get_Cb callback, void *user_data); 83 84/** 85 * Deletes all local storage. 86 * 87 * @param manager Ewk_Storage_Manager object 88 * 89 * @return @c EINA_TRUE on success, @c EINA_FALSE on failure 90 */ 91EAPI Eina_Bool ewk_storage_manager_entries_clear(Ewk_Storage_Manager *manager); 92 93/** 94 * Deletes local storage for the specified origin. 95 * 96 * @param manager Ewk_Storage_Manager object 97 * @param origin security origin 98 * 99 * @return @c EINA_TRUE on success, @c EINA_FALSE on failure 100 */ 101EAPI Eina_Bool ewk_storage_manager_entries_for_origin_del(Ewk_Storage_Manager *manager, Ewk_Security_Origin *origin); 102 103#ifdef __cplusplus 104} 105#endif 106#endif // ewk_storage_manager_h 107