1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/dom/time/TimeManager.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,59 @@ 1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.6 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.7 + 1.8 +#ifndef mozilla_dom_time_TimeManager_h 1.9 +#define mozilla_dom_time_TimeManager_h 1.10 + 1.11 +#include "mozilla/Attributes.h" 1.12 +#include "nsISupports.h" 1.13 +#include "nsPIDOMWindow.h" 1.14 +#include "nsWrapperCache.h" 1.15 + 1.16 +namespace mozilla { 1.17 +namespace dom { 1.18 + 1.19 +class Date; 1.20 + 1.21 +namespace time { 1.22 + 1.23 +class TimeManager MOZ_FINAL : public nsISupports 1.24 + , public nsWrapperCache 1.25 +{ 1.26 +public: 1.27 + static bool PrefEnabled(JSContext* aCx, JSObject* aGlobal) 1.28 + { 1.29 +#ifdef MOZ_TIME_MANAGER 1.30 + return true; 1.31 +#else 1.32 + return false; 1.33 +#endif 1.34 + } 1.35 + 1.36 + NS_DECL_CYCLE_COLLECTING_ISUPPORTS 1.37 + NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(TimeManager) 1.38 + 1.39 + explicit TimeManager(nsPIDOMWindow* aWindow) 1.40 + : mWindow(aWindow) 1.41 + { 1.42 + SetIsDOMBinding(); 1.43 + } 1.44 + 1.45 + nsPIDOMWindow* GetParentObject() const 1.46 + { 1.47 + return mWindow; 1.48 + } 1.49 + JSObject* WrapObject(JSContext* aCx); 1.50 + 1.51 + void Set(Date& aDate); 1.52 + void Set(double aTime); 1.53 + 1.54 +private: 1.55 + nsCOMPtr<nsPIDOMWindow> mWindow; 1.56 +}; 1.57 + 1.58 +} // namespace time 1.59 +} // namespace dom 1.60 +} // namespace mozilla 1.61 + 1.62 +#endif //mozilla_dom_time_TimeManager_h