xpcAccessibleGeneric.cpp (2065B)
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 /* vim: set ts=2 et sw=2 tw=80: */ 3 /* This Source Code Form is subject to the terms of the Mozilla Public 4 * License, v. 2.0. If a copy of the MPL was not distributed with this file, 5 * You can obtain one at http://mozilla.org/MPL/2.0/. */ 6 7 #include "xpcAccessibleGeneric.h" 8 9 #include "xpcAccessibleDocument.h" 10 11 using namespace mozilla::a11y; 12 13 //////////////////////////////////////////////////////////////////////////////// 14 // nsISupports 15 16 NS_INTERFACE_MAP_BEGIN(xpcAccessibleGeneric) 17 NS_INTERFACE_MAP_ENTRY(nsIAccessible) 18 NS_INTERFACE_MAP_ENTRY_CONDITIONAL(nsIAccessibleSelectable, 19 mSupportedIfaces & eSelectable) 20 NS_INTERFACE_MAP_ENTRY_CONDITIONAL(nsIAccessibleValue, 21 mSupportedIfaces & eValue) 22 NS_INTERFACE_MAP_ENTRY_CONDITIONAL(nsIAccessibleHyperLink, 23 mSupportedIfaces & eHyperLink) 24 NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIAccessible) 25 NS_INTERFACE_MAP_END 26 27 NS_IMPL_ADDREF(xpcAccessibleGeneric) 28 NS_IMPL_RELEASE(xpcAccessibleGeneric) 29 30 xpcAccessibleGeneric::~xpcAccessibleGeneric() { 31 if (!mIntl) { 32 return; 33 } 34 35 xpcAccessibleDocument* xpcDoc = nullptr; 36 if (mIntl->IsLocal()) { 37 LocalAccessible* acc = mIntl->AsLocal(); 38 if (!acc->IsDoc() && !acc->IsApplication()) { 39 xpcDoc = GetAccService()->GetXPCDocument(acc->Document()); 40 xpcDoc->NotifyOfShutdown(acc); 41 } 42 } else { 43 RemoteAccessible* proxy = mIntl->AsRemote(); 44 if (!proxy->IsDoc()) { 45 xpcDoc = GetAccService()->GetXPCDocument(proxy->Document()); 46 xpcDoc->NotifyOfShutdown(proxy); 47 } 48 } 49 } 50 51 //////////////////////////////////////////////////////////////////////////////// 52 // nsIAccessible 53 54 LocalAccessible* xpcAccessibleGeneric::ToInternalAccessible() { 55 return mIntl->AsLocal(); 56 } 57 58 //////////////////////////////////////////////////////////////////////////////// 59 // xpcAccessibleGeneric 60 61 void xpcAccessibleGeneric::Shutdown() { mIntl = nullptr; }