return AUTOFILL_ERROR_NONE;
}
+
+EXPORT_API int autofill_commit(autofill_save_view_info_h vi)
+{
+ rpc_port_autofill_save_view_info_h vih;
+ char *id;
+ char *label;
+ char *value;
+ autofill_hint_e autofill_hint;
+ bool sensitive_data;
+
+ if (!vi) {
+ LOGW("parameter is NULL");
+ return AUTOFILL_ERROR_INVALID_PARAMETER;
+ }
+
+ if (!rpc_h) {
+ LOGW("not connected");
+ return AUTOFILL_ERROR_NOT_INITIALIZED;
+ }
+
+ rpc_port_autofill_save_view_info_create(&vih);
+ rpc_port_autofill_save_view_info_set_view_id(vih, vi->view_id);
+
+ Eina_List *l;
+ autofill_save_item_h it;
+ EINA_LIST_FOREACH(vi->autofill_save_item_list, l, it)
+ {
+ autofill_save_item_get_id(it, &id);
+ autofill_save_item_get_label(it, &label);
+ autofill_save_item_get_value(it, &value);
+ autofill_save_item_get_autofill_hint(it, &autofill_hint);
+ autofill_save_item_get_sensitive_data(it, &sensitive_data);
+
+ LOGD("it : %p, id : %s, label : %s, hint : %d, sensitive : %d", it, id, label, autofill_hint, sensitive_data);
+
+ rpc_port_autofill_save_item_h aih;
+ rpc_port_autofill_save_item_create(&aih);
+ rpc_port_autofill_save_item_set_id(aih, id);
+ rpc_port_autofill_save_item_set_label(aih, label);
+ rpc_port_autofill_save_item_set_value(aih, value);
+ rpc_port_autofill_save_item_set_autofill_hint(aih, (int)autofill_hint);
+ rpc_port_autofill_save_item_set_is_sensitive_data(aih, sensitive_data);
+ rpc_port_autofill_save_view_info_add_items(vih, aih);
+
+ if (id) {
+ free(id);
+ id = NULL;
+ }
+
+ if (label) {
+ free(label);
+ label = NULL;
+ }
+
+ if (value) {
+ free(value);
+ value = NULL;
+ }
+
+ rpc_port_autofill_save_item_destroy(aih);
+ }
+
+ LOGD("app id : %s, view id : %s", vi->app_id, vi->view_id);
+
+ rpc_port_proxy_AutofillAppPort_invoke_commit(rpc_h, vih);
+
+ rpc_port_autofill_save_view_info_destroy(vih);
+
+ return AUTOFILL_ERROR_NONE;
+}
return 0;
}
+struct autofill_save_item_s {
+ rpc_port_parcelable_t parcelable;
+ char *id;
+ char *label;
+ char *value;
+ int autofill_hint;
+ bool is_sensitive_data;
+};
+
+static void __autofill_save_item_to(rpc_port_parcel_h parcel, void *data)
+{
+ rpc_port_autofill_save_item_h h = data;
+
+ if (!parcel || !h) {
+ _E("Invalid parameter");
+ return;
+ }
+
+ rpc_port_parcel_write_string(parcel, h->id ? h->id : "");
+ rpc_port_parcel_write_string(parcel, h->label ? h->label : "");
+ rpc_port_parcel_write_string(parcel, h->value ? h->value : "");
+ rpc_port_parcel_write_int32(parcel, h->autofill_hint);
+ rpc_port_parcel_write_bool(parcel, h->is_sensitive_data);
+}
+
+static void __autofill_save_item_from(rpc_port_parcel_h parcel, void *data)
+{
+ rpc_port_autofill_save_item_h h = data;
+
+ if (!parcel || !h) {
+ _E("Invalid parameter");
+ return;
+ }
+
+ rpc_port_parcel_read_string(parcel, &h->id);
+ rpc_port_parcel_read_string(parcel, &h->label);
+ rpc_port_parcel_read_string(parcel, &h->value);
+ rpc_port_parcel_read_int32(parcel, &h->autofill_hint);
+ rpc_port_parcel_read_bool(parcel, &h->is_sensitive_data);
+}
+
+int rpc_port_autofill_save_item_create(rpc_port_autofill_save_item_h *h)
+{
+ struct autofill_save_item_s *handle;
+
+ if (!h) {
+ _E("Invalid parameter");
+ return -1;
+ }
+
+ handle = calloc(1, sizeof(struct autofill_save_item_s));
+ if (!handle) {
+ _E("Out of memory");
+ return -1;
+ }
+
+ handle->parcelable.to = __autofill_save_item_to;
+ handle->parcelable.from = __autofill_save_item_from;
+
+ *h = handle;
+
+ return 0;
+}
+
+int rpc_port_autofill_save_item_destroy(rpc_port_autofill_save_item_h h)
+{
+ if (!h) {
+ _E("Invalid parameter");
+ return -1;
+ }
+
+ if (h->id)
+ free(h->id);
+
+ if (h->label)
+ free(h->label);
+
+ if (h->value)
+ free(h->value);
+
+ free(h);
+
+ return 0;
+}
+
+int rpc_port_autofill_save_item_clone(rpc_port_autofill_save_item_h h, rpc_port_autofill_save_item_h *clone)
+{
+ rpc_port_autofill_save_item_h handle = NULL;
+
+ if (!h || !clone) {
+ _E("Invalid parameter");
+ return -1;
+ }
+
+ rpc_port_autofill_save_item_create(&handle);
+ if (!handle) {
+ _E("Failed to create autofill_save_item handle");
+ return -1;
+ }
+
+ if (h->id) {
+ handle->id = strdup(h->id);
+ if (!handle->id) {
+ _E("Failed to duplicate h->id");
+ rpc_port_autofill_save_item_destroy(handle);
+ return -1;
+ }
+ }
+
+ if (h->label) {
+ handle->label = strdup(h->label);
+ if (!handle->label) {
+ _E("Failed to duplicate h->label");
+ rpc_port_autofill_save_item_destroy(handle);
+ return -1;
+ }
+ }
+
+ if (h->value) {
+ handle->value = strdup(h->value);
+ if (!handle->value) {
+ _E("Failed to duplicate h->value");
+ rpc_port_autofill_save_item_destroy(handle);
+ return -1;
+ }
+ }
+
+ handle->autofill_hint = h->autofill_hint;
+ handle->is_sensitive_data = h->is_sensitive_data;
+ *clone = handle;
+
+ return 0;
+}
+
+int rpc_port_autofill_save_item_set_id(rpc_port_autofill_save_item_h h, const char *id)
+{
+ if (!h || !id) {
+ _E("Invalid parameter");
+ return -1;
+ }
+
+ if (h->id) {
+ free(h->id);
+ h->id = NULL;
+ }
+
+ h->id = strdup(id);
+ if (!h->id) {
+ _E("Failed to duplicate data");
+ return -1;
+ }
+
+ return 0;
+}
+
+int rpc_port_autofill_save_item_set_label(rpc_port_autofill_save_item_h h, const char *label)
+{
+ if (!h || !label) {
+ _E("Invalid parameter");
+ return -1;
+ }
+
+ if (h->label) {
+ free(h->label);
+ h->label = NULL;
+ }
+
+ h->label = strdup(label);
+ if (!h->label) {
+ _E("Failed to duplicate data");
+ return -1;
+ }
+
+ return 0;
+}
+
+int rpc_port_autofill_save_item_set_value(rpc_port_autofill_save_item_h h, const char *value)
+{
+ if (!h || !value) {
+ _E("Invalid parameter");
+ return -1;
+ }
+
+ if (h->value) {
+ free(h->value);
+ h->value = NULL;
+ }
+
+ h->value = strdup(value);
+ if (!h->value) {
+ _E("Failed to duplicate data");
+ return -1;
+ }
+
+ return 0;
+}
+
+int rpc_port_autofill_save_item_set_autofill_hint(rpc_port_autofill_save_item_h h, int autofill_hint)
+{
+ if (!h) {
+ _E("Invalid parameter");
+ return -1;
+ }
+
+ h->autofill_hint = autofill_hint;
+ return 0;
+}
+
+int rpc_port_autofill_save_item_set_is_sensitive_data(rpc_port_autofill_save_item_h h, bool is_sensitive_data)
+{
+ if (!h) {
+ _E("Invalid parameter");
+ return -1;
+ }
+
+ h->is_sensitive_data = is_sensitive_data;
+ return 0;
+}
+
+int rpc_port_autofill_save_item_get_id(rpc_port_autofill_save_item_h h, char **id)
+{
+ if (!h || !id) {
+ _E("Invalid parameter");
+ return -1;
+ }
+
+ if (!h->id) {
+ _E("Invalid parameter: h->id is NULL");
+ return -1;
+ }
+
+ *id = strdup(h->id);
+ if (*id == NULL) {
+ _E("Failed to duplicate id");
+ return -1;
+ }
+
+ return 0;
+}
+
+int rpc_port_autofill_save_item_get_label(rpc_port_autofill_save_item_h h, char **label)
+{
+ if (!h || !label) {
+ _E("Invalid parameter");
+ return -1;
+ }
+
+ if (!h->label) {
+ _E("Invalid parameter: h->label is NULL");
+ return -1;
+ }
+
+ *label = strdup(h->label);
+ if (*label == NULL) {
+ _E("Failed to duplicate label");
+ return -1;
+ }
+
+ return 0;
+}
+
+int rpc_port_autofill_save_item_get_value(rpc_port_autofill_save_item_h h, char **value)
+{
+ if (!h || !value) {
+ _E("Invalid parameter");
+ return -1;
+ }
+
+ if (!h->value) {
+ _E("Invalid parameter: h->value is NULL");
+ return -1;
+ }
+
+ *value = strdup(h->value);
+ if (*value == NULL) {
+ _E("Failed to duplicate value");
+ return -1;
+ }
+
+ return 0;
+}
+
+int rpc_port_autofill_save_item_get_autofill_hint(rpc_port_autofill_save_item_h h, int *autofill_hint)
+{
+ if (!h || !autofill_hint) {
+ _E("Invalid parameter");
+ return -1;
+ }
+
+ *autofill_hint = h->autofill_hint;
+ return 0;
+}
+
+int rpc_port_autofill_save_item_get_is_sensitive_data(rpc_port_autofill_save_item_h h, bool *is_sensitive_data)
+{
+ if (!h || !is_sensitive_data) {
+ _E("Invalid parameter");
+ return -1;
+ }
+
+ *is_sensitive_data = h->is_sensitive_data;
+ return 0;
+}
+
+struct autofill_save_view_info_s {
+ rpc_port_parcelable_t parcelable;
+ char *view_id;
+ GList *items;
+};
+
+static void __autofill_save_view_info_to(rpc_port_parcel_h parcel, void *data)
+{
+ rpc_port_autofill_save_view_info_h h = data;
+
+ if (!parcel || !h) {
+ _E("Invalid parameter");
+ return;
+ }
+
+ rpc_port_parcel_write_string(parcel, h->view_id ? h->view_id : "");
+ rpc_port_parcel_write_array_count(parcel, g_list_length(h->items));
+ do {
+ GList *iter;
+
+ iter = h->items;
+ while (iter) {
+ rpc_port_autofill_save_item_h value = iter->data;
+
+ iter = g_list_next(iter);
+ if (!value) {
+ _W("Warning: value is NULL");
+ continue;
+ }
+ rpc_port_parcel_write(parcel, &value->parcelable, value);
+ }
+ } while (0);
+}
+
+static void __autofill_save_view_info_from(rpc_port_parcel_h parcel, void *data)
+{
+ rpc_port_autofill_save_view_info_h h = data;
+
+ if (!parcel || !h) {
+ _E("Invalid parameter");
+ return;
+ }
+
+ rpc_port_parcel_read_string(parcel, &h->view_id);
+ do {
+ int len = 0;
+
+ rpc_port_parcel_read_array_count(parcel, &len);
+ for (int i = 0; i < len; i++) {
+ rpc_port_autofill_save_item_h value = NULL;
+
+ rpc_port_autofill_save_item_create(&value);
+ if (!value) {
+ _E("Failed to create handle");
+ return;
+ }
+
+ rpc_port_parcel_read(parcel, &value->parcelable, value);
+ h->items = g_list_append(h->items, value);
+ }
+ } while (0);
+}
+
+int rpc_port_autofill_save_view_info_create(rpc_port_autofill_save_view_info_h *h)
+{
+ struct autofill_save_view_info_s *handle;
+
+ if (!h) {
+ _E("Invalid parameter");
+ return -1;
+ }
+
+ handle = calloc(1, sizeof(struct autofill_save_view_info_s));
+ if (!handle) {
+ _E("Out of memory");
+ return -1;
+ }
+
+ handle->parcelable.to = __autofill_save_view_info_to;
+ handle->parcelable.from = __autofill_save_view_info_from;
+
+ *h = handle;
+
+ return 0;
+}
+
+int rpc_port_autofill_save_view_info_destroy(rpc_port_autofill_save_view_info_h h)
+{
+ if (!h) {
+ _E("Invalid parameter");
+ return -1;
+ }
+
+ if (h->view_id)
+ free(h->view_id);
+
+ do {
+ GList *iter;
+
+ iter = h->items;
+ while (iter) {
+ rpc_port_autofill_save_item_h value = iter->data;
+ if (value)
+ rpc_port_autofill_save_item_destroy(value);
+
+ iter = g_list_next(iter);
+ }
+ g_list_free(h->items);
+ } while (0);
+
+ free(h);
+
+ return 0;
+}
+
+int rpc_port_autofill_save_view_info_clone(rpc_port_autofill_save_view_info_h h, rpc_port_autofill_save_view_info_h *clone)
+{
+ rpc_port_autofill_save_view_info_h handle = NULL;
+
+ if (!h || !clone) {
+ _E("Invalid parameter");
+ return -1;
+ }
+
+ rpc_port_autofill_save_view_info_create(&handle);
+ if (!handle) {
+ _E("Failed to create autofill_save_view_info handle");
+ return -1;
+ }
+
+ if (h->view_id) {
+ handle->view_id = strdup(h->view_id);
+ if (!handle->view_id) {
+ _E("Failed to duplicate h->view_id");
+ rpc_port_autofill_save_view_info_destroy(handle);
+ return -1;
+ }
+ }
+
+ do {
+ GList *iter;
+
+ iter = h->items;
+ while (iter) {
+ rpc_port_autofill_save_item_h new_value;
+ rpc_port_autofill_save_item_h value = iter->data;
+
+ if (!value) {
+ _E("Error: value is NULL");
+ rpc_port_autofill_save_view_info_destroy(handle);
+ return -1;
+ }
+
+ rpc_port_autofill_save_item_clone(value, &new_value);
+ if (!new_value) {
+ _E("Failed to duplicate value");
+ rpc_port_autofill_save_view_info_destroy(handle);
+ return -1;
+ }
+
+ handle->items = g_list_append(handle->items, new_value);
+ iter = g_list_next(iter);
+ }
+ } while (0);
+
+ *clone = handle;
+
+ return 0;
+}
+
+int rpc_port_autofill_save_view_info_set_view_id(rpc_port_autofill_save_view_info_h h, const char *view_id)
+{
+ if (!h || !view_id) {
+ _E("Invalid parameter");
+ return -1;
+ }
+
+ if (h->view_id) {
+ free(h->view_id);
+ h->view_id = NULL;
+ }
+
+ h->view_id = strdup(view_id);
+ if (!h->view_id) {
+ _E("Failed to duplicate data");
+ return -1;
+ }
+
+ return 0;
+}
+
+int rpc_port_autofill_save_view_info_add_items(rpc_port_autofill_save_view_info_h h, rpc_port_autofill_save_item_h items)
+{
+ if (!h || !items) {
+ _E("Invalid parameter");
+ return -1;
+ }
+
+ do {
+ rpc_port_autofill_save_item_h value = NULL;
+
+ rpc_port_autofill_save_item_clone(items, &value);
+ if (!value) {
+ _E("Out of memory");
+ return -1;
+ }
+
+ h->items = g_list_append(h->items, value);
+ } while (0);
+
+ return 0;
+}
+
+int rpc_port_autofill_save_view_info_get_view_id(rpc_port_autofill_save_view_info_h h, char **view_id)
+{
+ if (!h || !view_id) {
+ _E("Invalid parameter");
+ return -1;
+ }
+
+ if (!h->view_id) {
+ _E("Invalid parameter: h->view_id is NULL");
+ return -1;
+ }
+
+ *view_id = strdup(h->view_id);
+ if (*view_id == NULL) {
+ _E("Failed to duplicate view_id");
+ return -1;
+ }
+
+ return 0;
+}
+
+int rpc_port_autofill_save_view_info_foreach_items(rpc_port_autofill_save_view_info_h h,
+ bool (*callback)(rpc_port_autofill_save_item_h items, void *user_data), void *user_data)
+{
+ if (!h || !callback) {
+ _E("Invalid parameter");
+ return -1;
+ }
+
+ do {
+ GList *iter;
+
+ iter = h->items;
+ while (iter) {
+ rpc_port_autofill_save_item_h value = iter->data;
+
+ iter = g_list_next(iter);
+ if (!value) {
+ _W("Warning: value is NULL");
+ continue;
+ }
+
+ bool ret = callback(value, user_data);
+ if (!ret)
+ break;
+ }
+ } while (0);
+
+ return 0;
+}
+
+int rpc_port_autofill_save_view_info_remove_items(rpc_port_autofill_save_view_info_h h, unsigned int nth)
+{
+ GList *iter;
+
+ if (!h) {
+ _E("Invalid parameter");
+ return -1;
+ }
+
+ iter = g_list_nth(h->items, nth);
+ if (iter == NULL)
+ return -1;
+
+ rpc_port_autofill_save_item_h value = iter->data;
+ h->items = g_list_remove_link(h->items, iter);
+ rpc_port_autofill_save_item_destroy(value);
+ g_list_free(iter);
+
+ return 0;
+}
+
+int rpc_port_autofill_save_view_info_get_items_length(rpc_port_autofill_save_view_info_h h, unsigned int *length)
+{
+ if (!h || !length) {
+ _E("Invalid parameter");
+ return -1;
+ }
+
+ *length = g_list_length(h->items);
+
+ return 0;
+}
+
struct autofill_auth_info_s {
rpc_port_parcelable_t parcelable;
bool exist_autofill_data;
return 0;
}
+struct list_autofill_save_item_s {
+ rpc_port_parcelable_t parcelable;
+ GList *list_autofill_save_items;
+};
+
+static void __list_autofill_save_item_to(rpc_port_parcel_h parcel, void *data)
+{
+ rpc_port_list_autofill_save_item_h h = data;
+
+ if (!parcel || !h) {
+ _E("Invalid parameter");
+ return;
+ }
+
+ rpc_port_parcel_write_array_count(parcel, g_list_length(h->list_autofill_save_items));
+ do {
+ GList *iter;
+
+ iter = h->list_autofill_save_items;
+ while (iter) {
+ rpc_port_autofill_save_item_h value = iter->data;
+
+ iter = g_list_next(iter);
+ if (!value) {
+ _W("Warning: value is NULL");
+ continue;
+ }
+ rpc_port_parcel_write(parcel, &value->parcelable, value);
+ }
+ } while (0);
+}
+
+static void __list_autofill_save_item_from(rpc_port_parcel_h parcel, void *data)
+{
+ rpc_port_list_autofill_save_item_h h = data;
+
+ if (!parcel || !h) {
+ _E("Invalid parameter");
+ return;
+ }
+
+ do {
+ int len = 0;
+
+ rpc_port_parcel_read_array_count(parcel, &len);
+ for (int i = 0; i < len; i++) {
+ rpc_port_autofill_save_item_h value = NULL;
+
+ rpc_port_autofill_save_item_create(&value);
+ if (!value) {
+ _E("Failed to create handle");
+ return;
+ }
+
+ rpc_port_parcel_read(parcel, &value->parcelable, value);
+ h->list_autofill_save_items = g_list_append(h->list_autofill_save_items, value);
+ }
+ } while (0);
+}
+
+int rpc_port_list_autofill_save_item_create(rpc_port_list_autofill_save_item_h *h)
+{
+ struct list_autofill_save_item_s *handle;
+
+ if (!h) {
+ _E("Invalid parameter");
+ return -1;
+ }
+
+ handle = calloc(1, sizeof(struct list_autofill_save_item_s));
+ if (!handle) {
+ _E("Out of memory");
+ return -1;
+ }
+
+ handle->parcelable.to = __list_autofill_save_item_to;
+ handle->parcelable.from = __list_autofill_save_item_from;
+
+ *h = handle;
+
+ return 0;
+}
+
+int rpc_port_list_autofill_save_item_destroy(rpc_port_list_autofill_save_item_h h)
+{
+ if (!h) {
+ _E("Invalid parameter");
+ return -1;
+ }
+
+ do {
+ GList *iter;
+
+ iter = h->list_autofill_save_items;
+ while (iter) {
+ rpc_port_autofill_save_item_h value = iter->data;
+ if (value)
+ rpc_port_autofill_save_item_destroy(value);
+
+ iter = g_list_next(iter);
+ }
+ g_list_free(h->list_autofill_save_items);
+ } while (0);
+
+ free(h);
+
+ return 0;
+}
+
+int rpc_port_list_autofill_save_item_clone(rpc_port_list_autofill_save_item_h h, rpc_port_list_autofill_save_item_h *clone)
+{
+ rpc_port_list_autofill_save_item_h handle = NULL;
+
+ if (!h || !clone) {
+ _E("Invalid parameter");
+ return -1;
+ }
+
+ rpc_port_list_autofill_save_item_create(&handle);
+ if (!handle) {
+ _E("Failed to create list_autofill_save_item handle");
+ return -1;
+ }
+
+ do {
+ GList *iter;
+
+ iter = h->list_autofill_save_items;
+ while (iter) {
+ rpc_port_autofill_save_item_h new_value;
+ rpc_port_autofill_save_item_h value = iter->data;
+
+ if (!value) {
+ _E("Error: value is NULL");
+ rpc_port_list_autofill_save_item_destroy(handle);
+ return -1;
+ }
+
+ rpc_port_autofill_save_item_clone(value, &new_value);
+ if (!new_value) {
+ _E("Failed to duplicate value");
+ rpc_port_list_autofill_save_item_destroy(handle);
+ return -1;
+ }
+
+ handle->list_autofill_save_items = g_list_append(handle->list_autofill_save_items, new_value);
+ iter = g_list_next(iter);
+ }
+ } while (0);
+
+ *clone = handle;
+
+ return 0;
+}
+
+int rpc_port_list_autofill_save_item_add_list_autofill_save_items(rpc_port_list_autofill_save_item_h h, rpc_port_autofill_save_item_h list_autofill_save_items)
+{
+ if (!h || !list_autofill_save_items) {
+ _E("Invalid parameter");
+ return -1;
+ }
+
+ do {
+ rpc_port_autofill_save_item_h value = NULL;
+
+ rpc_port_autofill_save_item_clone(list_autofill_save_items, &value);
+ if (!value) {
+ _E("Out of memory");
+ return -1;
+ }
+
+ h->list_autofill_save_items = g_list_append(h->list_autofill_save_items, value);
+ } while (0);
+
+ return 0;
+}
+
+int rpc_port_list_autofill_save_item_foreach_list_autofill_save_items(rpc_port_list_autofill_save_item_h h,
+ bool (*callback)(rpc_port_autofill_save_item_h list_autofill_save_items, void *user_data), void *user_data)
+{
+ if (!h || !callback) {
+ _E("Invalid parameter");
+ return -1;
+ }
+
+ do {
+ GList *iter;
+
+ iter = h->list_autofill_save_items;
+ while (iter) {
+ rpc_port_autofill_save_item_h value = iter->data;
+
+ iter = g_list_next(iter);
+ if (!value) {
+ _W("Warning: value is NULL");
+ continue;
+ }
+
+ bool ret = callback(value, user_data);
+ if (!ret)
+ break;
+ }
+ } while (0);
+
+ return 0;
+}
+
+int rpc_port_list_autofill_save_item_remove_list_autofill_save_items(rpc_port_list_autofill_save_item_h h, unsigned int nth)
+{
+ GList *iter;
+
+ if (!h) {
+ _E("Invalid parameter");
+ return -1;
+ }
+
+ iter = g_list_nth(h->list_autofill_save_items, nth);
+ if (iter == NULL)
+ return -1;
+
+ rpc_port_autofill_save_item_h value = iter->data;
+ h->list_autofill_save_items = g_list_remove_link(h->list_autofill_save_items, iter);
+ rpc_port_autofill_save_item_destroy(value);
+ g_list_free(iter);
+
+ return 0;
+}
+
+int rpc_port_list_autofill_save_item_get_list_autofill_save_items_length(rpc_port_list_autofill_save_item_h h, unsigned int *length)
+{
+ if (!h || !length) {
+ _E("Invalid parameter");
+ return -1;
+ }
+
+ *length = g_list_length(h->list_autofill_save_items);
+
+ return 0;
+}
+
enum AutofillAppPort_method_e {
AutofillAppPort_METHOD_Result,
AutofillAppPort_METHOD_Callback,
AutofillAppPort_METHOD_Unregister,
AutofillAppPort_METHOD_request_auth_info,
AutofillAppPort_METHOD_send_fill_request,
+ AutofillAppPort_METHOD_commit,
};
enum AutofillAppPort_delegate_e {
set_last_result(r);
}
+void rpc_port_proxy_AutofillAppPort_invoke_commit(rpc_port_proxy_AutofillAppPort_h h, rpc_port_autofill_save_view_info_h vi)
+{
+ rpc_port_parcel_h parcel;
+ int r;
+
+ if (!h || !vi) {
+ _E("Invalid parameter");
+ return;
+ }
+
+ if (!h->port) {
+ _E("Not connected");
+ return;
+ }
+
+ rpc_port_parcel_create(&parcel);
+ rpc_port_parcel_write_int32(parcel, AutofillAppPort_METHOD_commit);
+ rpc_port_parcel_write(parcel, &vi->parcelable, vi);
+
+ r = rpc_port_parcel_send(parcel, h->port);
+ if (r != RPC_PORT_ERROR_NONE) {
+ _E("Failed to send parcel. result(%d)", r);
+ r = RPC_PORT_ERROR_IO_ERROR;
+ }
+
+ rpc_port_parcel_destroy(parcel);
+ set_last_result(r);
+}
+
static struct AutofillAppPort_s *__create_AutofillAppPort(const char *stub_appid, rpc_port_proxy_AutofillAppPort_callback_s *callback, void *user_data)
{
struct AutofillAppPort_s *handle;
int rpc_port_autofill_view_info_get_items_length(rpc_port_autofill_view_info_h h, unsigned int *length);
+typedef struct autofill_save_item_s *rpc_port_autofill_save_item_h;
+
+int rpc_port_autofill_save_item_create(rpc_port_autofill_save_item_h *h);
+
+int rpc_port_autofill_save_item_destroy(rpc_port_autofill_save_item_h h);
+
+int rpc_port_autofill_save_item_clone(rpc_port_autofill_save_item_h h, rpc_port_autofill_save_item_h *clone);
+
+int rpc_port_autofill_save_item_set_id(rpc_port_autofill_save_item_h h, const char *id);
+
+int rpc_port_autofill_save_item_set_label(rpc_port_autofill_save_item_h h, const char *label);
+
+int rpc_port_autofill_save_item_set_value(rpc_port_autofill_save_item_h h, const char *value);
+
+int rpc_port_autofill_save_item_set_autofill_hint(rpc_port_autofill_save_item_h h, int autofill_hint);
+
+int rpc_port_autofill_save_item_set_is_sensitive_data(rpc_port_autofill_save_item_h h, bool is_sensitive_data);
+
+int rpc_port_autofill_save_item_get_id(rpc_port_autofill_save_item_h h, char **id);
+
+int rpc_port_autofill_save_item_get_label(rpc_port_autofill_save_item_h h, char **label);
+
+int rpc_port_autofill_save_item_get_value(rpc_port_autofill_save_item_h h, char **value);
+
+int rpc_port_autofill_save_item_get_autofill_hint(rpc_port_autofill_save_item_h h, int *autofill_hint);
+
+int rpc_port_autofill_save_item_get_is_sensitive_data(rpc_port_autofill_save_item_h h, bool *is_sensitive_data);
+
+typedef struct autofill_save_view_info_s *rpc_port_autofill_save_view_info_h;
+
+int rpc_port_autofill_save_view_info_create(rpc_port_autofill_save_view_info_h *h);
+
+int rpc_port_autofill_save_view_info_destroy(rpc_port_autofill_save_view_info_h h);
+
+int rpc_port_autofill_save_view_info_clone(rpc_port_autofill_save_view_info_h h, rpc_port_autofill_save_view_info_h *clone);
+
+int rpc_port_autofill_save_view_info_set_view_id(rpc_port_autofill_save_view_info_h h, const char *view_id);
+
+int rpc_port_autofill_save_view_info_add_items(rpc_port_autofill_save_view_info_h h, rpc_port_autofill_save_item_h items);
+
+int rpc_port_autofill_save_view_info_get_view_id(rpc_port_autofill_save_view_info_h h, char **view_id);
+
+int rpc_port_autofill_save_view_info_foreach_items(rpc_port_autofill_save_view_info_h h,
+ bool (*callback)(rpc_port_autofill_save_item_h items, void *user_data), void *user_data);
+
+int rpc_port_autofill_save_view_info_remove_items(rpc_port_autofill_save_view_info_h h, unsigned int nth);
+
+int rpc_port_autofill_save_view_info_get_items_length(rpc_port_autofill_save_view_info_h h, unsigned int *length);
+
typedef struct autofill_auth_info_s *rpc_port_autofill_auth_info_h;
int rpc_port_autofill_auth_info_create(rpc_port_autofill_auth_info_h *h);
int rpc_port_list_autofill_response_item_get_list_autofill_response_items_length(rpc_port_list_autofill_response_item_h h, unsigned int *length);
+typedef struct list_autofill_save_item_s *rpc_port_list_autofill_save_item_h;
+
+int rpc_port_list_autofill_save_item_create(rpc_port_list_autofill_save_item_h *h);
+
+int rpc_port_list_autofill_save_item_destroy(rpc_port_list_autofill_save_item_h h);
+
+int rpc_port_list_autofill_save_item_clone(rpc_port_list_autofill_save_item_h h, rpc_port_list_autofill_save_item_h *clone);
+
+int rpc_port_list_autofill_save_item_add_list_autofill_save_items(rpc_port_list_autofill_save_item_h h, rpc_port_autofill_save_item_h list_autofill_save_items);
+
+int rpc_port_list_autofill_save_item_foreach_list_autofill_save_items(rpc_port_list_autofill_save_item_h h,
+ bool (*callback)(rpc_port_autofill_save_item_h list_autofill_save_items, void *user_data), void *user_data);
+
+int rpc_port_list_autofill_save_item_remove_list_autofill_save_items(rpc_port_list_autofill_save_item_h h, unsigned int nth);
+
+int rpc_port_list_autofill_save_item_get_list_autofill_save_items_length(rpc_port_list_autofill_save_item_h h, unsigned int *length);
+
typedef struct AutofillAppPort_s *rpc_port_proxy_AutofillAppPort_h;
typedef struct {
void rpc_port_proxy_AutofillAppPort_invoke_send_fill_request(rpc_port_proxy_AutofillAppPort_h h, rpc_port_autofill_view_info_h vi);
+void rpc_port_proxy_AutofillAppPort_invoke_commit(rpc_port_proxy_AutofillAppPort_h h, rpc_port_autofill_save_view_info_h vi);
+
#ifdef __cplusplus
}
#endif
--- /dev/null
+/*
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <dlog.h>
+#include <unistd.h>
+#include "autofill_private.h"
+#include <autofill_common.h>
+
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
+#define LOG_TAG "AUTOFILL"
+
+struct autofill_save_item_s {
+ char *id;
+ char *label;
+ char *value;
+ autofill_hint_e autofill_hint;
+ bool is_sensitive_data;
+};
+
+EXPORT_API int autofill_save_item_create(autofill_save_item_h *it)
+{
+ if (!it)
+ return AUTOFILL_ERROR_INVALID_PARAMETER;
+
+ struct autofill_save_item_s *ai = (autofill_save_item_h)calloc(1, sizeof(struct autofill_save_item_s));
+ if (!ai)
+ return AUTOFILL_ERROR_OUT_OF_MEMORY;
+
+ ai->is_sensitive_data = false;
+
+ *it = (autofill_save_item_h)ai;
+
+ return AUTOFILL_ERROR_NONE;
+}
+
+EXPORT_API int autofill_save_item_destroy(autofill_save_item_h it)
+{
+ if (!it)
+ return AUTOFILL_ERROR_INVALID_PARAMETER;
+
+ if (it->id)
+ free(it->id);
+
+ if (it->label)
+ free(it->label);
+
+ if (it->value)
+ free(it->value);
+
+ free(it);
+
+ return AUTOFILL_ERROR_NONE;
+}
+
+EXPORT_API int autofill_save_item_clone(autofill_save_item_h h, autofill_save_item_h *clone)
+{
+ autofill_save_item_h handle;
+
+ if (!h || !clone) {
+ LOGW("Invalid parameter");
+ return AUTOFILL_ERROR_INVALID_PARAMETER;
+ }
+
+ autofill_save_item_create(&handle);
+ if (!handle) {
+ LOGW("Failed to create autofill_save_item handle");
+ return AUTOFILL_ERROR_OPERATION_FAILED;
+ }
+
+ if (h->id) {
+ handle->id = strdup(h->id);
+ if (!handle->id) {
+ LOGW("Failed to duplicate h->id");
+ autofill_save_item_destroy(handle);
+ return AUTOFILL_ERROR_OUT_OF_MEMORY;
+ }
+ }
+
+ if (h->label) {
+ handle->label = strdup(h->label);
+ if (!handle->label) {
+ LOGW("Failed to duplicate h->label");
+ autofill_save_item_destroy(handle);
+ return AUTOFILL_ERROR_OUT_OF_MEMORY;
+ }
+ }
+
+ if (h->value) {
+ handle->value = strdup(h->value);
+ if (!handle->value) {
+ LOGW("Failed to duplicate h->value");
+ autofill_save_item_destroy(handle);
+ return AUTOFILL_ERROR_OUT_OF_MEMORY;
+ }
+ }
+
+ handle->autofill_hint = h->autofill_hint;
+ handle->is_sensitive_data = h->is_sensitive_data;
+
+ *clone = handle;
+
+ return AUTOFILL_ERROR_NONE;
+}
+
+EXPORT_API int autofill_save_item_set_autofill_hint(autofill_save_item_h it, autofill_hint_e hints)
+{
+ if (!it)
+ return AUTOFILL_ERROR_INVALID_PARAMETER;
+
+ it->autofill_hint = hints;
+
+ return AUTOFILL_ERROR_NONE;
+}
+
+EXPORT_API int autofill_save_item_get_autofill_hint(autofill_save_item_h it, autofill_hint_e *hints)
+{
+ if (!it || !hints)
+ return AUTOFILL_ERROR_INVALID_PARAMETER;
+
+ *hints = it->autofill_hint;
+
+ return AUTOFILL_ERROR_NONE;
+}
+
+EXPORT_API int autofill_save_item_set_id(autofill_save_item_h it, const char *id)
+{
+ if (!it || !id)
+ return AUTOFILL_ERROR_INVALID_PARAMETER;
+
+ if (it->id) {
+ free(it->id);
+ }
+
+ it->id = strdup(id);
+
+ return AUTOFILL_ERROR_NONE;
+}
+
+EXPORT_API int autofill_save_item_get_id(autofill_save_item_h it, char **id)
+{
+ if (!it || !id)
+ return AUTOFILL_ERROR_INVALID_PARAMETER;
+
+ if (!it->id) {
+ return AUTOFILL_ERROR_OPERATION_FAILED;
+ }
+
+ *id = strdup(it->id);
+
+ return AUTOFILL_ERROR_NONE;
+}
+
+EXPORT_API int autofill_save_item_set_label(autofill_save_item_h it, const char *label)
+{
+ if (!it || !label)
+ return AUTOFILL_ERROR_INVALID_PARAMETER;
+
+ if (it->label) {
+ free(it->label);
+ }
+
+ it->label = strdup(label);
+
+ return AUTOFILL_ERROR_NONE;
+}
+
+EXPORT_API int autofill_save_item_get_label(autofill_save_item_h it, char **label)
+{
+ if (!it || !label)
+ return AUTOFILL_ERROR_INVALID_PARAMETER;
+
+ if (!it->label) {
+ return AUTOFILL_ERROR_OPERATION_FAILED;
+ }
+
+ *label = strdup(it->label);
+
+ return AUTOFILL_ERROR_NONE;
+}
+
+EXPORT_API int autofill_save_item_set_sensitive_data(autofill_save_item_h it, bool sensitive)
+{
+ if (!it)
+ return AUTOFILL_ERROR_INVALID_PARAMETER;
+
+ it->is_sensitive_data = sensitive;
+
+ return AUTOFILL_ERROR_NONE;
+}
+
+EXPORT_API int autofill_save_item_get_sensitive_data(autofill_save_item_h it, bool *sensitive)
+{
+ if (!it || !sensitive) {
+ LOGW("AUTOFILL_ERROR_INVALID_PARAMETER");
+ return AUTOFILL_ERROR_INVALID_PARAMETER;
+ }
+
+ *sensitive = it->is_sensitive_data;
+
+ return AUTOFILL_ERROR_NONE;
+}
+
+EXPORT_API int autofill_save_item_set_value(autofill_save_item_h it, const char *value)
+{
+ if (!it || !value) {
+ LOGW("AUTOFILL_ERROR_INVALID_PARAMETER");
+ return AUTOFILL_ERROR_INVALID_PARAMETER;
+ }
+
+ if (it->value) {
+ free(it->value);
+ }
+
+ it->value = strdup(value);
+
+ return AUTOFILL_ERROR_NONE;
+}
+
+EXPORT_API int autofill_save_item_get_value(autofill_save_item_h it, char **value)
+{
+ if (!it || !value) {
+ LOGW("AUTOFILL_ERROR_INVALID_PARAMETER");
+ return AUTOFILL_ERROR_INVALID_PARAMETER;
+ }
+
+ if (!it->value) {
+ return AUTOFILL_ERROR_OPERATION_FAILED;
+ }
+
+ *value = strdup(it->value);
+
+ return AUTOFILL_ERROR_NONE;
+}
--- /dev/null
+/*
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <dlog.h>
+#include <unistd.h>
+#include <app.h>
+
+#include "autofill_private.h"
+#include <autofill_common.h>
+
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
+#define LOG_TAG "AUTOFILL"
+
+EXPORT_API int autofill_save_view_info_create(autofill_save_view_info_h *vi)
+{
+ if (!vi)
+ return AUTOFILL_ERROR_INVALID_PARAMETER;
+
+ struct autofill_save_view_info_s *vs = (struct autofill_save_view_info_s *)calloc(1, sizeof(struct autofill_save_view_info_s));
+ if (!vs)
+ return AUTOFILL_ERROR_OUT_OF_MEMORY;
+
+ *vi = (autofill_save_view_info_h)vs;
+
+ return AUTOFILL_ERROR_NONE;
+}
+
+EXPORT_API int autofill_save_view_info_destroy(autofill_save_view_info_h vi)
+{
+ if (!vi)
+ return AUTOFILL_ERROR_INVALID_PARAMETER;
+
+ if (vi->app_id)
+ free(vi->app_id);
+
+ if (vi->view_id)
+ free(vi->view_id);
+
+ // release memory autofill item list
+ autofill_save_item_h it_h;
+ EINA_LIST_FREE(vi->autofill_save_item_list, it_h)
+ autofill_save_item_destroy(it_h);
+
+ free(vi);
+
+ return AUTOFILL_ERROR_NONE;
+}
+
+// Set app id
+EXPORT_API int autofill_save_view_info_set_app_id(autofill_save_view_info_h vi, const char *app_id)
+{
+ if (!vi || !app_id)
+ return AUTOFILL_ERROR_INVALID_PARAMETER;
+
+ if (vi->app_id)
+ free(vi->app_id);
+
+ vi->app_id = strdup(app_id);
+
+ return AUTOFILL_ERROR_NONE;
+}
+
+EXPORT_API int autofill_save_view_info_get_app_id(autofill_save_view_info_h vi, char **app_id)
+{
+ if (!vi)
+ return AUTOFILL_ERROR_INVALID_PARAMETER;
+
+ if (!vi->app_id)
+ return AUTOFILL_ERROR_OPERATION_FAILED;
+
+ *app_id = strdup(vi->app_id);
+
+ return AUTOFILL_ERROR_NONE;
+}
+
+EXPORT_API int autofill_save_view_info_set_view_id(autofill_save_view_info_h vi, const char *view_id)
+{
+ if (!vi || !view_id)
+ return AUTOFILL_ERROR_INVALID_PARAMETER;
+
+ if (vi->view_id)
+ free(vi->view_id);
+
+ vi->view_id = strdup(view_id);
+
+ return AUTOFILL_ERROR_NONE;
+}
+
+EXPORT_API int autofill_save_view_info_get_view_id(autofill_save_view_info_h vi, char **view_id)
+{
+ if (!vi || !view_id)
+ return AUTOFILL_ERROR_INVALID_PARAMETER;
+
+ if (!vi->view_id)
+ return AUTOFILL_ERROR_OPERATION_FAILED;
+
+ *view_id = strdup(vi->view_id);
+
+ return AUTOFILL_ERROR_NONE;
+}
+
+EXPORT_API int autofill_save_view_info_add_item(const autofill_save_view_info_h vi, autofill_save_item_h it)
+{
+ if (!vi || !it)
+ return AUTOFILL_ERROR_INVALID_PARAMETER;
+
+ autofill_save_item_h clone = NULL;
+
+ autofill_save_item_clone(it, &clone);
+ if (!clone) {
+ LOGW("Out of memory");
+ return AUTOFILL_ERROR_OUT_OF_MEMORY;
+ }
+
+ vi->autofill_save_item_list = eina_list_append(vi->autofill_save_item_list, clone);
+
+ return AUTOFILL_ERROR_NONE;
+}
+
+EXPORT_API int autofill_save_view_info_foreach_items(autofill_save_view_info_h h,
+ bool (*callback)(autofill_save_item_h item, void *user_data), void *user_data)
+{
+ if (!h || !callback) {
+ return AUTOFILL_ERROR_INVALID_PARAMETER;
+ }
+
+ Eina_List *l;
+ autofill_save_item_h it;
+ EINA_LIST_FOREACH(h->autofill_save_item_list, l, it)
+ {
+ bool ret = callback(it, user_data);
+ if (!ret)
+ break;
+ }
+
+ return 0;
+}
int autofill_fill_response_unset_callback();
/**
+ * @brief Request to save Register the callback to receive autofill fill response
+ *
+ * @since_tizen 5.5
+ *
+ * @privlevel public
+ *
+ * @return 0 on success, otherwise a negative error value
+ * @retval #AUTOFILL_ERROR_NONE No error
+ */
+int autofill_commit(autofill_save_view_info_h vi);
+
+/**
* @}
*/
AUTOFILL_ERROR_IO_ERROR = TIZEN_ERROR_IO_ERROR, /**< I/O Error */
AUTOFILL_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid parameter */
AUTOFILL_ERROR_PERMISSION_DENIED = TIZEN_ERROR_PERMISSION_DENIED, /**< Permission denied */
+ AUTOFILL_ERROR_NOT_INITIALIZED = TIZEN_ERROR_ENDPOINT_NOT_CONNECTED, /**< Initialization is not set */
AUTOFILL_ERROR_NO_CALLBACK_FUNCTION = TIZEN_ERROR_IME | 0x0001, /**< Necessary callback function is not set */
AUTOFILL_ERROR_NOT_RUNNING = TIZEN_ERROR_IME | 0x0002, /**< IME main loop isn't started yet */
AUTOFILL_ERROR_OPERATION_FAILED = TIZEN_ERROR_IME | 0x0003, /**< Operation failed */
typedef struct autofill_view_info_s *autofill_view_info_h;
typedef struct autofill_fill_response_s *autofill_fill_response_h;
typedef struct autofill_response_item_s *autofill_fill_response_item_h;
+typedef struct autofill_save_item_s *autofill_save_item_h;
+typedef struct autofill_save_view_info_s *autofill_save_view_info_h;
/**
* @brief Create autofill item
int autofill_view_info_foreach_items(autofill_view_info_h h, bool (*callback)(autofill_item_h item, void *user_data), void *user_data);
+// save view info
+/**
+ * @brief Create autofill save view
+ *
+ * @since_tizen 5.5
+ *
+ * @privlevel public
+ *
+ * @return 0 on success, otherwise a negative error value
+ * @retval #IME_ERROR_NONE No error
+ */
+int autofill_save_view_info_create(autofill_save_view_info_h *vi);
+
+/**
+ * @brief Destroy autofill save view
+ *
+ * @since_tizen 5.5
+ *
+ * @privlevel public
+ *
+ * @return 0 on success, otherwise a negative error value
+ * @retval #IME_ERROR_NONE No error
+ */
+int autofill_save_view_info_destroy(autofill_save_view_info_h vi);
+
+/**
+ * @brief Set app ID
+ *
+ * @since_tizen 5.5
+ *
+ * @privlevel public
+ *
+ * @return 0 on success, otherwise a negative error value
+ * @retval #IME_ERROR_NONE No error
+ */
+int autofill_save_view_info_set_app_id(autofill_save_view_info_h vi, const char *app_id);
+
+/**
+ * @brief Get app ID
+ *
+ * @since_tizen 5.5
+ *
+ * @privlevel public
+ *
+ * @return 0 on success, otherwise a negative error value
+ * @retval #IME_ERROR_NONE No error
+ */
+int autofill_save_view_info_get_app_id(const autofill_save_view_info_h vi, char **app_id);
+
+/**
+ * @brief Set view ID
+ *
+ * @since_tizen 5.5
+ *
+ * @privlevel public
+ *
+ * @return 0 on success, otherwise a negative error value
+ * @retval #IME_ERROR_NONE No error
+ */
+int autofill_save_view_info_set_view_id(autofill_save_view_info_h vi, const char *view_id);
+
+/**
+ * @brief Get view ID
+ *
+ * @since_tizen 5.5
+ *
+ * @privlevel public
+ *
+ * @return 0 on success, otherwise a negative error value
+ * @retval #IME_ERROR_NONE No error
+ */
+int autofill_save_view_info_get_view_id(autofill_save_view_info_h vi, char **view_id); // app id get
+
+/**
+ * @brief Add autofill save item
+ *
+ * @since_tizen 5.5
+ *
+ * @privlevel public
+ *
+ * @return 0 on success, otherwise a negative error value
+ * @retval #IME_ERROR_NONE No error
+ */
+int autofill_save_view_info_add_item(const autofill_save_view_info_h vi, autofill_save_item_h it);
+
+int autofill_save_view_info_foreach_items(autofill_save_view_info_h h, bool (*callback)(autofill_save_item_h item, void *user_data), void *user_data);
+
// fill response
// 각 입력 필드별 autofill fill response item
/**
int autofill_fill_response_foreach_items(autofill_fill_response_h h, bool (*callback)(autofill_fill_response_item_h item, void *user_data), void *user_data);
+// save item
+/**
+ * @brief Create autofill save item
+ *
+ * @since_tizen 5.5
+ *
+ * @privlevel public
+ *
+ * @return 0 on success, otherwise a negative error value
+ * @retval #IME_ERROR_NONE No error
+ */
+int autofill_save_item_create(autofill_save_item_h *it);
+
+/**
+ * @brief Destroy autofill save item
+ *
+ * @since_tizen 5.5
+ *
+ * @privlevel public
+ *
+ * @return 0 on success, otherwise a negative error value
+ * @retval #IME_ERROR_NONE No error
+ */
+int autofill_save_item_destroy(autofill_save_item_h it);
+
+/**
+ * @brief Clone autofill item
+ *
+ * @since_tizen 5.5
+ *
+ * @privlevel public
+ *
+ * @return 0 on success, otherwise a negative error value
+ * @retval #IME_ERROR_NONE No error
+ */
+int autofill_save_item_clone(autofill_save_item_h h, autofill_save_item_h *clone);
+
+/**
+ * @brief Set autofill hint (id(username), name, password, phone, credit card number, organization, so on)
+ *
+ * @since_tizen 5.5
+ *
+ * @privlevel public
+ *
+ * @return 0 on success, otherwise a negative error value
+ * @retval #IME_ERROR_NONE No error
+ */
+int autofill_save_item_set_autofill_hint(autofill_save_item_h it, autofill_hint_e hint);
+
+/**
+ * @brief Get autofill hint
+ *
+ * @since_tizen 5.5
+ *
+ * @privlevel public
+ *
+ * @return 0 on success, otherwise a negative error value
+ * @retval #IME_ERROR_NONE No error
+ */
+int autofill_save_item_get_autofill_hint(autofill_save_item_h it, autofill_hint_e *hint);
+
+/**
+ * @brief Set autofill ID
+ *
+ * @since_tizen 5.5
+ *
+ * @privlevel public
+ *
+ * @return 0 on success, otherwise a negative error value
+ * @retval #IME_ERROR_NONE No error
+ */
+int autofill_save_item_set_id(autofill_save_item_h it, const char *id); // Set autofill ID
+
+/**
+ * @brief Get autofill ID
+ *
+ * @since_tizen 5.5
+ *
+ * @privlevel public
+ *
+ * @return 0 on success, otherwise a negative error value
+ * @retval #IME_ERROR_NONE No error
+ */
+int autofill_save_item_get_id(autofill_save_item_h it, char **id); // Get autofill ID
+
+/**
+ * @brief Set autofill label
+ *
+ * @since_tizen 5.5
+ *
+ * @privlevel public
+ *
+ * @return 0 on success, otherwise a negative error value
+ * @retval #IME_ERROR_NONE No error
+ */
+int autofill_save_item_set_label(autofill_save_item_h it, const char *label);
+
+/**
+ * @brief Get autofill label
+ *
+ * @since_tizen 5.5
+ *
+ * @privlevel public
+ *
+ * @return 0 on success, otherwise a negative error value
+ * @retval #IME_ERROR_NONE No error
+ */
+int autofill_save_item_get_label(autofill_save_item_h it, char **label);
+
+/**
+ * @brief Set sensitive data
+ *
+ * @since_tizen 5.5
+ *
+ * @privlevel public
+ *
+ * @return 0 on success, otherwise a negative error value
+ * @retval #IME_ERROR_NONE No error
+ */
+int autofill_save_item_set_sensitive_data(autofill_save_item_h it, bool sensitive);
+
+/**
+ * @brief Get sensitive data
+ *
+ * @since_tizen 5.5
+ *
+ * @privlevel public
+ *
+ * @return 0 on success, otherwise a negative error value
+ * @retval #IME_ERROR_NONE No error
+ */
+int autofill_save_item_get_sensitive_data(autofill_save_item_h it, bool *sensitive); // Get sensitive data
+
+/**
+ * @brief Set autofill value
+ *
+ * @since_tizen 5.5
+ *
+ * @privlevel public
+ *
+ * @return 0 on success, otherwise a negative error value
+ * @retval #IME_ERROR_NONE No error
+ */
+int autofill_save_item_set_value(autofill_save_item_h it, const char *value);
+
+/**
+ * @brief Get autofill value
+ *
+ * @since_tizen 5.5
+ *
+ * @privlevel public
+ *
+ * @return 0 on success, otherwise a negative error value
+ * @retval #IME_ERROR_NONE No error
+ */
+int autofill_save_item_get_value(autofill_save_item_h it, char **value);
+
/**
* @}
*/
typedef void (*autofill_service_fill_request_cb)(autofill_view_info_h vi, void *user_data);
+typedef void (*autofill_service_commit_cb)(autofill_save_view_info_h vi, void *user_data);
+
// initialize / deinitialize
/**
* @brief Initialize autofill service library
*/
int autofill_service_send_fill_response(autofill_fill_response_h h);
+// commit (save)
+int autofill_service_set_commit_cb(autofill_service_commit_cb callback, void *user_data);
+
// save request
//int autofill_service_set_save_request_cb();
return 0;
}
+struct autofill_svc_save_item_s {
+ rpc_port_parcelable_t parcelable;
+ char *id;
+ char *label;
+ char *value;
+ int autofill_hint;
+ bool is_sensitive_data;
+};
+
+static void __autofill_svc_save_item_to(rpc_port_parcel_h parcel, void *data)
+{
+ rpc_port_autofill_svc_save_item_h h = data;
+
+ if (!parcel || !h) {
+ _E("Invalid parameter");
+ return;
+ }
+
+ rpc_port_parcel_write_string(parcel, h->id ? h->id : "");
+ rpc_port_parcel_write_string(parcel, h->label ? h->label : "");
+ rpc_port_parcel_write_string(parcel, h->value ? h->value : "");
+ rpc_port_parcel_write_int32(parcel, h->autofill_hint);
+ rpc_port_parcel_write_bool(parcel, h->is_sensitive_data);
+}
+
+static void __autofill_svc_save_item_from(rpc_port_parcel_h parcel, void *data)
+{
+ rpc_port_autofill_svc_save_item_h h = data;
+
+ if (!parcel || !h) {
+ _E("Invalid parameter");
+ return;
+ }
+
+ rpc_port_parcel_read_string(parcel, &h->id);
+ rpc_port_parcel_read_string(parcel, &h->label);
+ rpc_port_parcel_read_string(parcel, &h->value);
+ rpc_port_parcel_read_int32(parcel, &h->autofill_hint);
+ rpc_port_parcel_read_bool(parcel, &h->is_sensitive_data);
+}
+
+int rpc_port_autofill_svc_save_item_create(rpc_port_autofill_svc_save_item_h *h)
+{
+ struct autofill_svc_save_item_s *handle;
+
+ if (!h) {
+ _E("Invalid parameter");
+ return -1;
+ }
+
+ handle = calloc(1, sizeof(struct autofill_svc_save_item_s));
+ if (!handle) {
+ _E("Out of memory");
+ return -1;
+ }
+
+ handle->parcelable.to = __autofill_svc_save_item_to;
+ handle->parcelable.from = __autofill_svc_save_item_from;
+
+ *h = handle;
+
+ return 0;
+}
+
+int rpc_port_autofill_svc_save_item_destroy(rpc_port_autofill_svc_save_item_h h)
+{
+ if (!h) {
+ _E("Invalid parameter");
+ return -1;
+ }
+
+ if (h->id)
+ free(h->id);
+
+ if (h->label)
+ free(h->label);
+
+ if (h->value)
+ free(h->value);
+
+ free(h);
+
+ return 0;
+}
+
+int rpc_port_autofill_svc_save_item_clone(rpc_port_autofill_svc_save_item_h h, rpc_port_autofill_svc_save_item_h *clone)
+{
+ rpc_port_autofill_svc_save_item_h handle = NULL;
+
+ if (!h || !clone) {
+ _E("Invalid parameter");
+ return -1;
+ }
+
+ rpc_port_autofill_svc_save_item_create(&handle);
+ if (!handle) {
+ _E("Failed to create autofill_svc_save_item handle");
+ return -1;
+ }
+
+ if (h->id) {
+ handle->id = strdup(h->id);
+ if (!handle->id) {
+ _E("Failed to duplicate h->id");
+ rpc_port_autofill_svc_save_item_destroy(handle);
+ return -1;
+ }
+ }
+
+ if (h->label) {
+ handle->label = strdup(h->label);
+ if (!handle->label) {
+ _E("Failed to duplicate h->label");
+ rpc_port_autofill_svc_save_item_destroy(handle);
+ return -1;
+ }
+ }
+
+ if (h->value) {
+ handle->value = strdup(h->value);
+ if (!handle->value) {
+ _E("Failed to duplicate h->value");
+ rpc_port_autofill_svc_save_item_destroy(handle);
+ return -1;
+ }
+ }
+
+ handle->autofill_hint = h->autofill_hint;
+ handle->is_sensitive_data = h->is_sensitive_data;
+ *clone = handle;
+
+ return 0;
+}
+
+int rpc_port_autofill_svc_save_item_set_id(rpc_port_autofill_svc_save_item_h h, const char *id)
+{
+ if (!h || !id) {
+ _E("Invalid parameter");
+ return -1;
+ }
+
+ if (h->id) {
+ free(h->id);
+ h->id = NULL;
+ }
+
+ h->id = strdup(id);
+ if (!h->id) {
+ _E("Failed to duplicate data");
+ return -1;
+ }
+
+ return 0;
+}
+
+int rpc_port_autofill_svc_save_item_set_label(rpc_port_autofill_svc_save_item_h h, const char *label)
+{
+ if (!h || !label) {
+ _E("Invalid parameter");
+ return -1;
+ }
+
+ if (h->label) {
+ free(h->label);
+ h->label = NULL;
+ }
+
+ h->label = strdup(label);
+ if (!h->label) {
+ _E("Failed to duplicate data");
+ return -1;
+ }
+
+ return 0;
+}
+
+int rpc_port_autofill_svc_save_item_set_value(rpc_port_autofill_svc_save_item_h h, const char *value)
+{
+ if (!h || !value) {
+ _E("Invalid parameter");
+ return -1;
+ }
+
+ if (h->value) {
+ free(h->value);
+ h->value = NULL;
+ }
+
+ h->value = strdup(value);
+ if (!h->value) {
+ _E("Failed to duplicate data");
+ return -1;
+ }
+
+ return 0;
+}
+
+int rpc_port_autofill_svc_save_item_set_autofill_hint(rpc_port_autofill_svc_save_item_h h, int autofill_hint)
+{
+ if (!h) {
+ _E("Invalid parameter");
+ return -1;
+ }
+
+ h->autofill_hint = autofill_hint;
+ return 0;
+}
+
+int rpc_port_autofill_svc_save_item_set_is_sensitive_data(rpc_port_autofill_svc_save_item_h h, bool is_sensitive_data)
+{
+ if (!h) {
+ _E("Invalid parameter");
+ return -1;
+ }
+
+ h->is_sensitive_data = is_sensitive_data;
+ return 0;
+}
+
+int rpc_port_autofill_svc_save_item_get_id(rpc_port_autofill_svc_save_item_h h, char **id)
+{
+ if (!h || !id) {
+ _E("Invalid parameter");
+ return -1;
+ }
+
+ if (!h->id) {
+ _E("Invalid parameter: h->id is NULL");
+ return -1;
+ }
+
+ *id = strdup(h->id);
+ if (*id == NULL) {
+ _E("Failed to duplicate id");
+ return -1;
+ }
+
+ return 0;
+}
+
+int rpc_port_autofill_svc_save_item_get_label(rpc_port_autofill_svc_save_item_h h, char **label)
+{
+ if (!h || !label) {
+ _E("Invalid parameter");
+ return -1;
+ }
+
+ if (!h->label) {
+ _E("Invalid parameter: h->label is NULL");
+ return -1;
+ }
+
+ *label = strdup(h->label);
+ if (*label == NULL) {
+ _E("Failed to duplicate label");
+ return -1;
+ }
+
+ return 0;
+}
+
+int rpc_port_autofill_svc_save_item_get_value(rpc_port_autofill_svc_save_item_h h, char **value)
+{
+ if (!h || !value) {
+ _E("Invalid parameter");
+ return -1;
+ }
+
+ if (!h->value) {
+ _E("Invalid parameter: h->value is NULL");
+ return -1;
+ }
+
+ *value = strdup(h->value);
+ if (*value == NULL) {
+ _E("Failed to duplicate value");
+ return -1;
+ }
+
+ return 0;
+}
+
+int rpc_port_autofill_svc_save_item_get_autofill_hint(rpc_port_autofill_svc_save_item_h h, int *autofill_hint)
+{
+ if (!h || !autofill_hint) {
+ _E("Invalid parameter");
+ return -1;
+ }
+
+ *autofill_hint = h->autofill_hint;
+ return 0;
+}
+
+int rpc_port_autofill_svc_save_item_get_is_sensitive_data(rpc_port_autofill_svc_save_item_h h, bool *is_sensitive_data)
+{
+ if (!h || !is_sensitive_data) {
+ _E("Invalid parameter");
+ return -1;
+ }
+
+ *is_sensitive_data = h->is_sensitive_data;
+ return 0;
+}
+
+struct autofill_svc_save_view_info_s {
+ rpc_port_parcelable_t parcelable;
+ char *view_id;
+ GList *items;
+};
+
+static void __autofill_svc_save_view_info_to(rpc_port_parcel_h parcel, void *data)
+{
+ rpc_port_autofill_svc_save_view_info_h h = data;
+
+ if (!parcel || !h) {
+ _E("Invalid parameter");
+ return;
+ }
+
+ rpc_port_parcel_write_string(parcel, h->view_id ? h->view_id : "");
+ rpc_port_parcel_write_array_count(parcel, g_list_length(h->items));
+ do {
+ GList *iter;
+
+ iter = h->items;
+ while (iter) {
+ rpc_port_autofill_svc_save_item_h value = iter->data;
+
+ iter = g_list_next(iter);
+ if (!value) {
+ _W("Warning: value is NULL");
+ continue;
+ }
+ rpc_port_parcel_write(parcel, &value->parcelable, value);
+ }
+ } while (0);
+}
+
+static void __autofill_svc_save_view_info_from(rpc_port_parcel_h parcel, void *data)
+{
+ rpc_port_autofill_svc_save_view_info_h h = data;
+
+ if (!parcel || !h) {
+ _E("Invalid parameter");
+ return;
+ }
+
+ rpc_port_parcel_read_string(parcel, &h->view_id);
+ do {
+ int len = 0;
+
+ rpc_port_parcel_read_array_count(parcel, &len);
+ for (int i = 0; i < len; i++) {
+ rpc_port_autofill_svc_save_item_h value = NULL;
+
+ rpc_port_autofill_svc_save_item_create(&value);
+ if (!value) {
+ _E("Failed to create handle");
+ return;
+ }
+
+ rpc_port_parcel_read(parcel, &value->parcelable, value);
+ h->items = g_list_append(h->items, value);
+ }
+ } while (0);
+}
+
+int rpc_port_autofill_svc_save_view_info_create(rpc_port_autofill_svc_save_view_info_h *h)
+{
+ struct autofill_svc_save_view_info_s *handle;
+
+ if (!h) {
+ _E("Invalid parameter");
+ return -1;
+ }
+
+ handle = calloc(1, sizeof(struct autofill_svc_save_view_info_s));
+ if (!handle) {
+ _E("Out of memory");
+ return -1;
+ }
+
+ handle->parcelable.to = __autofill_svc_save_view_info_to;
+ handle->parcelable.from = __autofill_svc_save_view_info_from;
+
+ *h = handle;
+
+ return 0;
+}
+
+int rpc_port_autofill_svc_save_view_info_destroy(rpc_port_autofill_svc_save_view_info_h h)
+{
+ if (!h) {
+ _E("Invalid parameter");
+ return -1;
+ }
+
+ if (h->view_id)
+ free(h->view_id);
+
+ do {
+ GList *iter;
+
+ iter = h->items;
+ while (iter) {
+ rpc_port_autofill_svc_save_item_h value = iter->data;
+ if (value)
+ rpc_port_autofill_svc_save_item_destroy(value);
+
+ iter = g_list_next(iter);
+ }
+ g_list_free(h->items);
+ } while (0);
+
+ free(h);
+
+ return 0;
+}
+
+int rpc_port_autofill_svc_save_view_info_clone(rpc_port_autofill_svc_save_view_info_h h, rpc_port_autofill_svc_save_view_info_h *clone)
+{
+ rpc_port_autofill_svc_save_view_info_h handle = NULL;
+
+ if (!h || !clone) {
+ _E("Invalid parameter");
+ return -1;
+ }
+
+ rpc_port_autofill_svc_save_view_info_create(&handle);
+ if (!handle) {
+ _E("Failed to create autofill_svc_save_view_info handle");
+ return -1;
+ }
+
+ if (h->view_id) {
+ handle->view_id = strdup(h->view_id);
+ if (!handle->view_id) {
+ _E("Failed to duplicate h->view_id");
+ rpc_port_autofill_svc_save_view_info_destroy(handle);
+ return -1;
+ }
+ }
+
+ do {
+ GList *iter;
+
+ iter = h->items;
+ while (iter) {
+ rpc_port_autofill_svc_save_item_h new_value;
+ rpc_port_autofill_svc_save_item_h value = iter->data;
+
+ if (!value) {
+ _E("Error: value is NULL");
+ rpc_port_autofill_svc_save_view_info_destroy(handle);
+ return -1;
+ }
+
+ rpc_port_autofill_svc_save_item_clone(value, &new_value);
+ if (!new_value) {
+ _E("Failed to duplicate value");
+ rpc_port_autofill_svc_save_view_info_destroy(handle);
+ return -1;
+ }
+
+ handle->items = g_list_append(handle->items, new_value);
+ iter = g_list_next(iter);
+ }
+ } while (0);
+
+ *clone = handle;
+
+ return 0;
+}
+
+int rpc_port_autofill_svc_save_view_info_set_view_id(rpc_port_autofill_svc_save_view_info_h h, const char *view_id)
+{
+ if (!h || !view_id) {
+ _E("Invalid parameter");
+ return -1;
+ }
+
+ if (h->view_id) {
+ free(h->view_id);
+ h->view_id = NULL;
+ }
+
+ h->view_id = strdup(view_id);
+ if (!h->view_id) {
+ _E("Failed to duplicate data");
+ return -1;
+ }
+
+ return 0;
+}
+
+int rpc_port_autofill_svc_save_view_info_add_items(rpc_port_autofill_svc_save_view_info_h h, rpc_port_autofill_svc_save_item_h items)
+{
+ if (!h || !items) {
+ _E("Invalid parameter");
+ return -1;
+ }
+
+ do {
+ rpc_port_autofill_svc_save_item_h value = NULL;
+
+ rpc_port_autofill_svc_save_item_clone(items, &value);
+ if (!value) {
+ _E("Out of memory");
+ return -1;
+ }
+
+ h->items = g_list_append(h->items, value);
+ } while (0);
+
+ return 0;
+}
+
+int rpc_port_autofill_svc_save_view_info_get_view_id(rpc_port_autofill_svc_save_view_info_h h, char **view_id)
+{
+ if (!h || !view_id) {
+ _E("Invalid parameter");
+ return -1;
+ }
+
+ if (!h->view_id) {
+ _E("Invalid parameter: h->view_id is NULL");
+ return -1;
+ }
+
+ *view_id = strdup(h->view_id);
+ if (*view_id == NULL) {
+ _E("Failed to duplicate view_id");
+ return -1;
+ }
+
+ return 0;
+}
+
+int rpc_port_autofill_svc_save_view_info_foreach_items(rpc_port_autofill_svc_save_view_info_h h,
+ bool (*callback)(rpc_port_autofill_svc_save_item_h items, void *user_data), void *user_data)
+{
+ if (!h || !callback) {
+ _E("Invalid parameter");
+ return -1;
+ }
+
+ do {
+ GList *iter;
+
+ iter = h->items;
+ while (iter) {
+ rpc_port_autofill_svc_save_item_h value = iter->data;
+
+ iter = g_list_next(iter);
+ if (!value) {
+ _W("Warning: value is NULL");
+ continue;
+ }
+
+ bool ret = callback(value, user_data);
+ if (!ret)
+ break;
+ }
+ } while (0);
+
+ return 0;
+}
+
+int rpc_port_autofill_svc_save_view_info_remove_items(rpc_port_autofill_svc_save_view_info_h h, unsigned int nth)
+{
+ GList *iter;
+
+ if (!h) {
+ _E("Invalid parameter");
+ return -1;
+ }
+
+ iter = g_list_nth(h->items, nth);
+ if (iter == NULL)
+ return -1;
+
+ rpc_port_autofill_svc_save_item_h value = iter->data;
+ h->items = g_list_remove_link(h->items, iter);
+ rpc_port_autofill_svc_save_item_destroy(value);
+ g_list_free(iter);
+
+ return 0;
+}
+
+int rpc_port_autofill_svc_save_view_info_get_items_length(rpc_port_autofill_svc_save_view_info_h h, unsigned int *length)
+{
+ if (!h || !length) {
+ _E("Invalid parameter");
+ return -1;
+ }
+
+ *length = g_list_length(h->items);
+
+ return 0;
+}
+
struct autofill_svc_auth_info_s {
rpc_port_parcelable_t parcelable;
char *app_id;
return 0;
}
+struct list_autofill_svc_save_item_s {
+ rpc_port_parcelable_t parcelable;
+ GList *list_autofill_svc_save_items;
+};
+
+static void __list_autofill_svc_save_item_to(rpc_port_parcel_h parcel, void *data)
+{
+ rpc_port_list_autofill_svc_save_item_h h = data;
+
+ if (!parcel || !h) {
+ _E("Invalid parameter");
+ return;
+ }
+
+ rpc_port_parcel_write_array_count(parcel, g_list_length(h->list_autofill_svc_save_items));
+ do {
+ GList *iter;
+
+ iter = h->list_autofill_svc_save_items;
+ while (iter) {
+ rpc_port_autofill_svc_save_item_h value = iter->data;
+
+ iter = g_list_next(iter);
+ if (!value) {
+ _W("Warning: value is NULL");
+ continue;
+ }
+ rpc_port_parcel_write(parcel, &value->parcelable, value);
+ }
+ } while (0);
+}
+
+static void __list_autofill_svc_save_item_from(rpc_port_parcel_h parcel, void *data)
+{
+ rpc_port_list_autofill_svc_save_item_h h = data;
+
+ if (!parcel || !h) {
+ _E("Invalid parameter");
+ return;
+ }
+
+ do {
+ int len = 0;
+
+ rpc_port_parcel_read_array_count(parcel, &len);
+ for (int i = 0; i < len; i++) {
+ rpc_port_autofill_svc_save_item_h value = NULL;
+
+ rpc_port_autofill_svc_save_item_create(&value);
+ if (!value) {
+ _E("Failed to create handle");
+ return;
+ }
+
+ rpc_port_parcel_read(parcel, &value->parcelable, value);
+ h->list_autofill_svc_save_items = g_list_append(h->list_autofill_svc_save_items, value);
+ }
+ } while (0);
+}
+
+int rpc_port_list_autofill_svc_save_item_create(rpc_port_list_autofill_svc_save_item_h *h)
+{
+ struct list_autofill_svc_save_item_s *handle;
+
+ if (!h) {
+ _E("Invalid parameter");
+ return -1;
+ }
+
+ handle = calloc(1, sizeof(struct list_autofill_svc_save_item_s));
+ if (!handle) {
+ _E("Out of memory");
+ return -1;
+ }
+
+ handle->parcelable.to = __list_autofill_svc_save_item_to;
+ handle->parcelable.from = __list_autofill_svc_save_item_from;
+
+ *h = handle;
+
+ return 0;
+}
+
+int rpc_port_list_autofill_svc_save_item_destroy(rpc_port_list_autofill_svc_save_item_h h)
+{
+ if (!h) {
+ _E("Invalid parameter");
+ return -1;
+ }
+
+ do {
+ GList *iter;
+
+ iter = h->list_autofill_svc_save_items;
+ while (iter) {
+ rpc_port_autofill_svc_save_item_h value = iter->data;
+ if (value)
+ rpc_port_autofill_svc_save_item_destroy(value);
+
+ iter = g_list_next(iter);
+ }
+ g_list_free(h->list_autofill_svc_save_items);
+ } while (0);
+
+ free(h);
+
+ return 0;
+}
+
+int rpc_port_list_autofill_svc_save_item_clone(rpc_port_list_autofill_svc_save_item_h h, rpc_port_list_autofill_svc_save_item_h *clone)
+{
+ rpc_port_list_autofill_svc_save_item_h handle = NULL;
+
+ if (!h || !clone) {
+ _E("Invalid parameter");
+ return -1;
+ }
+
+ rpc_port_list_autofill_svc_save_item_create(&handle);
+ if (!handle) {
+ _E("Failed to create list_autofill_svc_save_item handle");
+ return -1;
+ }
+
+ do {
+ GList *iter;
+
+ iter = h->list_autofill_svc_save_items;
+ while (iter) {
+ rpc_port_autofill_svc_save_item_h new_value;
+ rpc_port_autofill_svc_save_item_h value = iter->data;
+
+ if (!value) {
+ _E("Error: value is NULL");
+ rpc_port_list_autofill_svc_save_item_destroy(handle);
+ return -1;
+ }
+
+ rpc_port_autofill_svc_save_item_clone(value, &new_value);
+ if (!new_value) {
+ _E("Failed to duplicate value");
+ rpc_port_list_autofill_svc_save_item_destroy(handle);
+ return -1;
+ }
+
+ handle->list_autofill_svc_save_items = g_list_append(handle->list_autofill_svc_save_items, new_value);
+ iter = g_list_next(iter);
+ }
+ } while (0);
+
+ *clone = handle;
+
+ return 0;
+}
+
+int rpc_port_list_autofill_svc_save_item_add_list_autofill_svc_save_items(rpc_port_list_autofill_svc_save_item_h h, rpc_port_autofill_svc_save_item_h list_autofill_svc_save_items)
+{
+ if (!h || !list_autofill_svc_save_items) {
+ _E("Invalid parameter");
+ return -1;
+ }
+
+ do {
+ rpc_port_autofill_svc_save_item_h value = NULL;
+
+ rpc_port_autofill_svc_save_item_clone(list_autofill_svc_save_items, &value);
+ if (!value) {
+ _E("Out of memory");
+ return -1;
+ }
+
+ h->list_autofill_svc_save_items = g_list_append(h->list_autofill_svc_save_items, value);
+ } while (0);
+
+ return 0;
+}
+
+int rpc_port_list_autofill_svc_save_item_foreach_list_autofill_svc_save_items(rpc_port_list_autofill_svc_save_item_h h,
+ bool (*callback)(rpc_port_autofill_svc_save_item_h list_autofill_svc_save_items, void *user_data), void *user_data)
+{
+ if (!h || !callback) {
+ _E("Invalid parameter");
+ return -1;
+ }
+
+ do {
+ GList *iter;
+
+ iter = h->list_autofill_svc_save_items;
+ while (iter) {
+ rpc_port_autofill_svc_save_item_h value = iter->data;
+
+ iter = g_list_next(iter);
+ if (!value) {
+ _W("Warning: value is NULL");
+ continue;
+ }
+
+ bool ret = callback(value, user_data);
+ if (!ret)
+ break;
+ }
+ } while (0);
+
+ return 0;
+}
+
+int rpc_port_list_autofill_svc_save_item_remove_list_autofill_svc_save_items(rpc_port_list_autofill_svc_save_item_h h, unsigned int nth)
+{
+ GList *iter;
+
+ if (!h) {
+ _E("Invalid parameter");
+ return -1;
+ }
+
+ iter = g_list_nth(h->list_autofill_svc_save_items, nth);
+ if (iter == NULL)
+ return -1;
+
+ rpc_port_autofill_svc_save_item_h value = iter->data;
+ h->list_autofill_svc_save_items = g_list_remove_link(h->list_autofill_svc_save_items, iter);
+ rpc_port_autofill_svc_save_item_destroy(value);
+ g_list_free(iter);
+
+ return 0;
+}
+
+int rpc_port_list_autofill_svc_save_item_get_list_autofill_svc_save_items_length(rpc_port_list_autofill_svc_save_item_h h, unsigned int *length)
+{
+ if (!h || !length) {
+ _E("Invalid parameter");
+ return -1;
+ }
+
+ *length = g_list_length(h->list_autofill_svc_save_items);
+
+ return 0;
+}
+
enum AutofillSvcPort_method_e {
AutofillSvcPort_METHOD_Result,
AutofillSvcPort_METHOD_Callback,
AutofillSvcPort_METHOD_Unregister,
AutofillSvcPort_METHOD_request_auth_info,
AutofillSvcPort_METHOD_send_fill_request,
+ AutofillSvcPort_METHOD_commit,
};
enum AutofillSvcPort_delegate_e {
set_last_result(r);
}
+void rpc_port_proxy_AutofillSvcPort_invoke_commit(rpc_port_proxy_AutofillSvcPort_h h, rpc_port_autofill_svc_save_view_info_h si)
+{
+ rpc_port_parcel_h parcel;
+ int r;
+
+ if (!h || !si) {
+ _E("Invalid parameter");
+ return;
+ }
+
+ if (!h->port) {
+ _E("Not connected");
+ return;
+ }
+
+ rpc_port_parcel_create(&parcel);
+ rpc_port_parcel_write_int32(parcel, AutofillSvcPort_METHOD_commit);
+ rpc_port_parcel_write(parcel, &si->parcelable, si);
+
+ r = rpc_port_parcel_send(parcel, h->port);
+ if (r != RPC_PORT_ERROR_NONE) {
+ _E("Failed to send parcel. result(%d)", r);
+ r = RPC_PORT_ERROR_IO_ERROR;
+ }
+
+ rpc_port_parcel_destroy(parcel);
+ set_last_result(r);
+}
+
static struct AutofillSvcPort_s *__create_AutofillSvcPort(const char *stub_appid, rpc_port_proxy_AutofillSvcPort_callback_s *callback, void *user_data)
{
struct AutofillSvcPort_s *handle;
int rpc_port_autofill_svc_view_info_get_items_length(rpc_port_autofill_svc_view_info_h h, unsigned int *length);
+typedef struct autofill_svc_save_item_s *rpc_port_autofill_svc_save_item_h;
+
+int rpc_port_autofill_svc_save_item_create(rpc_port_autofill_svc_save_item_h *h);
+
+int rpc_port_autofill_svc_save_item_destroy(rpc_port_autofill_svc_save_item_h h);
+
+int rpc_port_autofill_svc_save_item_clone(rpc_port_autofill_svc_save_item_h h, rpc_port_autofill_svc_save_item_h *clone);
+
+int rpc_port_autofill_svc_save_item_set_id(rpc_port_autofill_svc_save_item_h h, const char *id);
+
+int rpc_port_autofill_svc_save_item_set_label(rpc_port_autofill_svc_save_item_h h, const char *label);
+
+int rpc_port_autofill_svc_save_item_set_value(rpc_port_autofill_svc_save_item_h h, const char *value);
+
+int rpc_port_autofill_svc_save_item_set_autofill_hint(rpc_port_autofill_svc_save_item_h h, int autofill_hint);
+
+int rpc_port_autofill_svc_save_item_set_is_sensitive_data(rpc_port_autofill_svc_save_item_h h, bool is_sensitive_data);
+
+int rpc_port_autofill_svc_save_item_get_id(rpc_port_autofill_svc_save_item_h h, char **id);
+
+int rpc_port_autofill_svc_save_item_get_label(rpc_port_autofill_svc_save_item_h h, char **label);
+
+int rpc_port_autofill_svc_save_item_get_value(rpc_port_autofill_svc_save_item_h h, char **value);
+
+int rpc_port_autofill_svc_save_item_get_autofill_hint(rpc_port_autofill_svc_save_item_h h, int *autofill_hint);
+
+int rpc_port_autofill_svc_save_item_get_is_sensitive_data(rpc_port_autofill_svc_save_item_h h, bool *is_sensitive_data);
+
+typedef struct autofill_svc_save_view_info_s *rpc_port_autofill_svc_save_view_info_h;
+
+int rpc_port_autofill_svc_save_view_info_create(rpc_port_autofill_svc_save_view_info_h *h);
+
+int rpc_port_autofill_svc_save_view_info_destroy(rpc_port_autofill_svc_save_view_info_h h);
+
+int rpc_port_autofill_svc_save_view_info_clone(rpc_port_autofill_svc_save_view_info_h h, rpc_port_autofill_svc_save_view_info_h *clone);
+
+int rpc_port_autofill_svc_save_view_info_set_view_id(rpc_port_autofill_svc_save_view_info_h h, const char *view_id);
+
+int rpc_port_autofill_svc_save_view_info_add_items(rpc_port_autofill_svc_save_view_info_h h, rpc_port_autofill_svc_save_item_h items);
+
+int rpc_port_autofill_svc_save_view_info_get_view_id(rpc_port_autofill_svc_save_view_info_h h, char **view_id);
+
+int rpc_port_autofill_svc_save_view_info_foreach_items(rpc_port_autofill_svc_save_view_info_h h,
+ bool (*callback)(rpc_port_autofill_svc_save_item_h items, void *user_data), void *user_data);
+
+int rpc_port_autofill_svc_save_view_info_remove_items(rpc_port_autofill_svc_save_view_info_h h, unsigned int nth);
+
+int rpc_port_autofill_svc_save_view_info_get_items_length(rpc_port_autofill_svc_save_view_info_h h, unsigned int *length);
+
typedef struct autofill_svc_auth_info_s *rpc_port_autofill_svc_auth_info_h;
int rpc_port_autofill_svc_auth_info_create(rpc_port_autofill_svc_auth_info_h *h);
int rpc_port_list_autofill_svc_response_item_get_list_autofill_svc_response_items_length(rpc_port_list_autofill_svc_response_item_h h, unsigned int *length);
+typedef struct list_autofill_svc_save_item_s *rpc_port_list_autofill_svc_save_item_h;
+
+int rpc_port_list_autofill_svc_save_item_create(rpc_port_list_autofill_svc_save_item_h *h);
+
+int rpc_port_list_autofill_svc_save_item_destroy(rpc_port_list_autofill_svc_save_item_h h);
+
+int rpc_port_list_autofill_svc_save_item_clone(rpc_port_list_autofill_svc_save_item_h h, rpc_port_list_autofill_svc_save_item_h *clone);
+
+int rpc_port_list_autofill_svc_save_item_add_list_autofill_svc_save_items(rpc_port_list_autofill_svc_save_item_h h, rpc_port_autofill_svc_save_item_h list_autofill_svc_save_items);
+
+int rpc_port_list_autofill_svc_save_item_foreach_list_autofill_svc_save_items(rpc_port_list_autofill_svc_save_item_h h,
+ bool (*callback)(rpc_port_autofill_svc_save_item_h list_autofill_svc_save_items, void *user_data), void *user_data);
+
+int rpc_port_list_autofill_svc_save_item_remove_list_autofill_svc_save_items(rpc_port_list_autofill_svc_save_item_h h, unsigned int nth);
+
+int rpc_port_list_autofill_svc_save_item_get_list_autofill_svc_save_items_length(rpc_port_list_autofill_svc_save_item_h h, unsigned int *length);
+
typedef struct AutofillSvcPort_s *rpc_port_proxy_AutofillSvcPort_h;
typedef struct {
void rpc_port_proxy_AutofillSvcPort_invoke_send_fill_request(rpc_port_proxy_AutofillSvcPort_h h, rpc_port_autofill_svc_view_info_h vi);
+void rpc_port_proxy_AutofillSvcPort_invoke_commit(rpc_port_proxy_AutofillSvcPort_h h, rpc_port_autofill_svc_save_view_info_h si);
+
#ifdef __cplusplus
}
#endif
return 0;
}
+struct autofill_save_item_s {
+ rpc_port_parcelable_t parcelable;
+ char *id;
+ char *label;
+ char *value;
+ int autofill_hint;
+ bool is_sensitive_data;
+};
+
+static void __autofill_save_item_to(rpc_port_parcel_h parcel, void *data)
+{
+ rpc_port_autofill_save_item_h h = data;
+
+ if (!parcel || !h) {
+ _E("Invalid parameter");
+ return;
+ }
+
+ rpc_port_parcel_write_string(parcel, h->id ? h->id : "");
+ rpc_port_parcel_write_string(parcel, h->label ? h->label : "");
+ rpc_port_parcel_write_string(parcel, h->value ? h->value : "");
+ rpc_port_parcel_write_int32(parcel, h->autofill_hint);
+ rpc_port_parcel_write_bool(parcel, h->is_sensitive_data);
+}
+
+static void __autofill_save_item_from(rpc_port_parcel_h parcel, void *data)
+{
+ rpc_port_autofill_save_item_h h = data;
+
+ if (!parcel || !h) {
+ _E("Invalid parameter");
+ return;
+ }
+
+ rpc_port_parcel_read_string(parcel, &h->id);
+ rpc_port_parcel_read_string(parcel, &h->label);
+ rpc_port_parcel_read_string(parcel, &h->value);
+ rpc_port_parcel_read_int32(parcel, &h->autofill_hint);
+ rpc_port_parcel_read_bool(parcel, &h->is_sensitive_data);
+}
+
+int rpc_port_autofill_save_item_create(rpc_port_autofill_save_item_h *h)
+{
+ struct autofill_save_item_s *handle;
+
+ if (!h) {
+ _E("Invalid parameter");
+ return -1;
+ }
+
+ handle = calloc(1, sizeof(struct autofill_save_item_s));
+ if (!handle) {
+ _E("Out of memory");
+ return -1;
+ }
+
+ handle->parcelable.to = __autofill_save_item_to;
+ handle->parcelable.from = __autofill_save_item_from;
+
+ *h = handle;
+
+ return 0;
+}
+
+int rpc_port_autofill_save_item_destroy(rpc_port_autofill_save_item_h h)
+{
+ if (!h) {
+ _E("Invalid parameter");
+ return -1;
+ }
+
+ if (h->id)
+ free(h->id);
+
+ if (h->label)
+ free(h->label);
+
+ if (h->value)
+ free(h->value);
+
+ free(h);
+
+ return 0;
+}
+
+int rpc_port_autofill_save_item_clone(rpc_port_autofill_save_item_h h, rpc_port_autofill_save_item_h *clone)
+{
+ rpc_port_autofill_save_item_h handle = NULL;
+
+ if (!h || !clone) {
+ _E("Invalid parameter");
+ return -1;
+ }
+
+ rpc_port_autofill_save_item_create(&handle);
+ if (!handle) {
+ _E("Failed to create autofill_save_item handle");
+ return -1;
+ }
+
+ if (h->id) {
+ handle->id = strdup(h->id);
+ if (!handle->id) {
+ _E("Failed to duplicate h->id");
+ rpc_port_autofill_save_item_destroy(handle);
+ return -1;
+ }
+ }
+
+ if (h->label) {
+ handle->label = strdup(h->label);
+ if (!handle->label) {
+ _E("Failed to duplicate h->label");
+ rpc_port_autofill_save_item_destroy(handle);
+ return -1;
+ }
+ }
+
+ if (h->value) {
+ handle->value = strdup(h->value);
+ if (!handle->value) {
+ _E("Failed to duplicate h->value");
+ rpc_port_autofill_save_item_destroy(handle);
+ return -1;
+ }
+ }
+
+ handle->autofill_hint = h->autofill_hint;
+ handle->is_sensitive_data = h->is_sensitive_data;
+ *clone = handle;
+
+ return 0;
+}
+
+int rpc_port_autofill_save_item_set_id(rpc_port_autofill_save_item_h h, const char *id)
+{
+ if (!h || !id) {
+ _E("Invalid parameter");
+ return -1;
+ }
+
+ if (h->id) {
+ free(h->id);
+ h->id = NULL;
+ }
+
+ h->id = strdup(id);
+ if (!h->id) {
+ _E("Failed to duplicate data");
+ return -1;
+ }
+
+ return 0;
+}
+
+int rpc_port_autofill_save_item_set_label(rpc_port_autofill_save_item_h h, const char *label)
+{
+ if (!h || !label) {
+ _E("Invalid parameter");
+ return -1;
+ }
+
+ if (h->label) {
+ free(h->label);
+ h->label = NULL;
+ }
+
+ h->label = strdup(label);
+ if (!h->label) {
+ _E("Failed to duplicate data");
+ return -1;
+ }
+
+ return 0;
+}
+
+int rpc_port_autofill_save_item_set_value(rpc_port_autofill_save_item_h h, const char *value)
+{
+ if (!h || !value) {
+ _E("Invalid parameter");
+ return -1;
+ }
+
+ if (h->value) {
+ free(h->value);
+ h->value = NULL;
+ }
+
+ h->value = strdup(value);
+ if (!h->value) {
+ _E("Failed to duplicate data");
+ return -1;
+ }
+
+ return 0;
+}
+
+int rpc_port_autofill_save_item_set_autofill_hint(rpc_port_autofill_save_item_h h, int autofill_hint)
+{
+ if (!h) {
+ _E("Invalid parameter");
+ return -1;
+ }
+
+ h->autofill_hint = autofill_hint;
+ return 0;
+}
+
+int rpc_port_autofill_save_item_set_is_sensitive_data(rpc_port_autofill_save_item_h h, bool is_sensitive_data)
+{
+ if (!h) {
+ _E("Invalid parameter");
+ return -1;
+ }
+
+ h->is_sensitive_data = is_sensitive_data;
+ return 0;
+}
+
+int rpc_port_autofill_save_item_get_id(rpc_port_autofill_save_item_h h, char **id)
+{
+ if (!h || !id) {
+ _E("Invalid parameter");
+ return -1;
+ }
+
+ if (!h->id) {
+ _E("Invalid parameter: h->id is NULL");
+ return -1;
+ }
+
+ *id = strdup(h->id);
+ if (*id == NULL) {
+ _E("Failed to duplicate id");
+ return -1;
+ }
+
+ return 0;
+}
+
+int rpc_port_autofill_save_item_get_label(rpc_port_autofill_save_item_h h, char **label)
+{
+ if (!h || !label) {
+ _E("Invalid parameter");
+ return -1;
+ }
+
+ if (!h->label) {
+ _E("Invalid parameter: h->label is NULL");
+ return -1;
+ }
+
+ *label = strdup(h->label);
+ if (*label == NULL) {
+ _E("Failed to duplicate label");
+ return -1;
+ }
+
+ return 0;
+}
+
+int rpc_port_autofill_save_item_get_value(rpc_port_autofill_save_item_h h, char **value)
+{
+ if (!h || !value) {
+ _E("Invalid parameter");
+ return -1;
+ }
+
+ if (!h->value) {
+ _E("Invalid parameter: h->value is NULL");
+ return -1;
+ }
+
+ *value = strdup(h->value);
+ if (*value == NULL) {
+ _E("Failed to duplicate value");
+ return -1;
+ }
+
+ return 0;
+}
+
+int rpc_port_autofill_save_item_get_autofill_hint(rpc_port_autofill_save_item_h h, int *autofill_hint)
+{
+ if (!h || !autofill_hint) {
+ _E("Invalid parameter");
+ return -1;
+ }
+
+ *autofill_hint = h->autofill_hint;
+ return 0;
+}
+
+int rpc_port_autofill_save_item_get_is_sensitive_data(rpc_port_autofill_save_item_h h, bool *is_sensitive_data)
+{
+ if (!h || !is_sensitive_data) {
+ _E("Invalid parameter");
+ return -1;
+ }
+
+ *is_sensitive_data = h->is_sensitive_data;
+ return 0;
+}
+
+struct autofill_save_view_info_s {
+ rpc_port_parcelable_t parcelable;
+ char *view_id;
+ GList *items;
+};
+
+static void __autofill_save_view_info_to(rpc_port_parcel_h parcel, void *data)
+{
+ rpc_port_autofill_save_view_info_h h = data;
+
+ if (!parcel || !h) {
+ _E("Invalid parameter");
+ return;
+ }
+
+ rpc_port_parcel_write_string(parcel, h->view_id ? h->view_id : "");
+ rpc_port_parcel_write_array_count(parcel, g_list_length(h->items));
+ do {
+ GList *iter;
+
+ iter = h->items;
+ while (iter) {
+ rpc_port_autofill_save_item_h value = iter->data;
+
+ iter = g_list_next(iter);
+ if (!value) {
+ _W("Warning: value is NULL");
+ continue;
+ }
+ rpc_port_parcel_write(parcel, &value->parcelable, value);
+ }
+ } while (0);
+}
+
+static void __autofill_save_view_info_from(rpc_port_parcel_h parcel, void *data)
+{
+ rpc_port_autofill_save_view_info_h h = data;
+
+ if (!parcel || !h) {
+ _E("Invalid parameter");
+ return;
+ }
+
+ rpc_port_parcel_read_string(parcel, &h->view_id);
+ do {
+ int len = 0;
+
+ rpc_port_parcel_read_array_count(parcel, &len);
+ for (int i = 0; i < len; i++) {
+ rpc_port_autofill_save_item_h value = NULL;
+
+ rpc_port_autofill_save_item_create(&value);
+ if (!value) {
+ _E("Failed to create handle");
+ return;
+ }
+
+ rpc_port_parcel_read(parcel, &value->parcelable, value);
+ h->items = g_list_append(h->items, value);
+ }
+ } while (0);
+}
+
+int rpc_port_autofill_save_view_info_create(rpc_port_autofill_save_view_info_h *h)
+{
+ struct autofill_save_view_info_s *handle;
+
+ if (!h) {
+ _E("Invalid parameter");
+ return -1;
+ }
+
+ handle = calloc(1, sizeof(struct autofill_save_view_info_s));
+ if (!handle) {
+ _E("Out of memory");
+ return -1;
+ }
+
+ handle->parcelable.to = __autofill_save_view_info_to;
+ handle->parcelable.from = __autofill_save_view_info_from;
+
+ *h = handle;
+
+ return 0;
+}
+
+int rpc_port_autofill_save_view_info_destroy(rpc_port_autofill_save_view_info_h h)
+{
+ if (!h) {
+ _E("Invalid parameter");
+ return -1;
+ }
+
+ if (h->view_id)
+ free(h->view_id);
+
+ do {
+ GList *iter;
+
+ iter = h->items;
+ while (iter) {
+ rpc_port_autofill_save_item_h value = iter->data;
+ if (value)
+ rpc_port_autofill_save_item_destroy(value);
+
+ iter = g_list_next(iter);
+ }
+ g_list_free(h->items);
+ } while (0);
+
+ free(h);
+
+ return 0;
+}
+
+int rpc_port_autofill_save_view_info_clone(rpc_port_autofill_save_view_info_h h, rpc_port_autofill_save_view_info_h *clone)
+{
+ rpc_port_autofill_save_view_info_h handle = NULL;
+
+ if (!h || !clone) {
+ _E("Invalid parameter");
+ return -1;
+ }
+
+ rpc_port_autofill_save_view_info_create(&handle);
+ if (!handle) {
+ _E("Failed to create autofill_save_view_info handle");
+ return -1;
+ }
+
+ if (h->view_id) {
+ handle->view_id = strdup(h->view_id);
+ if (!handle->view_id) {
+ _E("Failed to duplicate h->view_id");
+ rpc_port_autofill_save_view_info_destroy(handle);
+ return -1;
+ }
+ }
+
+ do {
+ GList *iter;
+
+ iter = h->items;
+ while (iter) {
+ rpc_port_autofill_save_item_h new_value;
+ rpc_port_autofill_save_item_h value = iter->data;
+
+ if (!value) {
+ _E("Error: value is NULL");
+ rpc_port_autofill_save_view_info_destroy(handle);
+ return -1;
+ }
+
+ rpc_port_autofill_save_item_clone(value, &new_value);
+ if (!new_value) {
+ _E("Failed to duplicate value");
+ rpc_port_autofill_save_view_info_destroy(handle);
+ return -1;
+ }
+
+ handle->items = g_list_append(handle->items, new_value);
+ iter = g_list_next(iter);
+ }
+ } while (0);
+
+ *clone = handle;
+
+ return 0;
+}
+
+int rpc_port_autofill_save_view_info_set_view_id(rpc_port_autofill_save_view_info_h h, const char *view_id)
+{
+ if (!h || !view_id) {
+ _E("Invalid parameter");
+ return -1;
+ }
+
+ if (h->view_id) {
+ free(h->view_id);
+ h->view_id = NULL;
+ }
+
+ h->view_id = strdup(view_id);
+ if (!h->view_id) {
+ _E("Failed to duplicate data");
+ return -1;
+ }
+
+ return 0;
+}
+
+int rpc_port_autofill_save_view_info_add_items(rpc_port_autofill_save_view_info_h h, rpc_port_autofill_save_item_h items)
+{
+ if (!h || !items) {
+ _E("Invalid parameter");
+ return -1;
+ }
+
+ do {
+ rpc_port_autofill_save_item_h value = NULL;
+
+ rpc_port_autofill_save_item_clone(items, &value);
+ if (!value) {
+ _E("Out of memory");
+ return -1;
+ }
+
+ h->items = g_list_append(h->items, value);
+ } while (0);
+
+ return 0;
+}
+
+int rpc_port_autofill_save_view_info_get_view_id(rpc_port_autofill_save_view_info_h h, char **view_id)
+{
+ if (!h || !view_id) {
+ _E("Invalid parameter");
+ return -1;
+ }
+
+ if (!h->view_id) {
+ _E("Invalid parameter: h->view_id is NULL");
+ return -1;
+ }
+
+ *view_id = strdup(h->view_id);
+ if (*view_id == NULL) {
+ _E("Failed to duplicate view_id");
+ return -1;
+ }
+
+ return 0;
+}
+
+int rpc_port_autofill_save_view_info_foreach_items(rpc_port_autofill_save_view_info_h h,
+ bool (*callback)(rpc_port_autofill_save_item_h items, void *user_data), void *user_data)
+{
+ if (!h || !callback) {
+ _E("Invalid parameter");
+ return -1;
+ }
+
+ do {
+ GList *iter;
+
+ iter = h->items;
+ while (iter) {
+ rpc_port_autofill_save_item_h value = iter->data;
+
+ iter = g_list_next(iter);
+ if (!value) {
+ _W("Warning: value is NULL");
+ continue;
+ }
+
+ bool ret = callback(value, user_data);
+ if (!ret)
+ break;
+ }
+ } while (0);
+
+ return 0;
+}
+
+int rpc_port_autofill_save_view_info_remove_items(rpc_port_autofill_save_view_info_h h, unsigned int nth)
+{
+ GList *iter;
+
+ if (!h) {
+ _E("Invalid parameter");
+ return -1;
+ }
+
+ iter = g_list_nth(h->items, nth);
+ if (iter == NULL)
+ return -1;
+
+ rpc_port_autofill_save_item_h value = iter->data;
+ h->items = g_list_remove_link(h->items, iter);
+ rpc_port_autofill_save_item_destroy(value);
+ g_list_free(iter);
+
+ return 0;
+}
+
+int rpc_port_autofill_save_view_info_get_items_length(rpc_port_autofill_save_view_info_h h, unsigned int *length)
+{
+ if (!h || !length) {
+ _E("Invalid parameter");
+ return -1;
+ }
+
+ *length = g_list_length(h->items);
+
+ return 0;
+}
+
struct autofill_auth_info_s {
rpc_port_parcelable_t parcelable;
bool exist_autofill_data;
return 0;
}
+struct list_autofill_save_item_s {
+ rpc_port_parcelable_t parcelable;
+ GList *list_autofill_save_items;
+};
+
+static void __list_autofill_save_item_to(rpc_port_parcel_h parcel, void *data)
+{
+ rpc_port_list_autofill_save_item_h h = data;
+
+ if (!parcel || !h) {
+ _E("Invalid parameter");
+ return;
+ }
+
+ rpc_port_parcel_write_array_count(parcel, g_list_length(h->list_autofill_save_items));
+ do {
+ GList *iter;
+
+ iter = h->list_autofill_save_items;
+ while (iter) {
+ rpc_port_autofill_save_item_h value = iter->data;
+
+ iter = g_list_next(iter);
+ if (!value) {
+ _W("Warning: value is NULL");
+ continue;
+ }
+ rpc_port_parcel_write(parcel, &value->parcelable, value);
+ }
+ } while (0);
+}
+
+static void __list_autofill_save_item_from(rpc_port_parcel_h parcel, void *data)
+{
+ rpc_port_list_autofill_save_item_h h = data;
+
+ if (!parcel || !h) {
+ _E("Invalid parameter");
+ return;
+ }
+
+ do {
+ int len = 0;
+
+ rpc_port_parcel_read_array_count(parcel, &len);
+ for (int i = 0; i < len; i++) {
+ rpc_port_autofill_save_item_h value = NULL;
+
+ rpc_port_autofill_save_item_create(&value);
+ if (!value) {
+ _E("Failed to create handle");
+ return;
+ }
+
+ rpc_port_parcel_read(parcel, &value->parcelable, value);
+ h->list_autofill_save_items = g_list_append(h->list_autofill_save_items, value);
+ }
+ } while (0);
+}
+
+int rpc_port_list_autofill_save_item_create(rpc_port_list_autofill_save_item_h *h)
+{
+ struct list_autofill_save_item_s *handle;
+
+ if (!h) {
+ _E("Invalid parameter");
+ return -1;
+ }
+
+ handle = calloc(1, sizeof(struct list_autofill_save_item_s));
+ if (!handle) {
+ _E("Out of memory");
+ return -1;
+ }
+
+ handle->parcelable.to = __list_autofill_save_item_to;
+ handle->parcelable.from = __list_autofill_save_item_from;
+
+ *h = handle;
+
+ return 0;
+}
+
+int rpc_port_list_autofill_save_item_destroy(rpc_port_list_autofill_save_item_h h)
+{
+ if (!h) {
+ _E("Invalid parameter");
+ return -1;
+ }
+
+ do {
+ GList *iter;
+
+ iter = h->list_autofill_save_items;
+ while (iter) {
+ rpc_port_autofill_save_item_h value = iter->data;
+ if (value)
+ rpc_port_autofill_save_item_destroy(value);
+
+ iter = g_list_next(iter);
+ }
+ g_list_free(h->list_autofill_save_items);
+ } while (0);
+
+ free(h);
+
+ return 0;
+}
+
+int rpc_port_list_autofill_save_item_clone(rpc_port_list_autofill_save_item_h h, rpc_port_list_autofill_save_item_h *clone)
+{
+ rpc_port_list_autofill_save_item_h handle = NULL;
+
+ if (!h || !clone) {
+ _E("Invalid parameter");
+ return -1;
+ }
+
+ rpc_port_list_autofill_save_item_create(&handle);
+ if (!handle) {
+ _E("Failed to create list_autofill_save_item handle");
+ return -1;
+ }
+
+ do {
+ GList *iter;
+
+ iter = h->list_autofill_save_items;
+ while (iter) {
+ rpc_port_autofill_save_item_h new_value;
+ rpc_port_autofill_save_item_h value = iter->data;
+
+ if (!value) {
+ _E("Error: value is NULL");
+ rpc_port_list_autofill_save_item_destroy(handle);
+ return -1;
+ }
+
+ rpc_port_autofill_save_item_clone(value, &new_value);
+ if (!new_value) {
+ _E("Failed to duplicate value");
+ rpc_port_list_autofill_save_item_destroy(handle);
+ return -1;
+ }
+
+ handle->list_autofill_save_items = g_list_append(handle->list_autofill_save_items, new_value);
+ iter = g_list_next(iter);
+ }
+ } while (0);
+
+ *clone = handle;
+
+ return 0;
+}
+
+int rpc_port_list_autofill_save_item_add_list_autofill_save_items(rpc_port_list_autofill_save_item_h h, rpc_port_autofill_save_item_h list_autofill_save_items)
+{
+ if (!h || !list_autofill_save_items) {
+ _E("Invalid parameter");
+ return -1;
+ }
+
+ do {
+ rpc_port_autofill_save_item_h value = NULL;
+
+ rpc_port_autofill_save_item_clone(list_autofill_save_items, &value);
+ if (!value) {
+ _E("Out of memory");
+ return -1;
+ }
+
+ h->list_autofill_save_items = g_list_append(h->list_autofill_save_items, value);
+ } while (0);
+
+ return 0;
+}
+
+int rpc_port_list_autofill_save_item_foreach_list_autofill_save_items(rpc_port_list_autofill_save_item_h h,
+ bool (*callback)(rpc_port_autofill_save_item_h list_autofill_save_items, void *user_data), void *user_data)
+{
+ if (!h || !callback) {
+ _E("Invalid parameter");
+ return -1;
+ }
+
+ do {
+ GList *iter;
+
+ iter = h->list_autofill_save_items;
+ while (iter) {
+ rpc_port_autofill_save_item_h value = iter->data;
+
+ iter = g_list_next(iter);
+ if (!value) {
+ _W("Warning: value is NULL");
+ continue;
+ }
+
+ bool ret = callback(value, user_data);
+ if (!ret)
+ break;
+ }
+ } while (0);
+
+ return 0;
+}
+
+int rpc_port_list_autofill_save_item_remove_list_autofill_save_items(rpc_port_list_autofill_save_item_h h, unsigned int nth)
+{
+ GList *iter;
+
+ if (!h) {
+ _E("Invalid parameter");
+ return -1;
+ }
+
+ iter = g_list_nth(h->list_autofill_save_items, nth);
+ if (iter == NULL)
+ return -1;
+
+ rpc_port_autofill_save_item_h value = iter->data;
+ h->list_autofill_save_items = g_list_remove_link(h->list_autofill_save_items, iter);
+ rpc_port_autofill_save_item_destroy(value);
+ g_list_free(iter);
+
+ return 0;
+}
+
+int rpc_port_list_autofill_save_item_get_list_autofill_save_items_length(rpc_port_list_autofill_save_item_h h, unsigned int *length)
+{
+ if (!h || !length) {
+ _E("Invalid parameter");
+ return -1;
+ }
+
+ *length = g_list_length(h->list_autofill_save_items);
+
+ return 0;
+}
+
enum AutofillAppPort_method_e {
AutofillAppPort_METHOD_Result,
AutofillAppPort_METHOD_Callback,
AutofillAppPort_METHOD_Unregister,
AutofillAppPort_METHOD_request_auth_info,
AutofillAppPort_METHOD_send_fill_request,
+ AutofillAppPort_METHOD_commit,
};
enum AutofillAppPort_delegate_e {
return 0;
}
+static int __AutofillAppPort_method_commit(rpc_port_h port, rpc_port_parcel_h parcel, void *data)
+{
+ rpc_port_stub_AutofillAppPort_context_h context = data;
+ rpc_port_h callback_port;
+ int r;
+
+ r = rpc_port_stub_get_port(__AutofillAppPort_stub, RPC_PORT_PORT_CALLBACK, context->instance, &callback_port);
+ if (r != 0) {
+ _E("Failed to get callback port");
+ return -1;
+ }
+
+ rpc_port_autofill_save_view_info_h vi = NULL;
+
+ rpc_port_autofill_save_view_info_create(&vi);
+ rpc_port_parcel_read(parcel, &vi->parcelable, vi);
+
+ context->callback.commit(context, vi, context->user_data);
+
+ rpc_port_autofill_save_view_info_destroy(vi);
+ return 0;
+}
+
static stub_method __AutofillAppPort_method_table[] = {
[AutofillAppPort_METHOD_Register] = __AutofillAppPort_method_Register,
[AutofillAppPort_METHOD_Unregister] = __AutofillAppPort_method_Unregister,
[AutofillAppPort_METHOD_request_auth_info] = __AutofillAppPort_method_request_auth_info,
[AutofillAppPort_METHOD_send_fill_request] = __AutofillAppPort_method_send_fill_request,
+ [AutofillAppPort_METHOD_commit] = __AutofillAppPort_method_commit,
};
static void __AutofillAppPort_on_connected(const char *sender, const char *instance, void *data)
int rpc_port_autofill_view_info_get_items_length(rpc_port_autofill_view_info_h h, unsigned int *length);
+typedef struct autofill_save_item_s *rpc_port_autofill_save_item_h;
+
+int rpc_port_autofill_save_item_create(rpc_port_autofill_save_item_h *h);
+
+int rpc_port_autofill_save_item_destroy(rpc_port_autofill_save_item_h h);
+
+int rpc_port_autofill_save_item_clone(rpc_port_autofill_save_item_h h, rpc_port_autofill_save_item_h *clone);
+
+int rpc_port_autofill_save_item_set_id(rpc_port_autofill_save_item_h h, const char *id);
+
+int rpc_port_autofill_save_item_set_label(rpc_port_autofill_save_item_h h, const char *label);
+
+int rpc_port_autofill_save_item_set_value(rpc_port_autofill_save_item_h h, const char *value);
+
+int rpc_port_autofill_save_item_set_autofill_hint(rpc_port_autofill_save_item_h h, int autofill_hint);
+
+int rpc_port_autofill_save_item_set_is_sensitive_data(rpc_port_autofill_save_item_h h, bool is_sensitive_data);
+
+int rpc_port_autofill_save_item_get_id(rpc_port_autofill_save_item_h h, char **id);
+
+int rpc_port_autofill_save_item_get_label(rpc_port_autofill_save_item_h h, char **label);
+
+int rpc_port_autofill_save_item_get_value(rpc_port_autofill_save_item_h h, char **value);
+
+int rpc_port_autofill_save_item_get_autofill_hint(rpc_port_autofill_save_item_h h, int *autofill_hint);
+
+int rpc_port_autofill_save_item_get_is_sensitive_data(rpc_port_autofill_save_item_h h, bool *is_sensitive_data);
+
+typedef struct autofill_save_view_info_s *rpc_port_autofill_save_view_info_h;
+
+int rpc_port_autofill_save_view_info_create(rpc_port_autofill_save_view_info_h *h);
+
+int rpc_port_autofill_save_view_info_destroy(rpc_port_autofill_save_view_info_h h);
+
+int rpc_port_autofill_save_view_info_clone(rpc_port_autofill_save_view_info_h h, rpc_port_autofill_save_view_info_h *clone);
+
+int rpc_port_autofill_save_view_info_set_view_id(rpc_port_autofill_save_view_info_h h, const char *view_id);
+
+int rpc_port_autofill_save_view_info_add_items(rpc_port_autofill_save_view_info_h h, rpc_port_autofill_save_item_h items);
+
+int rpc_port_autofill_save_view_info_get_view_id(rpc_port_autofill_save_view_info_h h, char **view_id);
+
+int rpc_port_autofill_save_view_info_foreach_items(rpc_port_autofill_save_view_info_h h,
+ bool (*callback)(rpc_port_autofill_save_item_h items, void *user_data), void *user_data);
+
+int rpc_port_autofill_save_view_info_remove_items(rpc_port_autofill_save_view_info_h h, unsigned int nth);
+
+int rpc_port_autofill_save_view_info_get_items_length(rpc_port_autofill_save_view_info_h h, unsigned int *length);
+
typedef struct autofill_auth_info_s *rpc_port_autofill_auth_info_h;
int rpc_port_autofill_auth_info_create(rpc_port_autofill_auth_info_h *h);
int rpc_port_list_autofill_response_item_get_list_autofill_response_items_length(rpc_port_list_autofill_response_item_h h, unsigned int *length);
+typedef struct list_autofill_save_item_s *rpc_port_list_autofill_save_item_h;
+
+int rpc_port_list_autofill_save_item_create(rpc_port_list_autofill_save_item_h *h);
+
+int rpc_port_list_autofill_save_item_destroy(rpc_port_list_autofill_save_item_h h);
+
+int rpc_port_list_autofill_save_item_clone(rpc_port_list_autofill_save_item_h h, rpc_port_list_autofill_save_item_h *clone);
+
+int rpc_port_list_autofill_save_item_add_list_autofill_save_items(rpc_port_list_autofill_save_item_h h, rpc_port_autofill_save_item_h list_autofill_save_items);
+
+int rpc_port_list_autofill_save_item_foreach_list_autofill_save_items(rpc_port_list_autofill_save_item_h h,
+ bool (*callback)(rpc_port_autofill_save_item_h list_autofill_save_items, void *user_data), void *user_data);
+
+int rpc_port_list_autofill_save_item_remove_list_autofill_save_items(rpc_port_list_autofill_save_item_h h, unsigned int nth);
+
+int rpc_port_list_autofill_save_item_get_list_autofill_save_items_length(rpc_port_list_autofill_save_item_h h, unsigned int *length);
+
typedef struct AutofillAppPort_context_s* rpc_port_stub_AutofillAppPort_context_h;
int rpc_port_stub_AutofillAppPort_context_set_tag(rpc_port_stub_AutofillAppPort_context_h ctx, void *tag);
void (*Unregister)(rpc_port_stub_AutofillAppPort_context_h context, void *user_data);
void (*request_auth_info)(rpc_port_stub_AutofillAppPort_context_h context, rpc_port_autofill_view_info_h vi, void *user_data);
void (*send_fill_request)(rpc_port_stub_AutofillAppPort_context_h context, rpc_port_autofill_view_info_h vi, void *user_data);
+ void (*commit)(rpc_port_stub_AutofillAppPort_context_h context, rpc_port_autofill_save_view_info_h vi, void *user_data);
} rpc_port_stub_AutofillAppPort_callback_s;
int rpc_port_stub_AutofillAppPort_register(rpc_port_stub_AutofillAppPort_callback_s *callback, void *user_data);
return true;
}
+bool __save_item_cb(rpc_port_autofill_save_item_h items, void *user_data)
+{
+ char *id = NULL;
+ char *label = NULL;
+ char *value = NULL;
+ int autofill_hint;
+ bool sensitive_data;
+
+ rpc_port_autofill_svc_save_view_info_h svi = (rpc_port_autofill_svc_save_view_info_h)user_data;
+
+ rpc_port_autofill_svc_save_item_h svc_save_item;
+
+ rpc_port_autofill_svc_save_item_create(&svc_save_item);
+
+ rpc_port_autofill_save_item_get_id(items, &id);
+ rpc_port_autofill_svc_save_item_set_id(svc_save_item, id);
+ if (id) {
+ LOGD("id : %s", id);
+ free(id);
+ }
+
+ rpc_port_autofill_save_item_get_label(items, &label);
+ rpc_port_autofill_svc_save_item_set_label(svc_save_item, label);
+ if (label) {
+ LOGD("label : %s", label);
+ free(label);
+ }
+
+ rpc_port_autofill_save_item_get_value(items, &value);
+ rpc_port_autofill_svc_save_item_set_value(svc_save_item, value);
+ if (value) {
+ LOGD("value : %s", value);
+ free(value);
+ }
+
+ rpc_port_autofill_save_item_get_autofill_hint(items, &autofill_hint);
+ rpc_port_autofill_svc_save_item_set_autofill_hint(svc_save_item, autofill_hint);
+ LOGD("autofill hint : %d", autofill_hint);
+
+ rpc_port_autofill_save_item_get_is_sensitive_data(items, &sensitive_data);
+ rpc_port_autofill_svc_save_item_set_is_sensitive_data(svc_save_item, sensitive_data);
+ LOGD("sensitive data : %d", sensitive_data);
+
+ rpc_port_autofill_svc_save_view_info_add_items(svi, svc_save_item);
+
+ rpc_port_autofill_svc_save_item_destroy(svc_save_item);
+
+ return true;
+}
+
static void __auth_info_request_cb(rpc_port_stub_AutofillAppPort_context_h context, rpc_port_autofill_view_info_h vi, void *user_data)
{
char *sender = NULL;
rpc_port_autofill_svc_view_info_destroy(svi);
}
+static void __commit_cb(rpc_port_stub_AutofillAppPort_context_h context, rpc_port_autofill_save_view_info_h vi, void *user_data)
+{
+ char *sender = NULL;
+ autofill_client_s *sender_client;
+
+ rpc_port_stub_AutofillAppPort_context_get_sender(context, &sender);
+ if (sender) {
+ LOGD("sender(%s)", sender);
+ free(sender);
+ }
+
+ char *view_id = NULL;
+ rpc_port_autofill_save_view_info_get_view_id(vi, &view_id);
+ if (view_id) {
+ LOGD("view id : %s", view_id);
+ }
+
+ rpc_port_autofill_svc_save_view_info_h svi;
+ rpc_port_autofill_svc_save_view_info_create(&svi);
+ rpc_port_autofill_svc_save_view_info_set_view_id(svi, view_id);
+
+ rpc_port_stub_AutofillAppPort_context_get_tag(context, (void *)&sender_client);
+ rpc_port_autofill_save_view_info_foreach_items(vi, __save_item_cb, svi);
+
+ rpc_port_proxy_AutofillSvcPort_invoke_commit(rpc_h, svi);
+
+ if (view_id)
+ free(view_id);
+
+ rpc_port_autofill_svc_save_view_info_destroy(svi);
+}
+
bool fill_response_item_cb(rpc_port_autofill_svc_response_item_h response_items, void *user_data)
{
//autofill_fill_response_s *fill_response = (autofill_fill_response_s *)user_data;
__message_register,
__message_unregister,
__auth_info_request_cb,
- __autofill_fill_request_cb
+ __autofill_fill_request_cb,
+ __commit_cb,
};
ret = rpc_port_stub_AutofillAppPort_register(&callback, NULL);
return true;
}
+static bool __save_item_cb(autofill_save_item_h items, void *user_data)
+{
+ char *id = NULL;
+ char *label = NULL;
+ char *value = NULL;
+ autofill_hint_e autofill_hint;
+ bool sensitive_data;
+
+ autofill_save_item_get_id(items, &id);
+ if (id) {
+ LOGD("id : %s", id);
+ free(id);
+ }
+
+ autofill_save_item_get_label(items, &label);
+ if (label) {
+ LOGD("label : %s", label);
+ free(label);
+ }
+
+ autofill_save_item_get_value(items, &value);
+ if (value) {
+ LOGD("value : %s", value);
+ free(value);
+ }
+
+ autofill_save_item_get_autofill_hint(items, &autofill_hint);
+ LOGD("autofill hint : %d", autofill_hint);
+
+ autofill_save_item_get_sensitive_data(items, &sensitive_data);
+ LOGD("sensitive data : %d", sensitive_data);
+
+ return true;
+}
+
static void _auth_info_request_cb(autofill_view_info_h vi, void *user_data)
{
LOGD("");
if (view_id)
free(view_id);
+ LOGD("send auth info");
autofill_auth_info_h auth_info;
autofill_auth_info_create(&auth_info);
autofill_auth_info_set_app_id(auth_info, app_id);
autofill_fill_response_destroy(fill_response);
}
+static void _commit_cb(autofill_save_view_info_h vi, void *user_data)
+{
+ char *view_id;
+ autofill_save_view_info_get_view_id(vi, &view_id);
+ LOGD("view id : %s", view_id);
+
+ autofill_save_view_info_foreach_items(vi, __save_item_cb, NULL);
+
+ if (view_id)
+ free(view_id);
+}
+
bool service_app_create(void *data)
{
// Todo: add your code here.
autofill_service_set_auth_info_request_cb(_auth_info_request_cb, NULL);
autofill_service_set_fill_request_cb(_fill_request_cb, NULL);
+ autofill_service_set_commit_cb(_commit_cb, NULL);
return true;
}
static autofill_service_auth_info_request_cb g_autofill_service_auth_info_request_cb;
static void *g_autofill_service_auth_info_request_data = NULL;
+static autofill_service_commit_cb g_autofill_service_commit_cb;
+static void *g_autofill_service_commit_data = NULL;
+
rpc_port_AutofillSvcPort_autofill_svc_auth_info_cb_h g_auth_info_cb;
rpc_port_AutofillSvcPort_autofill_svc_fill_response_cb_h g_fill_response_cb;
return true;
}
+bool __save_item_cb(rpc_port_autofill_svc_save_item_h items, void *user_data)
+{
+ char *id = NULL;
+ char *label = NULL;
+ char *value = NULL;
+ int autofill_hint;
+ bool sensitive_data;
+
+ autofill_save_view_info_h vi = (autofill_save_view_info_h)user_data;
+
+ autofill_save_item_h ai;
+ autofill_save_item_create(&ai);
+
+ rpc_port_autofill_svc_save_item_get_id(items, &id);
+ autofill_save_item_set_id(ai, id);
+ if (id) {
+ LOGD("id : %s", id);
+ free(id);
+ }
+
+ rpc_port_autofill_svc_save_item_get_label(items, &label);
+ autofill_save_item_set_label(ai, label);
+ if (label) {
+ LOGD("label : %s", label);
+ free(label);
+ }
+
+ rpc_port_autofill_svc_save_item_get_value(items, &value);
+ autofill_save_item_set_value(ai, value);
+ if (value) {
+ LOGD("value : %s", value);
+ free(value);
+ }
+
+ rpc_port_autofill_svc_save_item_get_autofill_hint(items, &autofill_hint);
+ autofill_save_item_set_autofill_hint(ai, autofill_hint);
+ LOGD("autofill hint : %d", autofill_hint);
+
+ rpc_port_autofill_svc_save_item_get_is_sensitive_data(items, &sensitive_data);
+ autofill_save_item_set_sensitive_data(ai, sensitive_data);
+ LOGD("sensitive data : %d", sensitive_data);
+
+ autofill_save_view_info_add_item(vi, ai);
+
+ return true;
+}
+
static void __auth_info_request_cb(rpc_port_stub_AutofillSvcPort_context_h context, rpc_port_autofill_svc_view_info_h vi, void *user_data)
{
char *sender = NULL;
free(view_id);
}
+static void __autofill_commit_cb(rpc_port_stub_AutofillSvcPort_context_h context, rpc_port_autofill_svc_save_view_info_h vi, void *user_data)
+{
+ char *view_id = NULL;
+ rpc_port_autofill_svc_save_view_info_get_view_id(vi, &view_id);
+ if (view_id) {
+ LOGD("view id : %s", view_id);
+ }
+
+ autofill_save_view_info_h view_info;
+ autofill_save_view_info_create(&view_info);
+ autofill_save_view_info_set_view_id(view_info, view_id);
+
+ rpc_port_autofill_svc_save_view_info_foreach_items(vi, __save_item_cb, view_info);
+
+ if (g_autofill_service_commit_cb)
+ g_autofill_service_commit_cb(view_info, g_autofill_service_commit_data);
+
+ autofill_save_view_info_destroy(view_info);
+
+ if (view_id) {
+ LOGD("view id : %s", view_id);
+ free(view_id);
+ }
+}
+
static autofill_svc_s *__create_client(const char *app_id,
rpc_port_AutofillSvcPort_autofill_svc_auth_info_cb_h auth_info_cb,
rpc_port_AutofillSvcPort_autofill_svc_fill_response_cb_h fill_response_cb)
__message_unregister,
__auth_info_request_cb,
__autofill_fill_request_cb,
+ __autofill_commit_cb,
};
ret = rpc_port_stub_AutofillSvcPort_register(&callback, NULL);
return AUTOFILL_ERROR_NONE;
}
+
+EXPORT_API int autofill_service_set_commit_cb(autofill_service_commit_cb callback, void *user_data)
+{
+ g_autofill_service_commit_cb = callback;
+ g_autofill_service_commit_data = user_data;
+
+ return AUTOFILL_ERROR_NONE;
+}
return 0;
}
+struct autofill_svc_save_item_s {
+ rpc_port_parcelable_t parcelable;
+ char *id;
+ char *label;
+ char *value;
+ int autofill_hint;
+ bool is_sensitive_data;
+};
+
+static void __autofill_svc_save_item_to(rpc_port_parcel_h parcel, void *data)
+{
+ rpc_port_autofill_svc_save_item_h h = data;
+
+ if (!parcel || !h) {
+ _E("Invalid parameter");
+ return;
+ }
+
+ rpc_port_parcel_write_string(parcel, h->id ? h->id : "");
+ rpc_port_parcel_write_string(parcel, h->label ? h->label : "");
+ rpc_port_parcel_write_string(parcel, h->value ? h->value : "");
+ rpc_port_parcel_write_int32(parcel, h->autofill_hint);
+ rpc_port_parcel_write_bool(parcel, h->is_sensitive_data);
+}
+
+static void __autofill_svc_save_item_from(rpc_port_parcel_h parcel, void *data)
+{
+ rpc_port_autofill_svc_save_item_h h = data;
+
+ if (!parcel || !h) {
+ _E("Invalid parameter");
+ return;
+ }
+
+ rpc_port_parcel_read_string(parcel, &h->id);
+ rpc_port_parcel_read_string(parcel, &h->label);
+ rpc_port_parcel_read_string(parcel, &h->value);
+ rpc_port_parcel_read_int32(parcel, &h->autofill_hint);
+ rpc_port_parcel_read_bool(parcel, &h->is_sensitive_data);
+}
+
+int rpc_port_autofill_svc_save_item_create(rpc_port_autofill_svc_save_item_h *h)
+{
+ struct autofill_svc_save_item_s *handle;
+
+ if (!h) {
+ _E("Invalid parameter");
+ return -1;
+ }
+
+ handle = calloc(1, sizeof(struct autofill_svc_save_item_s));
+ if (!handle) {
+ _E("Out of memory");
+ return -1;
+ }
+
+ handle->parcelable.to = __autofill_svc_save_item_to;
+ handle->parcelable.from = __autofill_svc_save_item_from;
+
+ *h = handle;
+
+ return 0;
+}
+
+int rpc_port_autofill_svc_save_item_destroy(rpc_port_autofill_svc_save_item_h h)
+{
+ if (!h) {
+ _E("Invalid parameter");
+ return -1;
+ }
+
+ if (h->id)
+ free(h->id);
+
+ if (h->label)
+ free(h->label);
+
+ if (h->value)
+ free(h->value);
+
+ free(h);
+
+ return 0;
+}
+
+int rpc_port_autofill_svc_save_item_clone(rpc_port_autofill_svc_save_item_h h, rpc_port_autofill_svc_save_item_h *clone)
+{
+ rpc_port_autofill_svc_save_item_h handle = NULL;
+
+ if (!h || !clone) {
+ _E("Invalid parameter");
+ return -1;
+ }
+
+ rpc_port_autofill_svc_save_item_create(&handle);
+ if (!handle) {
+ _E("Failed to create autofill_svc_save_item handle");
+ return -1;
+ }
+
+ if (h->id) {
+ handle->id = strdup(h->id);
+ if (!handle->id) {
+ _E("Failed to duplicate h->id");
+ rpc_port_autofill_svc_save_item_destroy(handle);
+ return -1;
+ }
+ }
+
+ if (h->label) {
+ handle->label = strdup(h->label);
+ if (!handle->label) {
+ _E("Failed to duplicate h->label");
+ rpc_port_autofill_svc_save_item_destroy(handle);
+ return -1;
+ }
+ }
+
+ if (h->value) {
+ handle->value = strdup(h->value);
+ if (!handle->value) {
+ _E("Failed to duplicate h->value");
+ rpc_port_autofill_svc_save_item_destroy(handle);
+ return -1;
+ }
+ }
+
+ handle->autofill_hint = h->autofill_hint;
+ handle->is_sensitive_data = h->is_sensitive_data;
+ *clone = handle;
+
+ return 0;
+}
+
+int rpc_port_autofill_svc_save_item_set_id(rpc_port_autofill_svc_save_item_h h, const char *id)
+{
+ if (!h || !id) {
+ _E("Invalid parameter");
+ return -1;
+ }
+
+ if (h->id) {
+ free(h->id);
+ h->id = NULL;
+ }
+
+ h->id = strdup(id);
+ if (!h->id) {
+ _E("Failed to duplicate data");
+ return -1;
+ }
+
+ return 0;
+}
+
+int rpc_port_autofill_svc_save_item_set_label(rpc_port_autofill_svc_save_item_h h, const char *label)
+{
+ if (!h || !label) {
+ _E("Invalid parameter");
+ return -1;
+ }
+
+ if (h->label) {
+ free(h->label);
+ h->label = NULL;
+ }
+
+ h->label = strdup(label);
+ if (!h->label) {
+ _E("Failed to duplicate data");
+ return -1;
+ }
+
+ return 0;
+}
+
+int rpc_port_autofill_svc_save_item_set_value(rpc_port_autofill_svc_save_item_h h, const char *value)
+{
+ if (!h || !value) {
+ _E("Invalid parameter");
+ return -1;
+ }
+
+ if (h->value) {
+ free(h->value);
+ h->value = NULL;
+ }
+
+ h->value = strdup(value);
+ if (!h->value) {
+ _E("Failed to duplicate data");
+ return -1;
+ }
+
+ return 0;
+}
+
+int rpc_port_autofill_svc_save_item_set_autofill_hint(rpc_port_autofill_svc_save_item_h h, int autofill_hint)
+{
+ if (!h) {
+ _E("Invalid parameter");
+ return -1;
+ }
+
+ h->autofill_hint = autofill_hint;
+ return 0;
+}
+
+int rpc_port_autofill_svc_save_item_set_is_sensitive_data(rpc_port_autofill_svc_save_item_h h, bool is_sensitive_data)
+{
+ if (!h) {
+ _E("Invalid parameter");
+ return -1;
+ }
+
+ h->is_sensitive_data = is_sensitive_data;
+ return 0;
+}
+
+int rpc_port_autofill_svc_save_item_get_id(rpc_port_autofill_svc_save_item_h h, char **id)
+{
+ if (!h || !id) {
+ _E("Invalid parameter");
+ return -1;
+ }
+
+ if (!h->id) {
+ _E("Invalid parameter: h->id is NULL");
+ return -1;
+ }
+
+ *id = strdup(h->id);
+ if (*id == NULL) {
+ _E("Failed to duplicate id");
+ return -1;
+ }
+
+ return 0;
+}
+
+int rpc_port_autofill_svc_save_item_get_label(rpc_port_autofill_svc_save_item_h h, char **label)
+{
+ if (!h || !label) {
+ _E("Invalid parameter");
+ return -1;
+ }
+
+ if (!h->label) {
+ _E("Invalid parameter: h->label is NULL");
+ return -1;
+ }
+
+ *label = strdup(h->label);
+ if (*label == NULL) {
+ _E("Failed to duplicate label");
+ return -1;
+ }
+
+ return 0;
+}
+
+int rpc_port_autofill_svc_save_item_get_value(rpc_port_autofill_svc_save_item_h h, char **value)
+{
+ if (!h || !value) {
+ _E("Invalid parameter");
+ return -1;
+ }
+
+ if (!h->value) {
+ _E("Invalid parameter: h->value is NULL");
+ return -1;
+ }
+
+ *value = strdup(h->value);
+ if (*value == NULL) {
+ _E("Failed to duplicate value");
+ return -1;
+ }
+
+ return 0;
+}
+
+int rpc_port_autofill_svc_save_item_get_autofill_hint(rpc_port_autofill_svc_save_item_h h, int *autofill_hint)
+{
+ if (!h || !autofill_hint) {
+ _E("Invalid parameter");
+ return -1;
+ }
+
+ *autofill_hint = h->autofill_hint;
+ return 0;
+}
+
+int rpc_port_autofill_svc_save_item_get_is_sensitive_data(rpc_port_autofill_svc_save_item_h h, bool *is_sensitive_data)
+{
+ if (!h || !is_sensitive_data) {
+ _E("Invalid parameter");
+ return -1;
+ }
+
+ *is_sensitive_data = h->is_sensitive_data;
+ return 0;
+}
+
+struct autofill_svc_save_view_info_s {
+ rpc_port_parcelable_t parcelable;
+ char *view_id;
+ GList *items;
+};
+
+static void __autofill_svc_save_view_info_to(rpc_port_parcel_h parcel, void *data)
+{
+ rpc_port_autofill_svc_save_view_info_h h = data;
+
+ if (!parcel || !h) {
+ _E("Invalid parameter");
+ return;
+ }
+
+ rpc_port_parcel_write_string(parcel, h->view_id ? h->view_id : "");
+ rpc_port_parcel_write_array_count(parcel, g_list_length(h->items));
+ do {
+ GList *iter;
+
+ iter = h->items;
+ while (iter) {
+ rpc_port_autofill_svc_save_item_h value = iter->data;
+
+ iter = g_list_next(iter);
+ if (!value) {
+ _W("Warning: value is NULL");
+ continue;
+ }
+ rpc_port_parcel_write(parcel, &value->parcelable, value);
+ }
+ } while (0);
+}
+
+static void __autofill_svc_save_view_info_from(rpc_port_parcel_h parcel, void *data)
+{
+ rpc_port_autofill_svc_save_view_info_h h = data;
+
+ if (!parcel || !h) {
+ _E("Invalid parameter");
+ return;
+ }
+
+ rpc_port_parcel_read_string(parcel, &h->view_id);
+ do {
+ int len = 0;
+
+ rpc_port_parcel_read_array_count(parcel, &len);
+ for (int i = 0; i < len; i++) {
+ rpc_port_autofill_svc_save_item_h value = NULL;
+
+ rpc_port_autofill_svc_save_item_create(&value);
+ if (!value) {
+ _E("Failed to create handle");
+ return;
+ }
+
+ rpc_port_parcel_read(parcel, &value->parcelable, value);
+ h->items = g_list_append(h->items, value);
+ }
+ } while (0);
+}
+
+int rpc_port_autofill_svc_save_view_info_create(rpc_port_autofill_svc_save_view_info_h *h)
+{
+ struct autofill_svc_save_view_info_s *handle;
+
+ if (!h) {
+ _E("Invalid parameter");
+ return -1;
+ }
+
+ handle = calloc(1, sizeof(struct autofill_svc_save_view_info_s));
+ if (!handle) {
+ _E("Out of memory");
+ return -1;
+ }
+
+ handle->parcelable.to = __autofill_svc_save_view_info_to;
+ handle->parcelable.from = __autofill_svc_save_view_info_from;
+
+ *h = handle;
+
+ return 0;
+}
+
+int rpc_port_autofill_svc_save_view_info_destroy(rpc_port_autofill_svc_save_view_info_h h)
+{
+ if (!h) {
+ _E("Invalid parameter");
+ return -1;
+ }
+
+ if (h->view_id)
+ free(h->view_id);
+
+ do {
+ GList *iter;
+
+ iter = h->items;
+ while (iter) {
+ rpc_port_autofill_svc_save_item_h value = iter->data;
+ if (value)
+ rpc_port_autofill_svc_save_item_destroy(value);
+
+ iter = g_list_next(iter);
+ }
+ g_list_free(h->items);
+ } while (0);
+
+ free(h);
+
+ return 0;
+}
+
+int rpc_port_autofill_svc_save_view_info_clone(rpc_port_autofill_svc_save_view_info_h h, rpc_port_autofill_svc_save_view_info_h *clone)
+{
+ rpc_port_autofill_svc_save_view_info_h handle = NULL;
+
+ if (!h || !clone) {
+ _E("Invalid parameter");
+ return -1;
+ }
+
+ rpc_port_autofill_svc_save_view_info_create(&handle);
+ if (!handle) {
+ _E("Failed to create autofill_svc_save_view_info handle");
+ return -1;
+ }
+
+ if (h->view_id) {
+ handle->view_id = strdup(h->view_id);
+ if (!handle->view_id) {
+ _E("Failed to duplicate h->view_id");
+ rpc_port_autofill_svc_save_view_info_destroy(handle);
+ return -1;
+ }
+ }
+
+ do {
+ GList *iter;
+
+ iter = h->items;
+ while (iter) {
+ rpc_port_autofill_svc_save_item_h new_value;
+ rpc_port_autofill_svc_save_item_h value = iter->data;
+
+ if (!value) {
+ _E("Error: value is NULL");
+ rpc_port_autofill_svc_save_view_info_destroy(handle);
+ return -1;
+ }
+
+ rpc_port_autofill_svc_save_item_clone(value, &new_value);
+ if (!new_value) {
+ _E("Failed to duplicate value");
+ rpc_port_autofill_svc_save_view_info_destroy(handle);
+ return -1;
+ }
+
+ handle->items = g_list_append(handle->items, new_value);
+ iter = g_list_next(iter);
+ }
+ } while (0);
+
+ *clone = handle;
+
+ return 0;
+}
+
+int rpc_port_autofill_svc_save_view_info_set_view_id(rpc_port_autofill_svc_save_view_info_h h, const char *view_id)
+{
+ if (!h || !view_id) {
+ _E("Invalid parameter");
+ return -1;
+ }
+
+ if (h->view_id) {
+ free(h->view_id);
+ h->view_id = NULL;
+ }
+
+ h->view_id = strdup(view_id);
+ if (!h->view_id) {
+ _E("Failed to duplicate data");
+ return -1;
+ }
+
+ return 0;
+}
+
+int rpc_port_autofill_svc_save_view_info_add_items(rpc_port_autofill_svc_save_view_info_h h, rpc_port_autofill_svc_save_item_h items)
+{
+ if (!h || !items) {
+ _E("Invalid parameter");
+ return -1;
+ }
+
+ do {
+ rpc_port_autofill_svc_save_item_h value = NULL;
+
+ rpc_port_autofill_svc_save_item_clone(items, &value);
+ if (!value) {
+ _E("Out of memory");
+ return -1;
+ }
+
+ h->items = g_list_append(h->items, value);
+ } while (0);
+
+ return 0;
+}
+
+int rpc_port_autofill_svc_save_view_info_get_view_id(rpc_port_autofill_svc_save_view_info_h h, char **view_id)
+{
+ if (!h || !view_id) {
+ _E("Invalid parameter");
+ return -1;
+ }
+
+ if (!h->view_id) {
+ _E("Invalid parameter: h->view_id is NULL");
+ return -1;
+ }
+
+ *view_id = strdup(h->view_id);
+ if (*view_id == NULL) {
+ _E("Failed to duplicate view_id");
+ return -1;
+ }
+
+ return 0;
+}
+
+int rpc_port_autofill_svc_save_view_info_foreach_items(rpc_port_autofill_svc_save_view_info_h h,
+ bool (*callback)(rpc_port_autofill_svc_save_item_h items, void *user_data), void *user_data)
+{
+ if (!h || !callback) {
+ _E("Invalid parameter");
+ return -1;
+ }
+
+ do {
+ GList *iter;
+
+ iter = h->items;
+ while (iter) {
+ rpc_port_autofill_svc_save_item_h value = iter->data;
+
+ iter = g_list_next(iter);
+ if (!value) {
+ _W("Warning: value is NULL");
+ continue;
+ }
+
+ bool ret = callback(value, user_data);
+ if (!ret)
+ break;
+ }
+ } while (0);
+
+ return 0;
+}
+
+int rpc_port_autofill_svc_save_view_info_remove_items(rpc_port_autofill_svc_save_view_info_h h, unsigned int nth)
+{
+ GList *iter;
+
+ if (!h) {
+ _E("Invalid parameter");
+ return -1;
+ }
+
+ iter = g_list_nth(h->items, nth);
+ if (iter == NULL)
+ return -1;
+
+ rpc_port_autofill_svc_save_item_h value = iter->data;
+ h->items = g_list_remove_link(h->items, iter);
+ rpc_port_autofill_svc_save_item_destroy(value);
+ g_list_free(iter);
+
+ return 0;
+}
+
+int rpc_port_autofill_svc_save_view_info_get_items_length(rpc_port_autofill_svc_save_view_info_h h, unsigned int *length)
+{
+ if (!h || !length) {
+ _E("Invalid parameter");
+ return -1;
+ }
+
+ *length = g_list_length(h->items);
+
+ return 0;
+}
+
struct autofill_svc_auth_info_s {
rpc_port_parcelable_t parcelable;
char *app_id;
return 0;
}
+struct list_autofill_svc_save_item_s {
+ rpc_port_parcelable_t parcelable;
+ GList *list_autofill_svc_save_items;
+};
+
+static void __list_autofill_svc_save_item_to(rpc_port_parcel_h parcel, void *data)
+{
+ rpc_port_list_autofill_svc_save_item_h h = data;
+
+ if (!parcel || !h) {
+ _E("Invalid parameter");
+ return;
+ }
+
+ rpc_port_parcel_write_array_count(parcel, g_list_length(h->list_autofill_svc_save_items));
+ do {
+ GList *iter;
+
+ iter = h->list_autofill_svc_save_items;
+ while (iter) {
+ rpc_port_autofill_svc_save_item_h value = iter->data;
+
+ iter = g_list_next(iter);
+ if (!value) {
+ _W("Warning: value is NULL");
+ continue;
+ }
+ rpc_port_parcel_write(parcel, &value->parcelable, value);
+ }
+ } while (0);
+}
+
+static void __list_autofill_svc_save_item_from(rpc_port_parcel_h parcel, void *data)
+{
+ rpc_port_list_autofill_svc_save_item_h h = data;
+
+ if (!parcel || !h) {
+ _E("Invalid parameter");
+ return;
+ }
+
+ do {
+ int len = 0;
+
+ rpc_port_parcel_read_array_count(parcel, &len);
+ for (int i = 0; i < len; i++) {
+ rpc_port_autofill_svc_save_item_h value = NULL;
+
+ rpc_port_autofill_svc_save_item_create(&value);
+ if (!value) {
+ _E("Failed to create handle");
+ return;
+ }
+
+ rpc_port_parcel_read(parcel, &value->parcelable, value);
+ h->list_autofill_svc_save_items = g_list_append(h->list_autofill_svc_save_items, value);
+ }
+ } while (0);
+}
+
+int rpc_port_list_autofill_svc_save_item_create(rpc_port_list_autofill_svc_save_item_h *h)
+{
+ struct list_autofill_svc_save_item_s *handle;
+
+ if (!h) {
+ _E("Invalid parameter");
+ return -1;
+ }
+
+ handle = calloc(1, sizeof(struct list_autofill_svc_save_item_s));
+ if (!handle) {
+ _E("Out of memory");
+ return -1;
+ }
+
+ handle->parcelable.to = __list_autofill_svc_save_item_to;
+ handle->parcelable.from = __list_autofill_svc_save_item_from;
+
+ *h = handle;
+
+ return 0;
+}
+
+int rpc_port_list_autofill_svc_save_item_destroy(rpc_port_list_autofill_svc_save_item_h h)
+{
+ if (!h) {
+ _E("Invalid parameter");
+ return -1;
+ }
+
+ do {
+ GList *iter;
+
+ iter = h->list_autofill_svc_save_items;
+ while (iter) {
+ rpc_port_autofill_svc_save_item_h value = iter->data;
+ if (value)
+ rpc_port_autofill_svc_save_item_destroy(value);
+
+ iter = g_list_next(iter);
+ }
+ g_list_free(h->list_autofill_svc_save_items);
+ } while (0);
+
+ free(h);
+
+ return 0;
+}
+
+int rpc_port_list_autofill_svc_save_item_clone(rpc_port_list_autofill_svc_save_item_h h, rpc_port_list_autofill_svc_save_item_h *clone)
+{
+ rpc_port_list_autofill_svc_save_item_h handle = NULL;
+
+ if (!h || !clone) {
+ _E("Invalid parameter");
+ return -1;
+ }
+
+ rpc_port_list_autofill_svc_save_item_create(&handle);
+ if (!handle) {
+ _E("Failed to create list_autofill_svc_save_item handle");
+ return -1;
+ }
+
+ do {
+ GList *iter;
+
+ iter = h->list_autofill_svc_save_items;
+ while (iter) {
+ rpc_port_autofill_svc_save_item_h new_value;
+ rpc_port_autofill_svc_save_item_h value = iter->data;
+
+ if (!value) {
+ _E("Error: value is NULL");
+ rpc_port_list_autofill_svc_save_item_destroy(handle);
+ return -1;
+ }
+
+ rpc_port_autofill_svc_save_item_clone(value, &new_value);
+ if (!new_value) {
+ _E("Failed to duplicate value");
+ rpc_port_list_autofill_svc_save_item_destroy(handle);
+ return -1;
+ }
+
+ handle->list_autofill_svc_save_items = g_list_append(handle->list_autofill_svc_save_items, new_value);
+ iter = g_list_next(iter);
+ }
+ } while (0);
+
+ *clone = handle;
+
+ return 0;
+}
+
+int rpc_port_list_autofill_svc_save_item_add_list_autofill_svc_save_items(rpc_port_list_autofill_svc_save_item_h h, rpc_port_autofill_svc_save_item_h list_autofill_svc_save_items)
+{
+ if (!h || !list_autofill_svc_save_items) {
+ _E("Invalid parameter");
+ return -1;
+ }
+
+ do {
+ rpc_port_autofill_svc_save_item_h value = NULL;
+
+ rpc_port_autofill_svc_save_item_clone(list_autofill_svc_save_items, &value);
+ if (!value) {
+ _E("Out of memory");
+ return -1;
+ }
+
+ h->list_autofill_svc_save_items = g_list_append(h->list_autofill_svc_save_items, value);
+ } while (0);
+
+ return 0;
+}
+
+int rpc_port_list_autofill_svc_save_item_foreach_list_autofill_svc_save_items(rpc_port_list_autofill_svc_save_item_h h,
+ bool (*callback)(rpc_port_autofill_svc_save_item_h list_autofill_svc_save_items, void *user_data), void *user_data)
+{
+ if (!h || !callback) {
+ _E("Invalid parameter");
+ return -1;
+ }
+
+ do {
+ GList *iter;
+
+ iter = h->list_autofill_svc_save_items;
+ while (iter) {
+ rpc_port_autofill_svc_save_item_h value = iter->data;
+
+ iter = g_list_next(iter);
+ if (!value) {
+ _W("Warning: value is NULL");
+ continue;
+ }
+
+ bool ret = callback(value, user_data);
+ if (!ret)
+ break;
+ }
+ } while (0);
+
+ return 0;
+}
+
+int rpc_port_list_autofill_svc_save_item_remove_list_autofill_svc_save_items(rpc_port_list_autofill_svc_save_item_h h, unsigned int nth)
+{
+ GList *iter;
+
+ if (!h) {
+ _E("Invalid parameter");
+ return -1;
+ }
+
+ iter = g_list_nth(h->list_autofill_svc_save_items, nth);
+ if (iter == NULL)
+ return -1;
+
+ rpc_port_autofill_svc_save_item_h value = iter->data;
+ h->list_autofill_svc_save_items = g_list_remove_link(h->list_autofill_svc_save_items, iter);
+ rpc_port_autofill_svc_save_item_destroy(value);
+ g_list_free(iter);
+
+ return 0;
+}
+
+int rpc_port_list_autofill_svc_save_item_get_list_autofill_svc_save_items_length(rpc_port_list_autofill_svc_save_item_h h, unsigned int *length)
+{
+ if (!h || !length) {
+ _E("Invalid parameter");
+ return -1;
+ }
+
+ *length = g_list_length(h->list_autofill_svc_save_items);
+
+ return 0;
+}
+
enum AutofillSvcPort_method_e {
AutofillSvcPort_METHOD_Result,
AutofillSvcPort_METHOD_Callback,
AutofillSvcPort_METHOD_Unregister,
AutofillSvcPort_METHOD_request_auth_info,
AutofillSvcPort_METHOD_send_fill_request,
+ AutofillSvcPort_METHOD_commit,
};
enum AutofillSvcPort_delegate_e {
return 0;
}
+static int __AutofillSvcPort_method_commit(rpc_port_h port, rpc_port_parcel_h parcel, void *data)
+{
+ rpc_port_stub_AutofillSvcPort_context_h context = data;
+ rpc_port_h callback_port;
+ int r;
+
+ r = rpc_port_stub_get_port(__AutofillSvcPort_stub, RPC_PORT_PORT_CALLBACK, context->instance, &callback_port);
+ if (r != 0) {
+ _E("Failed to get callback port");
+ return -1;
+ }
+
+ rpc_port_autofill_svc_save_view_info_h si = NULL;
+
+ rpc_port_autofill_svc_save_view_info_create(&si);
+ rpc_port_parcel_read(parcel, &si->parcelable, si);
+
+ context->callback.commit(context, si, context->user_data);
+
+ rpc_port_autofill_svc_save_view_info_destroy(si);
+ return 0;
+}
+
static stub_method __AutofillSvcPort_method_table[] = {
[AutofillSvcPort_METHOD_Register] = __AutofillSvcPort_method_Register,
[AutofillSvcPort_METHOD_Unregister] = __AutofillSvcPort_method_Unregister,
[AutofillSvcPort_METHOD_request_auth_info] = __AutofillSvcPort_method_request_auth_info,
[AutofillSvcPort_METHOD_send_fill_request] = __AutofillSvcPort_method_send_fill_request,
+ [AutofillSvcPort_METHOD_commit] = __AutofillSvcPort_method_commit,
};
static void __AutofillSvcPort_on_connected(const char *sender, const char *instance, void *data)
int rpc_port_autofill_svc_view_info_get_items_length(rpc_port_autofill_svc_view_info_h h, unsigned int *length);
+typedef struct autofill_svc_save_item_s *rpc_port_autofill_svc_save_item_h;
+
+int rpc_port_autofill_svc_save_item_create(rpc_port_autofill_svc_save_item_h *h);
+
+int rpc_port_autofill_svc_save_item_destroy(rpc_port_autofill_svc_save_item_h h);
+
+int rpc_port_autofill_svc_save_item_clone(rpc_port_autofill_svc_save_item_h h, rpc_port_autofill_svc_save_item_h *clone);
+
+int rpc_port_autofill_svc_save_item_set_id(rpc_port_autofill_svc_save_item_h h, const char *id);
+
+int rpc_port_autofill_svc_save_item_set_label(rpc_port_autofill_svc_save_item_h h, const char *label);
+
+int rpc_port_autofill_svc_save_item_set_value(rpc_port_autofill_svc_save_item_h h, const char *value);
+
+int rpc_port_autofill_svc_save_item_set_autofill_hint(rpc_port_autofill_svc_save_item_h h, int autofill_hint);
+
+int rpc_port_autofill_svc_save_item_set_is_sensitive_data(rpc_port_autofill_svc_save_item_h h, bool is_sensitive_data);
+
+int rpc_port_autofill_svc_save_item_get_id(rpc_port_autofill_svc_save_item_h h, char **id);
+
+int rpc_port_autofill_svc_save_item_get_label(rpc_port_autofill_svc_save_item_h h, char **label);
+
+int rpc_port_autofill_svc_save_item_get_value(rpc_port_autofill_svc_save_item_h h, char **value);
+
+int rpc_port_autofill_svc_save_item_get_autofill_hint(rpc_port_autofill_svc_save_item_h h, int *autofill_hint);
+
+int rpc_port_autofill_svc_save_item_get_is_sensitive_data(rpc_port_autofill_svc_save_item_h h, bool *is_sensitive_data);
+
+typedef struct autofill_svc_save_view_info_s *rpc_port_autofill_svc_save_view_info_h;
+
+int rpc_port_autofill_svc_save_view_info_create(rpc_port_autofill_svc_save_view_info_h *h);
+
+int rpc_port_autofill_svc_save_view_info_destroy(rpc_port_autofill_svc_save_view_info_h h);
+
+int rpc_port_autofill_svc_save_view_info_clone(rpc_port_autofill_svc_save_view_info_h h, rpc_port_autofill_svc_save_view_info_h *clone);
+
+int rpc_port_autofill_svc_save_view_info_set_view_id(rpc_port_autofill_svc_save_view_info_h h, const char *view_id);
+
+int rpc_port_autofill_svc_save_view_info_add_items(rpc_port_autofill_svc_save_view_info_h h, rpc_port_autofill_svc_save_item_h items);
+
+int rpc_port_autofill_svc_save_view_info_get_view_id(rpc_port_autofill_svc_save_view_info_h h, char **view_id);
+
+int rpc_port_autofill_svc_save_view_info_foreach_items(rpc_port_autofill_svc_save_view_info_h h,
+ bool (*callback)(rpc_port_autofill_svc_save_item_h items, void *user_data), void *user_data);
+
+int rpc_port_autofill_svc_save_view_info_remove_items(rpc_port_autofill_svc_save_view_info_h h, unsigned int nth);
+
+int rpc_port_autofill_svc_save_view_info_get_items_length(rpc_port_autofill_svc_save_view_info_h h, unsigned int *length);
+
typedef struct autofill_svc_auth_info_s *rpc_port_autofill_svc_auth_info_h;
int rpc_port_autofill_svc_auth_info_create(rpc_port_autofill_svc_auth_info_h *h);
int rpc_port_list_autofill_svc_response_item_get_list_autofill_svc_response_items_length(rpc_port_list_autofill_svc_response_item_h h, unsigned int *length);
+typedef struct list_autofill_svc_save_item_s *rpc_port_list_autofill_svc_save_item_h;
+
+int rpc_port_list_autofill_svc_save_item_create(rpc_port_list_autofill_svc_save_item_h *h);
+
+int rpc_port_list_autofill_svc_save_item_destroy(rpc_port_list_autofill_svc_save_item_h h);
+
+int rpc_port_list_autofill_svc_save_item_clone(rpc_port_list_autofill_svc_save_item_h h, rpc_port_list_autofill_svc_save_item_h *clone);
+
+int rpc_port_list_autofill_svc_save_item_add_list_autofill_svc_save_items(rpc_port_list_autofill_svc_save_item_h h, rpc_port_autofill_svc_save_item_h list_autofill_svc_save_items);
+
+int rpc_port_list_autofill_svc_save_item_foreach_list_autofill_svc_save_items(rpc_port_list_autofill_svc_save_item_h h,
+ bool (*callback)(rpc_port_autofill_svc_save_item_h list_autofill_svc_save_items, void *user_data), void *user_data);
+
+int rpc_port_list_autofill_svc_save_item_remove_list_autofill_svc_save_items(rpc_port_list_autofill_svc_save_item_h h, unsigned int nth);
+
+int rpc_port_list_autofill_svc_save_item_get_list_autofill_svc_save_items_length(rpc_port_list_autofill_svc_save_item_h h, unsigned int *length);
+
typedef struct AutofillSvcPort_context_s* rpc_port_stub_AutofillSvcPort_context_h;
int rpc_port_stub_AutofillSvcPort_context_set_tag(rpc_port_stub_AutofillSvcPort_context_h ctx, void *tag);
void (*Unregister)(rpc_port_stub_AutofillSvcPort_context_h context, void *user_data);
void (*request_auth_info)(rpc_port_stub_AutofillSvcPort_context_h context, rpc_port_autofill_svc_view_info_h vi, void *user_data);
void (*send_fill_request)(rpc_port_stub_AutofillSvcPort_context_h context, rpc_port_autofill_svc_view_info_h vi, void *user_data);
+ void (*commit)(rpc_port_stub_AutofillSvcPort_context_h context, rpc_port_autofill_svc_save_view_info_h si, void *user_data);
} rpc_port_stub_AutofillSvcPort_callback_s;
int rpc_port_stub_AutofillSvcPort_register(rpc_port_stub_AutofillSvcPort_callback_s *callback, void *user_data);
Evas_Textblock_Cursor *preedit_end;
Ecore_IMF_Context *imf_context;
autofill_item_h ai_h;
+ autofill_save_item_h si_h;
Eina_Bool have_preedit : 1;
};
}
static void
+_save_autofill_info()
+{
+ char *app_id;
+ app_get_id(&app_id);
+ autofill_save_view_info_h autofill_save_view_info = NULL;
+
+ autofill_save_item_set_value(en1.si_h, "save data 1");
+ autofill_save_item_set_value(en2.si_h, "save data 2");
+
+ // create autofill view info
+ autofill_save_view_info_create(&autofill_save_view_info);
+ autofill_save_view_info_set_app_id(autofill_save_view_info, app_id);
+ autofill_save_view_info_set_view_id(autofill_save_view_info, "login");
+
+ autofill_save_view_info_add_item(autofill_save_view_info, en1.si_h);
+ autofill_save_view_info_add_item(autofill_save_view_info, en2.si_h);
+
+ if (app_id)
+ free(app_id);
+
+ autofill_commit(autofill_save_view_info);
+
+ autofill_save_view_info_destroy(autofill_save_view_info);
+}
+
+static void
_entry_focus_in_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *o EINA_UNUSED, void *event_info EINA_UNUSED)
{
Entry *en = data;
ecore_imf_context_reset(en->imf_context);
ecore_imf_context_focus_out(en->imf_context);
}
+
+ _save_autofill_info();
}
static void
autofill_item_set_label(en->ai_h, label);
autofill_item_set_sensitive_data(en->ai_h, sensitive);
+ autofill_save_item_create(&en->si_h);
+ autofill_save_item_set_autofill_hint(en->si_h, autofill_hint);
+ autofill_save_item_set_id(en->si_h, id);
+ autofill_save_item_set_label(en->si_h, label);
+ autofill_save_item_set_sensitive_data(en->si_h, sensitive);
+
en->imf_context = ecore_imf_context_add(default_id);
ecore_imf_context_client_canvas_set(en->imf_context, evas);
list<autofill_item> items;
}
+struct autofill_save_item {
+ string id;
+ string label;
+ string value;
+ int autofill_hint;
+ bool is_sensitive_data;
+}
+
+struct autofill_save_view_info {
+ string view_id;
+ list<autofill_save_item> items;
+}
+
struct autofill_auth_info {
bool exist_autofill_data;
bool need_authentication;
void request_auth_info(autofill_view_info vi) async;
void send_fill_request(autofill_view_info vi) async;
+ void commit(autofill_save_view_info vi) async;
}
list<autofill_svc_item> items;
}
+struct autofill_svc_save_item {
+ string id;
+ string label;
+ string value;
+ int autofill_hint;
+ bool is_sensitive_data;
+}
+
+struct autofill_svc_save_view_info {
+ string view_id;
+ list<autofill_svc_save_item> items;
+}
+
struct autofill_svc_auth_info {
string app_id;
bool exist_autofill_data;
void request_auth_info(autofill_svc_view_info vi) async;
void send_fill_request(autofill_svc_view_info vi) async;
+ void commit(autofill_svc_save_view_info si) async;
}