2011-07-17 12:09:13 -07:00
|
|
|
/* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 40 -*- */
|
2012-05-21 04:12:37 -07:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2011-01-06 22:21:26 -08:00
|
|
|
|
2011-07-17 12:09:13 -07:00
|
|
|
#ifndef mozilla_dom_workers_navigator_h__
|
|
|
|
#define mozilla_dom_workers_navigator_h__
|
|
|
|
|
|
|
|
#include "Workers.h"
|
2013-09-29 19:41:23 -07:00
|
|
|
#include "mozilla/dom/workers/bindings/DOMBindingBase.h"
|
2013-09-23 10:25:00 -07:00
|
|
|
#include "nsString.h"
|
2011-07-17 12:09:13 -07:00
|
|
|
|
|
|
|
BEGIN_WORKERS_NAMESPACE
|
|
|
|
|
2013-09-29 19:41:23 -07:00
|
|
|
class WorkerNavigator MOZ_FINAL : public DOMBindingBase
|
2013-07-24 00:38:23 -07:00
|
|
|
{
|
|
|
|
nsString mAppName;
|
|
|
|
nsString mAppVersion;
|
|
|
|
nsString mPlatform;
|
|
|
|
nsString mUserAgent;
|
|
|
|
|
2013-09-29 19:41:23 -07:00
|
|
|
WorkerNavigator(JSContext* aCx,
|
|
|
|
const nsAString& aAppName,
|
2013-07-24 00:38:23 -07:00
|
|
|
const nsAString& aAppVersion,
|
|
|
|
const nsAString& aPlatform,
|
|
|
|
const nsAString& aUserAgent)
|
2013-09-29 19:41:23 -07:00
|
|
|
: DOMBindingBase(aCx)
|
|
|
|
, mAppName(aAppName)
|
2013-07-24 00:38:23 -07:00
|
|
|
, mAppVersion(aAppVersion)
|
|
|
|
, mPlatform(aPlatform)
|
|
|
|
, mUserAgent(aUserAgent)
|
|
|
|
{
|
2013-09-29 19:41:23 -07:00
|
|
|
MOZ_COUNT_CTOR(mozilla::dom::workers::WorkerNavigator);
|
2013-07-24 00:38:23 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
public:
|
|
|
|
static already_AddRefed<WorkerNavigator>
|
|
|
|
Create(JSContext* aCx, JS::Handle<JSObject*> aGlobal);
|
|
|
|
|
2013-09-29 19:41:23 -07:00
|
|
|
virtual void
|
|
|
|
_trace(JSTracer* aTrc) MOZ_OVERRIDE;
|
2011-07-17 12:09:13 -07:00
|
|
|
|
2013-09-29 19:41:23 -07:00
|
|
|
virtual void
|
|
|
|
_finalize(JSFreeOp* aFop) MOZ_OVERRIDE;
|
2011-07-17 12:09:13 -07:00
|
|
|
|
2013-07-24 00:38:23 -07:00
|
|
|
~WorkerNavigator()
|
|
|
|
{
|
2013-09-29 19:41:23 -07:00
|
|
|
MOZ_COUNT_DTOR(mozilla::dom::workers::WorkerNavigator);
|
2013-07-24 00:38:23 -07:00
|
|
|
}
|
2011-07-17 12:09:13 -07:00
|
|
|
|
2013-07-24 00:38:23 -07:00
|
|
|
void GetAppName(nsString& aAppName) const
|
|
|
|
{
|
|
|
|
aAppName = mAppName;
|
|
|
|
}
|
|
|
|
void GetAppVersion(nsString& aAppVersion) const
|
|
|
|
{
|
|
|
|
aAppVersion = mAppVersion;
|
|
|
|
}
|
|
|
|
void GetPlatform(nsString& aPlatform) const
|
|
|
|
{
|
|
|
|
aPlatform = mPlatform;
|
|
|
|
}
|
|
|
|
void GetUserAgent(nsString& aUserAgent) const
|
|
|
|
{
|
|
|
|
aUserAgent = mUserAgent;
|
|
|
|
}
|
2013-09-29 18:37:26 -07:00
|
|
|
|
2013-09-29 19:41:23 -07:00
|
|
|
};
|
2011-07-17 12:09:13 -07:00
|
|
|
END_WORKERS_NAMESPACE
|
|
|
|
|
|
|
|
#endif // mozilla_dom_workers_navigator_h__
|