michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #include "nsDocShellTransferableHooks.h" michael@0: #include "nsIClipboardDragDropHooks.h" michael@0: #include "nsIClipboardDragDropHookList.h" michael@0: #include "nsArrayEnumerator.h" michael@0: michael@0: nsTransferableHookData::nsTransferableHookData() michael@0: { michael@0: } michael@0: michael@0: michael@0: nsTransferableHookData::~nsTransferableHookData() michael@0: { michael@0: } michael@0: michael@0: //***************************************************************************** michael@0: // nsIClipboardDragDropHookList michael@0: //***************************************************************************** michael@0: michael@0: NS_IMPL_ISUPPORTS(nsTransferableHookData, nsIClipboardDragDropHookList) michael@0: michael@0: NS_IMETHODIMP michael@0: nsTransferableHookData::AddClipboardDragDropHooks( michael@0: nsIClipboardDragDropHooks *aOverrides) michael@0: { michael@0: NS_ENSURE_ARG(aOverrides); michael@0: michael@0: // don't let a hook be added more than once michael@0: if (mHookList.IndexOfObject(aOverrides) == -1) michael@0: { michael@0: if (!mHookList.AppendObject(aOverrides)) michael@0: return NS_ERROR_FAILURE; michael@0: } michael@0: michael@0: return NS_OK; michael@0: } michael@0: michael@0: NS_IMETHODIMP michael@0: nsTransferableHookData::RemoveClipboardDragDropHooks( michael@0: nsIClipboardDragDropHooks *aOverrides) michael@0: { michael@0: NS_ENSURE_ARG(aOverrides); michael@0: if (!mHookList.RemoveObject(aOverrides)) michael@0: return NS_ERROR_FAILURE; michael@0: michael@0: return NS_OK; michael@0: } michael@0: michael@0: NS_IMETHODIMP michael@0: nsTransferableHookData::GetHookEnumerator(nsISimpleEnumerator **aResult) michael@0: { michael@0: return NS_NewArrayEnumerator(aResult, mHookList); michael@0: }