void WebNotificationManagerProxy::populateCopyOfNotificationPermissions(HashMap<String, bool>& permissions) { RefPtr<API::Dictionary> knownPermissions = m_provider.notificationPermissions(); if (!knownPermissions) return; permissions.clear(); RefPtr<API::Array> knownOrigins = knownPermissions->keys(); for (size_t i = 0; i < knownOrigins->size(); ++i) { API::String* origin = knownOrigins->at<API::String>(i); permissions.set(origin->string(), knownPermissions->get<API::Boolean>(origin->string())->value()); } }
static void webkitCookieManagerGetDomainsWithCookiesCallback(WKArrayRef wkDomains, WKErrorRef, void* context) { GRefPtr<GTask> task = adoptGRef(G_TASK(context)); if (g_task_return_error_if_cancelled(task.get())) return; API::Array* domains = toImpl(wkDomains); GPtrArray* returnValue = g_ptr_array_sized_new(domains->size()); for (size_t i = 0; i < domains->size(); ++i) { API::String* domainString = static_cast<API::String*>(domains->at(i)); String domain = domainString->string(); if (domain.isEmpty()) continue; g_ptr_array_add(returnValue, g_strdup(domain.utf8().data())); } g_ptr_array_add(returnValue, 0); g_task_return_pointer(task.get(), g_ptr_array_free(returnValue, FALSE), reinterpret_cast<GDestroyNotify>(g_strfreev)); }