PageRenderTime 30ms CodeModel.GetById 13ms app.highlight 13ms RepoModel.GetById 1ms app.codeStats 0ms

/security/manager/ssl/src/nsSmartCardEvent.cpp

http://github.com/zpao/v8monkey
C++ | 258 lines | 176 code | 35 blank | 47 comment | 2 complexity | f4fee89f3cf24d9a1269cb5897f15ce9 MD5 | raw file
  1/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
  2/* ***** BEGIN LICENSE BLOCK *****
  3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
  4 *
  5 * The contents of this file are subject to the Mozilla Public License Version
  6 * 1.1 (the "License"); you may not use this file except in compliance with
  7 * the License. You may obtain a copy of the License at
  8 * http://www.mozilla.org/MPL/
  9 *
 10 * Software distributed under the License is distributed on an "AS IS" basis,
 11 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
 12 * for the specific language governing rights and limitations under the
 13 * License.
 14 *
 15 * The Original Code is the Red Hat Inc.
 16 *
 17 * The Initial Developer of the Original Code is
 18 * Red Hat, Inc.
 19 * Portions created by the Initial Developer are Copyright (C) 2005
 20 * the Initial Developer. All Rights Reserved.
 21 *
 22 * Contributor(s):
 23 *     Robert Relyea <rrelyea@redhat.com>
 24 *
 25 * Alternatively, the contents of this file may be used under the terms of
 26 * either the GNU General Public License Version 2 or later (the "GPL"), or
 27 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
 28 * in which case the provisions of the GPL or the LGPL are applicable instead
 29 * of those above. If you wish to allow use of your version of this file only
 30 * under the terms of either the GPL or the LGPL, and not to allow others to
 31 * use your version of this file under the terms of the MPL, indicate your
 32 * decision by deleting the provisions above and replace them with the notice
 33 * and other provisions required by the GPL or the LGPL. If you do not delete
 34 * the provisions above, a recipient may use your version of this file under
 35 * the terms of any one of the MPL, the GPL or the LGPL.
 36 *
 37 * ***** END LICENSE BLOCK ***** */
 38#include "nsSmartCardEvent.h"
 39#include "nsIDOMSmartCardEvent.h"
 40#include "nsIDOMClassInfo.h"
 41#include "nsIDOMNSEvent.h"
 42#include "nsIDOMEvent.h"
 43#include "nsXPCOM.h"
 44
 45// DOM event class to handle progress notifications
 46nsSmartCardEvent::nsSmartCardEvent(const nsAString &aTokenName) 
 47    : mInner(nsnull), mPrivate(nsnull), mTokenName(aTokenName)
 48{
 49}
 50
 51nsSmartCardEvent::~nsSmartCardEvent()
 52{}
 53
 54//NS_DECL_DOM_CLASSINFO(SmartCardEvent)
 55
 56// QueryInterface implementation for nsXMLHttpRequest
 57NS_INTERFACE_MAP_BEGIN(nsSmartCardEvent)
 58  NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMSmartCardEvent)
 59  NS_INTERFACE_MAP_ENTRY(nsIDOMSmartCardEvent)
 60  NS_INTERFACE_MAP_ENTRY(nsIDOMNSEvent)
 61  NS_INTERFACE_MAP_ENTRY(nsIDOMEvent)
 62  NS_INTERFACE_MAP_ENTRY(nsIPrivateDOMEvent)
 63  NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(SmartCardEvent)
 64NS_INTERFACE_MAP_END
 65
 66NS_IMPL_ADDREF(nsSmartCardEvent)
 67NS_IMPL_RELEASE(nsSmartCardEvent)
 68
 69//
 70// Init must be called before we do anything with the event.
 71//
 72NS_IMETHODIMP nsSmartCardEvent::Init(nsIDOMEvent * aInner)
 73{
 74  nsresult rv;
 75
 76  NS_ASSERTION(aInner, "SmartCardEvent initialized with a null Event");
 77  mInner = aInner;
 78  mPrivate = do_QueryInterface(mInner, &rv);
 79  if (NS_FAILED(rv)) {
 80    return rv;
 81  }
 82  mNSEvent = do_QueryInterface(mInner, &rv);
 83  if (NS_FAILED(rv)) {
 84    return rv;
 85  }
 86  return mPrivate->SetTrusted(true);
 87}
 88
 89// nsSmartCard Specific methods
 90NS_IMETHODIMP nsSmartCardEvent::GetTokenName(nsAString &aTokenName)
 91{
 92  aTokenName = mTokenName;
 93  return NS_OK;
 94}
 95
 96// nsIPrivateDOMEvent maps
 97NS_IMETHODIMP nsSmartCardEvent::DuplicatePrivateData(void)
 98{
 99  NS_ASSERTION(mPrivate, "SmartCardEvent called without Init");
100  return mPrivate->DuplicatePrivateData();
101}
102
103NS_IMETHODIMP nsSmartCardEvent::SetTarget(nsIDOMEventTarget *aTarget)
104{
105  NS_ASSERTION(mPrivate, "SmartCardEvent called without Init");
106  return mPrivate->SetTarget(aTarget);
107}
108
109NS_IMETHODIMP_(bool ) nsSmartCardEvent::IsDispatchStopped()
110{
111  NS_ASSERTION(mPrivate, "SmartCardEvent called without Init");
112  return mPrivate->IsDispatchStopped();
113}
114
115NS_IMETHODIMP_(nsEvent*) nsSmartCardEvent::GetInternalNSEvent()
116{
117  NS_ASSERTION(mPrivate, "SmartCardEvent called without Init");
118  return mPrivate->GetInternalNSEvent();
119}
120
121NS_IMETHODIMP nsSmartCardEvent::SetTrusted(bool aResult)
122{
123  NS_ASSERTION(mPrivate, "SmartCardEvent called without Init");
124  return mPrivate->SetTrusted(aResult);
125}
126
127void
128nsSmartCardEvent::Serialize(IPC::Message* aMsg,
129                            bool aSerializeInterfaceType)
130{
131  NS_ASSERTION(mPrivate, "SmartCardEvent called without Init");
132  mPrivate->Serialize(aMsg, aSerializeInterfaceType);
133}
134
135bool
136nsSmartCardEvent::Deserialize(const IPC::Message* aMsg, void** aIter)
137{
138  NS_ASSERTION(mPrivate, "SmartCardEvent called without Init");
139  return mPrivate->Deserialize(aMsg, aIter);
140}
141
142// IDOMNSEvent maps
143NS_IMETHODIMP nsSmartCardEvent::GetOriginalTarget(nsIDOMEventTarget * *aOriginalTarget)
144{
145  NS_ASSERTION(mNSEvent, "SmartCardEvent called without Init");
146  return mNSEvent->GetOriginalTarget(aOriginalTarget);
147}
148
149NS_IMETHODIMP nsSmartCardEvent::GetExplicitOriginalTarget(nsIDOMEventTarget * *aTarget)
150{
151  NS_ASSERTION(mNSEvent, "SmartCardEvent called without Init");
152  return mNSEvent->GetExplicitOriginalTarget(aTarget);
153}
154
155NS_IMETHODIMP nsSmartCardEvent::GetTmpRealOriginalTarget(nsIDOMEventTarget * *aTarget)
156{
157  NS_ASSERTION(mNSEvent, "SmartCardEvent called without Init");
158  return mNSEvent->GetTmpRealOriginalTarget(aTarget);
159}
160
161NS_IMETHODIMP nsSmartCardEvent::PreventBubble(void)
162{
163  NS_ASSERTION(mNSEvent, "SmartCardEvent called without Init");
164  return mNSEvent->PreventBubble();
165}
166
167NS_IMETHODIMP nsSmartCardEvent::PreventCapture(void)
168{
169  NS_ASSERTION(mNSEvent, "SmartCardEvent called without Init");
170  return mNSEvent->PreventCapture();
171}
172
173NS_IMETHODIMP nsSmartCardEvent::GetIsTrusted(bool *aIsTrusted)
174{
175  NS_ASSERTION(mNSEvent, "SmartCardEvent called without Init");
176  return mNSEvent->GetIsTrusted(aIsTrusted);
177}
178
179NS_IMETHODIMP
180nsSmartCardEvent::GetPreventDefault(bool* aReturn)
181{
182  NS_ASSERTION(mNSEvent, "SmartCardEvent called without Init");
183  return mNSEvent->GetPreventDefault(aReturn);
184}
185
186// IDOMEvent maps
187NS_IMETHODIMP nsSmartCardEvent::GetType(nsAString & aType)
188{
189  NS_ASSERTION(mInner, "SmartCardEvent called without Init");
190  return mInner->GetType(aType);
191}
192
193NS_IMETHODIMP nsSmartCardEvent::GetTarget(nsIDOMEventTarget * *aTarget)
194{
195  NS_ASSERTION(mInner, "SmartCardEvent called without Init");
196  return mInner->GetTarget(aTarget);
197}
198
199NS_IMETHODIMP nsSmartCardEvent::GetCurrentTarget(nsIDOMEventTarget * *aCurrentTarget)
200{
201  NS_ASSERTION(mInner, "SmartCardEvent called without Init");
202  return mInner->GetCurrentTarget(aCurrentTarget);
203}
204
205NS_IMETHODIMP nsSmartCardEvent::GetEventPhase(PRUint16 *aEventPhase)
206{
207  NS_ASSERTION(mInner, "SmartCardEvent called without Init");
208  return mInner->GetEventPhase(aEventPhase);
209}
210
211NS_IMETHODIMP nsSmartCardEvent::GetBubbles(bool *aBubbles)
212{
213  NS_ASSERTION(mInner, "SmartCardEvent called without Init");
214  return mInner->GetBubbles(aBubbles);
215}
216
217NS_IMETHODIMP nsSmartCardEvent::GetCancelable(bool *aCancelable)
218{
219  NS_ASSERTION(mInner, "SmartCardEvent called without Init");
220  return mInner->GetCancelable(aCancelable);
221}
222
223NS_IMETHODIMP nsSmartCardEvent::GetTimeStamp(DOMTimeStamp *aTimeStamp)
224{
225  NS_ASSERTION(mInner, "SmartCardEvent called without Init");
226  return mInner->GetTimeStamp(aTimeStamp);
227}
228
229NS_IMETHODIMP nsSmartCardEvent::StopPropagation()
230{
231  NS_ASSERTION(mInner, "SmartCardEvent called without Init");
232  return mInner->StopPropagation();
233}
234
235NS_IMETHODIMP nsSmartCardEvent::StopImmediatePropagation()
236{
237  NS_ASSERTION(mInner, "SmartCardEvent called without Init");
238  return mInner->StopImmediatePropagation();
239}
240
241NS_IMETHODIMP nsSmartCardEvent::PreventDefault()
242{
243  NS_ASSERTION(mInner, "SmartCardEvent called without Init");
244  return mInner->PreventDefault();
245}
246
247NS_IMETHODIMP nsSmartCardEvent::GetDefaultPrevented(bool* aReturn)
248{
249  NS_ASSERTION(mInner, "SmartCardEvent called without Init");
250  return mInner->GetDefaultPrevented(aReturn);
251}
252
253NS_IMETHODIMP nsSmartCardEvent::InitEvent(const nsAString & eventTypeArg, bool canBubbleArg, bool cancelableArg)
254{
255  NS_ASSERTION(mInner, "SmartCardEvent called without Init");
256  return mInner->InitEvent(eventTypeArg, canBubbleArg, cancelableArg);
257}
258