| /* |
| * This file is part of the WebKit open source project. |
| * This file has been generated by generate-bindings.pl. DO NOT MODIFY! |
| * |
| * This library is free software; you can redistribute it and/or |
| * modify it under the terms of the GNU Library General Public |
| * License as published by the Free Software Foundation; either |
| * version 2 of the License, or (at your option) any later version. |
| * |
| * This library is distributed in the hope that it will be useful, |
| * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| * Library General Public License for more details. |
| * |
| * You should have received a copy of the GNU Library General Public License |
| * along with this library; see the file COPYING.LIB. If not, write to |
| * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| * Boston, MA 02110-1301, USA. |
| */ |
| |
| #include "config.h" |
| #include "WebKitDOMLocation.h" |
| |
| #include <WebCore/CSSImportRule.h> |
| #include "DOMObjectCache.h" |
| #include <WebCore/Document.h> |
| #include <WebCore/ExceptionCode.h> |
| #include <WebCore/ExceptionCodeDescription.h> |
| #include <WebCore/JSMainThreadExecState.h> |
| #include "WebKitDOMLocationPrivate.h" |
| #include "WebKitDOMPrivate.h" |
| #include "ConvertToUTF8String.h" |
| #include <wtf/GetPtr.h> |
| #include <wtf/RefPtr.h> |
| |
| #define WEBKIT_DOM_LOCATION_GET_PRIVATE(obj) G_TYPE_INSTANCE_GET_PRIVATE(obj, WEBKIT_DOM_TYPE_LOCATION, WebKitDOMLocationPrivate) |
| |
| typedef struct _WebKitDOMLocationPrivate { |
| RefPtr<WebCore::Location> coreObject; |
| } WebKitDOMLocationPrivate; |
| |
| namespace WebKit { |
| |
| WebKitDOMLocation* kit(WebCore::Location* obj) |
| { |
| if (!obj) |
| return 0; |
| |
| if (gpointer ret = DOMObjectCache::get(obj)) |
| return WEBKIT_DOM_LOCATION(ret); |
| |
| return wrapLocation(obj); |
| } |
| |
| WebCore::Location* core(WebKitDOMLocation* request) |
| { |
| return request ? static_cast<WebCore::Location*>(WEBKIT_DOM_OBJECT(request)->coreObject) : 0; |
| } |
| |
| WebKitDOMLocation* wrapLocation(WebCore::Location* coreObject) |
| { |
| ASSERT(coreObject); |
| return WEBKIT_DOM_LOCATION(g_object_new(WEBKIT_DOM_TYPE_LOCATION, "core-object", coreObject, nullptr)); |
| } |
| |
| } // namespace WebKit |
| |
| G_DEFINE_TYPE(WebKitDOMLocation, webkit_dom_location, WEBKIT_DOM_TYPE_OBJECT) |
| |
| enum { |
| PROP_0, |
| PROP_HREF, |
| PROP_PROTOCOL, |
| PROP_HOST, |
| PROP_HOSTNAME, |
| PROP_PORT, |
| PROP_PATHNAME, |
| PROP_SEARCH, |
| PROP_HASH, |
| PROP_ORIGIN, |
| }; |
| |
| static void webkit_dom_location_finalize(GObject* object) |
| { |
| WebKitDOMLocationPrivate* priv = WEBKIT_DOM_LOCATION_GET_PRIVATE(object); |
| |
| WebKit::DOMObjectCache::forget(priv->coreObject.get()); |
| |
| priv->~WebKitDOMLocationPrivate(); |
| G_OBJECT_CLASS(webkit_dom_location_parent_class)->finalize(object); |
| } |
| |
| static void webkit_dom_location_get_property(GObject* object, guint propertyId, GValue* value, GParamSpec* pspec) |
| { |
| WebKitDOMLocation* self = WEBKIT_DOM_LOCATION(object); |
| |
| switch (propertyId) { |
| case PROP_HREF: |
| g_value_take_string(value, webkit_dom_location_get_href(self)); |
| break; |
| case PROP_PROTOCOL: |
| g_value_take_string(value, webkit_dom_location_get_protocol(self)); |
| break; |
| case PROP_HOST: |
| g_value_take_string(value, webkit_dom_location_get_host(self)); |
| break; |
| case PROP_HOSTNAME: |
| g_value_take_string(value, webkit_dom_location_get_hostname(self)); |
| break; |
| case PROP_PORT: |
| g_value_take_string(value, webkit_dom_location_get_port(self)); |
| break; |
| case PROP_PATHNAME: |
| g_value_take_string(value, webkit_dom_location_get_pathname(self)); |
| break; |
| case PROP_SEARCH: |
| g_value_take_string(value, webkit_dom_location_get_search(self)); |
| break; |
| case PROP_HASH: |
| g_value_take_string(value, webkit_dom_location_get_hash(self)); |
| break; |
| case PROP_ORIGIN: |
| g_value_take_string(value, webkit_dom_location_get_origin(self)); |
| break; |
| default: |
| G_OBJECT_WARN_INVALID_PROPERTY_ID(object, propertyId, pspec); |
| break; |
| } |
| } |
| |
| static GObject* webkit_dom_location_constructor(GType type, guint constructPropertiesCount, GObjectConstructParam* constructProperties) |
| { |
| GObject* object = G_OBJECT_CLASS(webkit_dom_location_parent_class)->constructor(type, constructPropertiesCount, constructProperties); |
| |
| WebKitDOMLocationPrivate* priv = WEBKIT_DOM_LOCATION_GET_PRIVATE(object); |
| priv->coreObject = static_cast<WebCore::Location*>(WEBKIT_DOM_OBJECT(object)->coreObject); |
| WebKit::DOMObjectCache::put(priv->coreObject.get(), object); |
| |
| return object; |
| } |
| |
| static void webkit_dom_location_class_init(WebKitDOMLocationClass* requestClass) |
| { |
| GObjectClass* gobjectClass = G_OBJECT_CLASS(requestClass); |
| g_type_class_add_private(gobjectClass, sizeof(WebKitDOMLocationPrivate)); |
| gobjectClass->constructor = webkit_dom_location_constructor; |
| gobjectClass->finalize = webkit_dom_location_finalize; |
| gobjectClass->get_property = webkit_dom_location_get_property; |
| |
| g_object_class_install_property( |
| gobjectClass, |
| PROP_HREF, |
| g_param_spec_string( |
| "href", |
| "Location:href", |
| "read-only gchar* Location:href", |
| "", |
| WEBKIT_PARAM_READABLE)); |
| |
| g_object_class_install_property( |
| gobjectClass, |
| PROP_PROTOCOL, |
| g_param_spec_string( |
| "protocol", |
| "Location:protocol", |
| "read-only gchar* Location:protocol", |
| "", |
| WEBKIT_PARAM_READABLE)); |
| |
| g_object_class_install_property( |
| gobjectClass, |
| PROP_HOST, |
| g_param_spec_string( |
| "host", |
| "Location:host", |
| "read-only gchar* Location:host", |
| "", |
| WEBKIT_PARAM_READABLE)); |
| |
| g_object_class_install_property( |
| gobjectClass, |
| PROP_HOSTNAME, |
| g_param_spec_string( |
| "hostname", |
| "Location:hostname", |
| "read-only gchar* Location:hostname", |
| "", |
| WEBKIT_PARAM_READABLE)); |
| |
| g_object_class_install_property( |
| gobjectClass, |
| PROP_PORT, |
| g_param_spec_string( |
| "port", |
| "Location:port", |
| "read-only gchar* Location:port", |
| "", |
| WEBKIT_PARAM_READABLE)); |
| |
| g_object_class_install_property( |
| gobjectClass, |
| PROP_PATHNAME, |
| g_param_spec_string( |
| "pathname", |
| "Location:pathname", |
| "read-only gchar* Location:pathname", |
| "", |
| WEBKIT_PARAM_READABLE)); |
| |
| g_object_class_install_property( |
| gobjectClass, |
| PROP_SEARCH, |
| g_param_spec_string( |
| "search", |
| "Location:search", |
| "read-only gchar* Location:search", |
| "", |
| WEBKIT_PARAM_READABLE)); |
| |
| g_object_class_install_property( |
| gobjectClass, |
| PROP_HASH, |
| g_param_spec_string( |
| "hash", |
| "Location:hash", |
| "read-only gchar* Location:hash", |
| "", |
| WEBKIT_PARAM_READABLE)); |
| |
| g_object_class_install_property( |
| gobjectClass, |
| PROP_ORIGIN, |
| g_param_spec_string( |
| "origin", |
| "Location:origin", |
| "read-only gchar* Location:origin", |
| "", |
| WEBKIT_PARAM_READABLE)); |
| |
| } |
| |
| static void webkit_dom_location_init(WebKitDOMLocation* request) |
| { |
| WebKitDOMLocationPrivate* priv = WEBKIT_DOM_LOCATION_GET_PRIVATE(request); |
| new (priv) WebKitDOMLocationPrivate(); |
| } |
| |
| gchar* webkit_dom_location_get_href(WebKitDOMLocation* self) |
| { |
| WebCore::JSMainThreadNullState state; |
| g_return_val_if_fail(WEBKIT_DOM_IS_LOCATION(self), 0); |
| WebCore::Location* item = WebKit::core(self); |
| gchar* result = convertToUTF8String(item->href()); |
| return result; |
| } |
| |
| gchar* webkit_dom_location_get_protocol(WebKitDOMLocation* self) |
| { |
| WebCore::JSMainThreadNullState state; |
| g_return_val_if_fail(WEBKIT_DOM_IS_LOCATION(self), 0); |
| WebCore::Location* item = WebKit::core(self); |
| gchar* result = convertToUTF8String(item->protocol()); |
| return result; |
| } |
| |
| gchar* webkit_dom_location_get_host(WebKitDOMLocation* self) |
| { |
| WebCore::JSMainThreadNullState state; |
| g_return_val_if_fail(WEBKIT_DOM_IS_LOCATION(self), 0); |
| WebCore::Location* item = WebKit::core(self); |
| gchar* result = convertToUTF8String(item->host()); |
| return result; |
| } |
| |
| gchar* webkit_dom_location_get_hostname(WebKitDOMLocation* self) |
| { |
| WebCore::JSMainThreadNullState state; |
| g_return_val_if_fail(WEBKIT_DOM_IS_LOCATION(self), 0); |
| WebCore::Location* item = WebKit::core(self); |
| gchar* result = convertToUTF8String(item->hostname()); |
| return result; |
| } |
| |
| gchar* webkit_dom_location_get_port(WebKitDOMLocation* self) |
| { |
| WebCore::JSMainThreadNullState state; |
| g_return_val_if_fail(WEBKIT_DOM_IS_LOCATION(self), 0); |
| WebCore::Location* item = WebKit::core(self); |
| gchar* result = convertToUTF8String(item->port()); |
| return result; |
| } |
| |
| gchar* webkit_dom_location_get_pathname(WebKitDOMLocation* self) |
| { |
| WebCore::JSMainThreadNullState state; |
| g_return_val_if_fail(WEBKIT_DOM_IS_LOCATION(self), 0); |
| WebCore::Location* item = WebKit::core(self); |
| gchar* result = convertToUTF8String(item->pathname()); |
| return result; |
| } |
| |
| gchar* webkit_dom_location_get_search(WebKitDOMLocation* self) |
| { |
| WebCore::JSMainThreadNullState state; |
| g_return_val_if_fail(WEBKIT_DOM_IS_LOCATION(self), 0); |
| WebCore::Location* item = WebKit::core(self); |
| gchar* result = convertToUTF8String(item->search()); |
| return result; |
| } |
| |
| gchar* webkit_dom_location_get_hash(WebKitDOMLocation* self) |
| { |
| WebCore::JSMainThreadNullState state; |
| g_return_val_if_fail(WEBKIT_DOM_IS_LOCATION(self), 0); |
| WebCore::Location* item = WebKit::core(self); |
| gchar* result = convertToUTF8String(item->hash()); |
| return result; |
| } |
| |
| gchar* webkit_dom_location_get_origin(WebKitDOMLocation* self) |
| { |
| WebCore::JSMainThreadNullState state; |
| g_return_val_if_fail(WEBKIT_DOM_IS_LOCATION(self), 0); |
| WebCore::Location* item = WebKit::core(self); |
| gchar* result = convertToUTF8String(item->origin()); |
| return result; |
| } |
| |