dom/time/TimeManager.h
author J. Ryan Stinnett <jryans@gmail.com>
Sat, 05 Sep 2015 00:06:15 -0500
changeset 290596 8e6be884bb4164a4d253eaff023342100fa8ca4f
parent 261130 bd079aadd3feeee3f9b9f73c5e0bc4bd6a870722
child 327360 e22b3043887ed36bf2c634c2924a7c8d39d226b1
permissions -rw-r--r--
Bug 912121 - Migrate major DevTools directories. rs=devtools Move major DevTools files to new directories using the following steps: hg mv browser/devtools devtools/client hg mv toolkit/devtools/server devtools/server hg mv toolkit/devtools devtools/shared No other changes are made.

/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* 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

#include "mozilla/Attributes.h"
#include "nsISupports.h"
#include "nsPIDOMWindow.h"
#include "nsWrapperCache.h"

namespace mozilla {
namespace dom {

class Date;

namespace time {

class TimeManager final : public nsISupports
                        , public nsWrapperCache
{
public:
  static bool PrefEnabled(JSContext* aCx, JSObject* aGlobal)
  {
#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)
  {
  }

  nsPIDOMWindow* GetParentObject() const
  {
    return mWindow;
  }
  virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;

  void Set(Date& aDate);
  void Set(double aTime);

private:
  ~TimeManager() {}

  nsCOMPtr<nsPIDOMWindow> mWindow;
};

} // namespace time
} // namespace dom
} // namespace mozilla

#endif //mozilla_dom_time_TimeManager_h