Back to index

lightning-sunbird  0.9+nobinonly
nsSmartCardEvent.cpp
Go to the documentation of this file.
00001 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
00002 /* ***** BEGIN LICENSE BLOCK *****
00003  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
00004  *
00005  * The contents of this file are subject to the Mozilla Public License Version
00006  * 1.1 (the "License"); you may not use this file except in compliance with
00007  * the License. You may obtain a copy of the License at
00008  * http://www.mozilla.org/MPL/
00009  *
00010  * Software distributed under the License is distributed on an "AS IS" basis,
00011  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00012  * for the specific language governing rights and limitations under the
00013  * License.
00014  *
00015  * The Original Code is the Red Hat Inc.
00016  *
00017  * The Initial Developer of the Original Code is
00018  * Red Hat, Inc.
00019  * Portions created by the Initial Developer are Copyright (C) 2005
00020  * the Initial Developer. All Rights Reserved.
00021  *
00022  * Contributor(s):
00023  *     Robert Relyea <rrelyea@redhat.com>
00024  *
00025  * Alternatively, the contents of this file may be used under the terms of
00026  * either the GNU General Public License Version 2 or later (the "GPL"), or
00027  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
00028  * in which case the provisions of the GPL or the LGPL are applicable instead
00029  * of those above. If you wish to allow use of your version of this file only
00030  * under the terms of either the GPL or the LGPL, and not to allow others to
00031  * use your version of this file under the terms of the MPL, indicate your
00032  * decision by deleting the provisions above and replace them with the notice
00033  * and other provisions required by the GPL or the LGPL. If you do not delete
00034  * the provisions above, a recipient may use your version of this file under
00035  * the terms of any one of the MPL, the GPL or the LGPL.
00036  *
00037  * ***** END LICENSE BLOCK ***** */
00038 #include "nsSmartCardEvent.h"
00039 #include "nsIDOMSmartCardEvent.h"
00040 #include "nsIDOMClassInfo.h"
00041 #include "nsIDOMNSEvent.h"
00042 #include "nsIDOMEvent.h"
00043 #include "nsXPCOM.h"
00044 
00045 // DOM event class to handle progress notifications
00046 nsSmartCardEvent::nsSmartCardEvent(const nsAString &aTokenName) 
00047     : mTokenName(aTokenName), mInner(nsnull), mPrivate(nsnull)
00048 {
00049 }
00050 
00051 nsSmartCardEvent::~nsSmartCardEvent()
00052 {}
00053 
00054 //NS_DECL_DOM_CLASSINFO(SmartCardEvent)
00055 
00056 // QueryInterface implementation for nsXMLHttpRequest
00057 NS_INTERFACE_MAP_BEGIN(nsSmartCardEvent)
00058   NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMSmartCardEvent)
00059   NS_INTERFACE_MAP_ENTRY(nsIDOMSmartCardEvent)
00060   NS_INTERFACE_MAP_ENTRY(nsIDOMNSEvent)
00061   NS_INTERFACE_MAP_ENTRY(nsIDOMEvent)
00062   NS_INTERFACE_MAP_ENTRY(nsIPrivateDOMEvent)
00063   NS_INTERFACE_MAP_ENTRY_DOM_CLASSINFO(SmartCardEvent)
00064 NS_INTERFACE_MAP_END
00065 
00066 NS_IMPL_ADDREF(nsSmartCardEvent)
00067 NS_IMPL_RELEASE(nsSmartCardEvent)
00068 
00069 //
00070 // Init must be called before we do anything with the event.
00071 //
00072 NS_IMETHODIMP nsSmartCardEvent::Init(nsIDOMEvent * aInner)
00073 {
00074   nsresult rv;
00075 
00076   NS_ASSERTION(aInner, "SmartCardEvent initialized with a null Event");
00077   mInner = aInner;
00078   mPrivate = do_QueryInterface(mInner, &rv);
00079   if (NS_FAILED(rv)) {
00080     return rv;
00081   }
00082   mNSEvent = do_QueryInterface(mInner, &rv);
00083   if (NS_FAILED(rv)) {
00084     return rv;
00085   }
00086   return mPrivate->SetTrusted(PR_TRUE);
00087 }
00088 
00089 // nsSmartCard Specific methods
00090 NS_IMETHODIMP nsSmartCardEvent::GetTokenName(nsAString &aTokenName)
00091 {
00092   aTokenName = mTokenName;
00093   return NS_OK;
00094 }
00095 
00096 // nsIPrivateDOMEvent maps
00097 NS_IMETHODIMP nsSmartCardEvent::DuplicatePrivateData(void)
00098 {
00099   NS_ASSERTION(mPrivate, "SmartCardEvent called without Init");
00100   return mPrivate->DuplicatePrivateData();
00101 }
00102 
00103 NS_IMETHODIMP nsSmartCardEvent::SetTarget(nsIDOMEventTarget *aTarget)
00104 {
00105   NS_ASSERTION(mPrivate, "SmartCardEvent called without Init");
00106   return mPrivate->SetTarget(aTarget);
00107 }
00108 
00109 NS_IMETHODIMP nsSmartCardEvent::SetCurrentTarget(nsIDOMEventTarget *aTarget)
00110 {
00111   NS_ASSERTION(mPrivate, "SmartCardEvent called without Init");
00112   return mPrivate->SetCurrentTarget(aTarget);
00113 }
00114 
00115 NS_IMETHODIMP nsSmartCardEvent::SetOriginalTarget(nsIDOMEventTarget *aTarget)
00116 {
00117   NS_ASSERTION(mPrivate, "SmartCardEvent called without Init");
00118   return mPrivate->SetOriginalTarget(aTarget);
00119 }
00120 
00121 NS_IMETHODIMP nsSmartCardEvent::IsDispatchStopped(PRBool *aIsDispatchPrevented)
00122 {
00123   NS_ASSERTION(mPrivate, "SmartCardEvent called without Init");
00124   return mPrivate->IsDispatchStopped(aIsDispatchPrevented);
00125 }
00126 
00127 NS_IMETHODIMP nsSmartCardEvent::GetInternalNSEvent(nsEvent** aNSEvent)
00128 {
00129   NS_ASSERTION(mPrivate, "SmartCardEvent called without Init");
00130   return mPrivate->GetInternalNSEvent(aNSEvent);
00131 }
00132 
00133 NS_IMETHODIMP nsSmartCardEvent::HasOriginalTarget(PRBool *aResult)
00134 {
00135   NS_ASSERTION(mPrivate, "SmartCardEvent called without Init");
00136   return mPrivate->HasOriginalTarget(aResult);
00137 }
00138 
00139 NS_IMETHODIMP nsSmartCardEvent::SetTrusted(PRBool aResult)
00140 {
00141   NS_ASSERTION(mPrivate, "SmartCardEvent called without Init");
00142   return mPrivate->SetTrusted(aResult);
00143 }
00144 
00145 
00146 // IDOMNSEvent maps
00147 NS_IMETHODIMP nsSmartCardEvent::GetOriginalTarget(nsIDOMEventTarget * *aOriginalTarget)
00148 {
00149   NS_ASSERTION(mNSEvent, "SmartCardEvent called without Init");
00150   return mNSEvent->GetOriginalTarget(aOriginalTarget);
00151 }
00152 
00153 NS_IMETHODIMP nsSmartCardEvent::GetExplicitOriginalTarget(nsIDOMEventTarget * *aTarget)
00154 {
00155   NS_ASSERTION(mNSEvent, "SmartCardEvent called without Init");
00156   return mNSEvent->GetExplicitOriginalTarget(aTarget);
00157 }
00158 
00159 NS_IMETHODIMP nsSmartCardEvent::GetTmpRealOriginalTarget(nsIDOMEventTarget * *aTarget)
00160 {
00161   NS_ASSERTION(mNSEvent, "SmartCardEvent called without Init");
00162   return mNSEvent->GetTmpRealOriginalTarget(aTarget);
00163 }
00164 
00165 NS_IMETHODIMP nsSmartCardEvent::PreventBubble(void)
00166 {
00167   NS_ASSERTION(mNSEvent, "SmartCardEvent called without Init");
00168   return mNSEvent->PreventBubble();
00169 }
00170 
00171 NS_IMETHODIMP nsSmartCardEvent::PreventCapture(void)
00172 {
00173   NS_ASSERTION(mNSEvent, "SmartCardEvent called without Init");
00174   return mNSEvent->PreventCapture();
00175 }
00176 
00177 NS_IMETHODIMP nsSmartCardEvent::GetIsTrusted(PRBool *aIsTrusted)
00178 {
00179   NS_ASSERTION(mNSEvent, "SmartCardEvent called without Init");
00180   return mNSEvent->GetIsTrusted(aIsTrusted);
00181 }
00182 
00183 
00184 // IDOMEvent maps
00185 NS_IMETHODIMP nsSmartCardEvent::GetType(nsAString & aType)
00186 {
00187   NS_ASSERTION(mInner, "SmartCardEvent called without Init");
00188   return mInner->GetType(aType);
00189 }
00190 
00191 NS_IMETHODIMP nsSmartCardEvent::GetTarget(nsIDOMEventTarget * *aTarget)
00192 {
00193   NS_ASSERTION(mInner, "SmartCardEvent called without Init");
00194   return mInner->GetTarget(aTarget);
00195 }
00196 
00197 NS_IMETHODIMP nsSmartCardEvent::GetCurrentTarget(nsIDOMEventTarget * *aCurrentTarget)
00198 {
00199   NS_ASSERTION(mInner, "SmartCardEvent called without Init");
00200   return mInner->GetCurrentTarget(aCurrentTarget);
00201 }
00202 
00203 NS_IMETHODIMP nsSmartCardEvent::GetEventPhase(PRUint16 *aEventPhase)
00204 {
00205   NS_ASSERTION(mInner, "SmartCardEvent called without Init");
00206   return mInner->GetEventPhase(aEventPhase);
00207 }
00208 
00209 NS_IMETHODIMP nsSmartCardEvent::GetBubbles(PRBool *aBubbles)
00210 {
00211   NS_ASSERTION(mInner, "SmartCardEvent called without Init");
00212   return mInner->GetBubbles(aBubbles);
00213 }
00214 
00215 NS_IMETHODIMP nsSmartCardEvent::GetCancelable(PRBool *aCancelable)
00216 {
00217   NS_ASSERTION(mInner, "SmartCardEvent called without Init");
00218   return mInner->GetCancelable(aCancelable);
00219 }
00220 
00221 NS_IMETHODIMP nsSmartCardEvent::GetTimeStamp(DOMTimeStamp *aTimeStamp)
00222 {
00223   NS_ASSERTION(mInner, "SmartCardEvent called without Init");
00224   return mInner->GetTimeStamp(aTimeStamp);
00225 }
00226 
00227 NS_IMETHODIMP nsSmartCardEvent::StopPropagation()
00228 {
00229   NS_ASSERTION(mInner, "SmartCardEvent called without Init");
00230   return mInner->StopPropagation();
00231 }
00232 
00233 NS_IMETHODIMP nsSmartCardEvent::PreventDefault()
00234 {
00235   NS_ASSERTION(mInner, "SmartCardEvent called without Init");
00236   return mInner->PreventDefault();
00237 }
00238 
00239 NS_IMETHODIMP nsSmartCardEvent::InitEvent(const nsAString & eventTypeArg, PRBool canBubbleArg, PRBool cancelableArg)
00240 {
00241   NS_ASSERTION(mInner, "SmartCardEvent called without Init");
00242   return mInner->InitEvent(eventTypeArg, canBubbleArg, cancelableArg);
00243 }
00244