michael@0: /* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 40 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef mozilla_dom_workers_location_h__ michael@0: #define mozilla_dom_workers_location_h__ michael@0: michael@0: #include "Workers.h" michael@0: #include "WorkerPrivate.h" michael@0: #include "nsWrapperCache.h" michael@0: michael@0: BEGIN_WORKERS_NAMESPACE michael@0: michael@0: class WorkerLocation MOZ_FINAL : public nsWrapperCache michael@0: { michael@0: nsString mHref; michael@0: nsString mProtocol; michael@0: nsString mHost; michael@0: nsString mHostname; michael@0: nsString mPort; michael@0: nsString mPathname; michael@0: nsString mSearch; michael@0: nsString mHash; michael@0: nsString mOrigin; michael@0: michael@0: WorkerLocation(const nsAString& aHref, michael@0: const nsAString& aProtocol, michael@0: const nsAString& aHost, michael@0: const nsAString& aHostname, michael@0: const nsAString& aPort, michael@0: const nsAString& aPathname, michael@0: const nsAString& aSearch, michael@0: const nsAString& aHash, michael@0: const nsAString& aOrigin) michael@0: : mHref(aHref) michael@0: , mProtocol(aProtocol) michael@0: , mHost(aHost) michael@0: , mHostname(aHostname) michael@0: , mPort(aPort) michael@0: , mPathname(aPathname) michael@0: , mSearch(aSearch) michael@0: , mHash(aHash) michael@0: , mOrigin(aOrigin) michael@0: { michael@0: MOZ_COUNT_CTOR(WorkerLocation); michael@0: SetIsDOMBinding(); michael@0: } michael@0: michael@0: public: michael@0: michael@0: NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(WorkerLocation) michael@0: NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(WorkerLocation) michael@0: michael@0: static already_AddRefed michael@0: Create(WorkerPrivate::LocationInfo& aInfo); michael@0: michael@0: virtual JSObject* michael@0: WrapObject(JSContext* aCx) MOZ_OVERRIDE; michael@0: michael@0: nsISupports* GetParentObject() const { michael@0: return nullptr; michael@0: } michael@0: michael@0: ~WorkerLocation() michael@0: { michael@0: MOZ_COUNT_DTOR(WorkerLocation); michael@0: } michael@0: michael@0: void Stringify(nsString& aHref) const michael@0: { michael@0: aHref = mHref; michael@0: } michael@0: void GetHref(nsString& aHref) const michael@0: { michael@0: aHref = mHref; michael@0: } michael@0: void GetProtocol(nsString& aProtocol) const michael@0: { michael@0: aProtocol = mProtocol; michael@0: } michael@0: void GetHost(nsString& aHost) const michael@0: { michael@0: aHost = mHost; michael@0: } michael@0: void GetHostname(nsString& aHostname) const michael@0: { michael@0: aHostname = mHostname; michael@0: } michael@0: void GetPort(nsString& aPort) const michael@0: { michael@0: aPort = mPort; michael@0: } michael@0: void GetPathname(nsString& aPathname) const michael@0: { michael@0: aPathname = mPathname; michael@0: } michael@0: void GetSearch(nsString& aSearch) const michael@0: { michael@0: aSearch = mSearch; michael@0: } michael@0: void GetHash(nsString& aHash) const michael@0: { michael@0: aHash = mHash; michael@0: } michael@0: void GetOrigin(nsString& aOrigin) const michael@0: { michael@0: aOrigin = mOrigin; michael@0: } michael@0: }; michael@0: michael@0: END_WORKERS_NAMESPACE michael@0: michael@0: #endif // mozilla_dom_workers_location_h__