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 mozilla.org code.
16 : *
17 : * The Initial Developer of the Original Code is
18 : * Netscape Communications Corporation.
19 : * Portions created by the Initial Developer are Copyright (C) 1998
20 : * the Initial Developer. All Rights Reserved.
21 : *
22 : * Contributor(s):
23 : * Steve Clark (buster@netscape.com)
24 : * Ilya Konstantinov (mozilla-code@future.shiny.co.il)
25 : *
26 : * Alternatively, the contents of this file may be used under the terms of
27 : * either the GNU General Public License Version 2 or later (the "GPL"), or
28 : * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
29 : * in which case the provisions of the GPL or the LGPL are applicable instead
30 : * of those above. If you wish to allow use of your version of this file only
31 : * under the terms of either the GPL or the LGPL, and not to allow others to
32 : * use your version of this file under the terms of the MPL, indicate your
33 : * decision by deleting the provisions above and replace them with the notice
34 : * and other provisions required by the GPL or the LGPL. If you do not delete
35 : * the provisions above, a recipient may use your version of this file under
36 : * the terms of any one of the MPL, the GPL or the LGPL.
37 : *
38 : * ***** END LICENSE BLOCK ***** */
39 :
40 : #include "nsDOMPopupBlockedEvent.h"
41 : #include "nsIURI.h"
42 : #include "nsContentUtils.h"
43 :
44 0 : NS_IMPL_ADDREF_INHERITED(nsDOMPopupBlockedEvent, nsDOMEvent)
45 0 : NS_IMPL_RELEASE_INHERITED(nsDOMPopupBlockedEvent, nsDOMEvent)
46 :
47 : DOMCI_DATA(PopupBlockedEvent, nsDOMPopupBlockedEvent)
48 :
49 0 : NS_INTERFACE_MAP_BEGIN(nsDOMPopupBlockedEvent)
50 0 : NS_INTERFACE_MAP_ENTRY(nsIDOMPopupBlockedEvent)
51 0 : NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(PopupBlockedEvent)
52 0 : NS_INTERFACE_MAP_END_INHERITING(nsDOMEvent)
53 :
54 : NS_IMETHODIMP
55 0 : nsDOMPopupBlockedEvent::InitPopupBlockedEvent(const nsAString & aTypeArg,
56 : bool aCanBubbleArg, bool aCancelableArg,
57 : nsIDOMWindow *aRequestingWindow,
58 : nsIURI *aPopupWindowURI,
59 : const nsAString & aPopupWindowName,
60 : const nsAString & aPopupWindowFeatures)
61 : {
62 0 : nsresult rv = nsDOMEvent::InitEvent(aTypeArg, aCanBubbleArg, aCancelableArg);
63 0 : NS_ENSURE_SUCCESS(rv, rv);
64 :
65 0 : mRequestingWindow = do_GetWeakReference(aRequestingWindow);
66 0 : mPopupWindowURI = aPopupWindowURI;
67 0 : mPopupWindowFeatures = aPopupWindowFeatures;
68 0 : mPopupWindowName = aPopupWindowName;
69 0 : return NS_OK;
70 : }
71 :
72 : NS_IMETHODIMP
73 0 : nsDOMPopupBlockedEvent::GetRequestingWindow(nsIDOMWindow **aRequestingWindow)
74 : {
75 0 : *aRequestingWindow = nsnull;
76 0 : if (mRequestingWindow)
77 0 : CallQueryReferent(mRequestingWindow.get(), aRequestingWindow);
78 :
79 0 : return NS_OK; // Don't throw an exception
80 : }
81 :
82 : NS_IMETHODIMP
83 0 : nsDOMPopupBlockedEvent::GetPopupWindowURI(nsIURI **aPopupWindowURI)
84 : {
85 0 : NS_ENSURE_ARG_POINTER(aPopupWindowURI);
86 :
87 0 : *aPopupWindowURI = mPopupWindowURI;
88 0 : NS_IF_ADDREF(*aPopupWindowURI);
89 0 : return NS_OK; // Don't throw an exception
90 : }
91 :
92 : NS_IMETHODIMP
93 0 : nsDOMPopupBlockedEvent::GetPopupWindowFeatures(nsAString &aPopupWindowFeatures)
94 : {
95 :
96 0 : aPopupWindowFeatures = mPopupWindowFeatures;
97 0 : return NS_OK; // Don't throw an exception
98 : }
99 :
100 : NS_IMETHODIMP
101 0 : nsDOMPopupBlockedEvent::GetPopupWindowName(nsAString &aPopupWindowName)
102 : {
103 0 : aPopupWindowName = mPopupWindowName;
104 0 : return NS_OK; // Don't throw an exception
105 : }
106 :
107 0 : nsresult NS_NewDOMPopupBlockedEvent(nsIDOMEvent** aInstancePtrResult,
108 : nsPresContext* aPresContext,
109 : nsEvent *aEvent)
110 : {
111 0 : nsDOMPopupBlockedEvent* it = new nsDOMPopupBlockedEvent(aPresContext, aEvent);
112 0 : if (nsnull == it) {
113 0 : return NS_ERROR_OUT_OF_MEMORY;
114 : }
115 :
116 0 : return CallQueryInterface(it, aInstancePtrResult);
117 : }
|