Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 #include "nsDocShellTransferableHooks.h"
6 #include "nsIClipboardDragDropHooks.h"
7 #include "nsIClipboardDragDropHookList.h"
8 #include "nsArrayEnumerator.h"
10 nsTransferableHookData::nsTransferableHookData()
11 {
12 }
15 nsTransferableHookData::~nsTransferableHookData()
16 {
17 }
19 //*****************************************************************************
20 // nsIClipboardDragDropHookList
21 //*****************************************************************************
23 NS_IMPL_ISUPPORTS(nsTransferableHookData, nsIClipboardDragDropHookList)
25 NS_IMETHODIMP
26 nsTransferableHookData::AddClipboardDragDropHooks(
27 nsIClipboardDragDropHooks *aOverrides)
28 {
29 NS_ENSURE_ARG(aOverrides);
31 // don't let a hook be added more than once
32 if (mHookList.IndexOfObject(aOverrides) == -1)
33 {
34 if (!mHookList.AppendObject(aOverrides))
35 return NS_ERROR_FAILURE;
36 }
38 return NS_OK;
39 }
41 NS_IMETHODIMP
42 nsTransferableHookData::RemoveClipboardDragDropHooks(
43 nsIClipboardDragDropHooks *aOverrides)
44 {
45 NS_ENSURE_ARG(aOverrides);
46 if (!mHookList.RemoveObject(aOverrides))
47 return NS_ERROR_FAILURE;
49 return NS_OK;
50 }
52 NS_IMETHODIMP
53 nsTransferableHookData::GetHookEnumerator(nsISimpleEnumerator **aResult)
54 {
55 return NS_NewArrayEnumerator(aResult, mHookList);
56 }