From 669bbb5dfc78d7d8fec6af3d8157d967263d1de8 Mon Sep 17 00:00:00 2001 From: Jihoon Kim Date: Fri, 3 May 2019 11:32:52 +0900 Subject: [PATCH] Add view title information in save view info Change-Id: I07bb03eec89059c0a54ea90855d56ae581bd8e85 Signed-off-by: Jihoon Kim --- client/autofill.c | 3 ++- common/autofill_save_view_info.c | 31 +++++++++++++++++++++++++++++++ include/autofill_common.h | 24 ++++++++++++++++++++++++ include/autofill_private.h | 1 + service_lib/autofill_service.c | 7 +++++++ tidl/autofill.tidl | 1 + tidl/autofill_service.tidl | 1 + 7 files changed, 67 insertions(+), 1 deletion(-) diff --git a/client/autofill.c b/client/autofill.c index a3706eb..c53c86e 100644 --- a/client/autofill.c +++ b/client/autofill.c @@ -383,6 +383,7 @@ EXPORT_API int autofill_commit(autofill_h ah, autofill_save_view_info_h vi) rpc_port_autofill_save_view_info_create(&vih); rpc_port_autofill_save_view_info_set_view_id(vih, vi->view_id); + rpc_port_autofill_save_view_info_set_view_title(vih, vi->view_title); Eina_List *l; autofill_save_item_h it; @@ -423,7 +424,7 @@ EXPORT_API int autofill_commit(autofill_h ah, autofill_save_view_info_h vi) rpc_port_autofill_save_item_destroy(aih); } - LOGD("app id : %s, view id : %s", vi->app_id, vi->view_id); + LOGD("app id : %s, view id : '%s', view title : '%s'", vi->app_id, vi->view_id, vi->view_title); int ret = rpc_port_proxy_AutofillAppPort_invoke_commit(ah->rpc_h, ah->context_id, vih); diff --git a/common/autofill_save_view_info.c b/common/autofill_save_view_info.c index 5185e1e..2fadfee 100644 --- a/common/autofill_save_view_info.c +++ b/common/autofill_save_view_info.c @@ -58,6 +58,11 @@ EXPORT_API int autofill_save_view_info_destroy(autofill_save_view_info_h vi) vi->view_id = NULL; } + if (vi->view_title) { + free(vi->view_title); + vi->view_title = NULL; + } + // release memory autofill item list autofill_save_item_h it_h; EINA_LIST_FREE(vi->autofill_save_item_list, it_h) @@ -121,6 +126,32 @@ EXPORT_API int autofill_save_view_info_get_view_id(autofill_save_view_info_h vi, return AUTOFILL_ERROR_NONE; } +EXPORT_API int autofill_save_view_info_set_view_title(autofill_save_view_info_h vi, const char *view_title) +{ + if (!vi || !view_title) + return AUTOFILL_ERROR_INVALID_PARAMETER; + + if (vi->view_title) + free(vi->view_title); + + vi->view_title = strdup(view_title); + + return AUTOFILL_ERROR_NONE; +} + +EXPORT_API int autofill_save_view_info_get_view_title(autofill_save_view_info_h vi, char **view_title) +{ + if (!vi || !view_title) + return AUTOFILL_ERROR_INVALID_PARAMETER; + + if (!vi->view_title) + return AUTOFILL_ERROR_OPERATION_FAILED; + + *view_title = strdup(vi->view_title); + + return AUTOFILL_ERROR_NONE; +} + EXPORT_API int autofill_save_view_info_add_item(autofill_save_view_info_h vi, autofill_save_item_h it) { if (!vi || !it) diff --git a/include/autofill_common.h b/include/autofill_common.h index c8f7512..6d8d1da 100644 --- a/include/autofill_common.h +++ b/include/autofill_common.h @@ -662,6 +662,30 @@ int autofill_save_view_info_set_view_id(autofill_save_view_info_h vi, const char int autofill_save_view_info_get_view_id(autofill_save_view_info_h vi, char **view_id); /** + * @brief Sets the view title in autofill save view information. + * @since_tizen 5.5 + * @param[in] vi The autofill view info handle + * @param[in] view_title The view title + * @return 0 on success, otherwise a negative error value + * @retval #AUTOFILL_ERROR_NONE No error + * @retval #AUTOFILL_ERROR_INVALID_PARAMETER Invalid parameter + */ +int autofill_save_view_info_set_view_title(autofill_save_view_info_h vi, const char *view_title); + +/** + * @brief Gets the view title in autofill save view information. + * @since_tizen 5.5 + * @remarks @a view_title must be released using free(). + * @param[in] vi The autofill view info handle + * @param[out] view_title The view title + * @return 0 on success, otherwise a negative error value + * @retval #AUTOFILL_ERROR_NONE No error + * @retval #AUTOFILL_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #AUTOFILL_ERROR_OPERATION_FAILED Operation failure + */ +int autofill_save_view_info_get_view_title(autofill_save_view_info_h vi, char **view_title); + +/** * @brief Adds autofill save item in autofill save view information. * @since_tizen 5.5 * @param[in] vi The autofill save view info handle diff --git a/include/autofill_private.h b/include/autofill_private.h index 363cf85..31012b2 100644 --- a/include/autofill_private.h +++ b/include/autofill_private.h @@ -50,6 +50,7 @@ struct autofill_view_info_s { struct autofill_save_view_info_s { char *app_id; // app ID char *view_id; // view unique ID or web page URL (URL started with http:// or https://) + char *view_title; // view title Eina_List *autofill_save_item_list; // autofill_save_item_h list }; diff --git a/service_lib/autofill_service.c b/service_lib/autofill_service.c index 590f2d5..ebca4b5 100644 --- a/service_lib/autofill_service.c +++ b/service_lib/autofill_service.c @@ -227,9 +227,11 @@ static void __autofill_commit_cb(rpc_port_stub_AutofillSvcPort_context_h context { char *app_id = NULL; char *view_id = NULL; + char *view_title = NULL; rpc_port_autofill_svc_save_view_info_get_app_id(vi, &app_id); rpc_port_autofill_svc_save_view_info_get_view_id(vi, &view_id); + rpc_port_autofill_svc_save_view_info_get_view_title(vi, &view_title); LOGD("app id : %s, view id : %s", app_id, view_id); @@ -237,6 +239,7 @@ static void __autofill_commit_cb(rpc_port_stub_AutofillSvcPort_context_h context autofill_save_view_info_create(&view_info); autofill_save_view_info_set_app_id(view_info, app_id); autofill_save_view_info_set_view_id(view_info, view_id); + autofill_save_view_info_set_view_title(view_info, view_title); rpc_port_autofill_svc_save_view_info_foreach_items(vi, __save_item_cb, view_info); @@ -252,6 +255,10 @@ static void __autofill_commit_cb(rpc_port_stub_AutofillSvcPort_context_h context if (view_id) { free(view_id); } + + if (view_title) { + free(view_title); + } } static void __terminate_received_cb(rpc_port_stub_AutofillSvcPort_context_h context, void *user_data) diff --git a/tidl/autofill.tidl b/tidl/autofill.tidl index fbf53b4..bfac23d 100644 --- a/tidl/autofill.tidl +++ b/tidl/autofill.tidl @@ -21,6 +21,7 @@ struct autofill_save_item { struct autofill_save_view_info { string view_id; + string view_title; list items; } diff --git a/tidl/autofill_service.tidl b/tidl/autofill_service.tidl index 31a4809..ffe3dc1 100644 --- a/tidl/autofill_service.tidl +++ b/tidl/autofill_service.tidl @@ -23,6 +23,7 @@ struct autofill_svc_save_item { struct autofill_svc_save_view_info { string app_id; string view_id; + string view_title; list items; } -- 2.7.4