1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/dom/bindings/CallbackInterface.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,42 @@ 1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 1.5 +/* vim:set ts=2 sw=2 sts=2 et cindent: */ 1.6 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.7 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.8 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.9 + 1.10 +/** 1.11 + * A common base class for representing WebIDL callback interface types in C++. 1.12 + * 1.13 + * This class implements common functionality like lifetime management, 1.14 + * initialization with the callback object, and setup of the call environment. 1.15 + * Subclasses corresponding to particular callback interface types should 1.16 + * provide methods that actually do the various necessary calls. 1.17 + */ 1.18 + 1.19 +#ifndef mozilla_dom_CallbackInterface_h 1.20 +#define mozilla_dom_CallbackInterface_h 1.21 + 1.22 +#include "mozilla/dom/CallbackObject.h" 1.23 + 1.24 +namespace mozilla { 1.25 +namespace dom { 1.26 + 1.27 +class CallbackInterface : public CallbackObject 1.28 +{ 1.29 +public: 1.30 + explicit CallbackInterface(JS::Handle<JSObject*> aCallback, 1.31 + nsIGlobalObject *aIncumbentGlobal) 1.32 + : CallbackObject(aCallback, aIncumbentGlobal) 1.33 + { 1.34 + } 1.35 + 1.36 +protected: 1.37 + bool GetCallableProperty(JSContext* cx, const char* aPropName, 1.38 + JS::MutableHandle<JS::Value> aCallable); 1.39 + 1.40 +}; 1.41 + 1.42 +} // namespace dom 1.43 +} // namespace mozilla 1.44 + 1.45 +#endif // mozilla_dom_CallbackFunction_h