2012-09-10 23:05:00 -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/. */
|
|
|
|
|
|
|
|
#ifndef mozilla_dom_time_TimeManager_h
|
|
|
|
#define mozilla_dom_time_TimeManager_h
|
|
|
|
|
2012-09-18 11:01:03 -07:00
|
|
|
#include "mozilla/Attributes.h"
|
2013-06-12 00:00:07 -07:00
|
|
|
#include "nsISupports.h"
|
|
|
|
#include "nsPIDOMWindow.h"
|
|
|
|
#include "nsWrapperCache.h"
|
2012-09-10 23:05:00 -07:00
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace dom {
|
2013-06-12 00:00:07 -07:00
|
|
|
|
|
|
|
class Date;
|
|
|
|
|
2012-09-10 23:05:00 -07:00
|
|
|
namespace time {
|
2012-09-27 23:02:28 -07:00
|
|
|
|
2013-06-12 00:00:07 -07:00
|
|
|
class TimeManager MOZ_FINAL : public nsISupports
|
|
|
|
, public nsWrapperCache
|
2012-09-10 23:05:00 -07:00
|
|
|
{
|
|
|
|
public:
|
2013-06-12 00:00:07 -07:00
|
|
|
static bool PrefEnabled()
|
|
|
|
{
|
|
|
|
#ifdef MOZ_TIME_MANAGER
|
|
|
|
return true;
|
|
|
|
#else
|
|
|
|
return false;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
|
|
|
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(TimeManager)
|
|
|
|
|
|
|
|
explicit TimeManager(nsPIDOMWindow* aWindow)
|
|
|
|
: mWindow(aWindow)
|
|
|
|
{
|
|
|
|
SetIsDOMBinding();
|
|
|
|
}
|
|
|
|
|
|
|
|
nsPIDOMWindow* GetParentObject() const
|
|
|
|
{
|
|
|
|
return mWindow;
|
|
|
|
}
|
|
|
|
JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aScope);
|
|
|
|
|
|
|
|
void Set(Date& aDate);
|
|
|
|
void Set(double aTime);
|
|
|
|
|
|
|
|
private:
|
|
|
|
nsCOMPtr<nsPIDOMWindow> mWindow;
|
2012-09-10 23:05:00 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace time
|
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|
|
|
|
|
|
|
|
#endif //mozilla_dom_time_TimeManager_h
|