sbMediacoreWrapper.h
Go to the documentation of this file.
1 /*
2  *=BEGIN SONGBIRD GPL
3  *
4  * This file is part of the Songbird web player.
5  *
6  * Copyright(c) 2005-2010 POTI, Inc.
7  * http://www.songbirdnest.com
8  *
9  * This file may be licensed under the terms of of the
10  * GNU General Public License Version 2 (the ``GPL'').
11  *
12  * Software distributed under the License is distributed
13  * on an ``AS IS'' basis, WITHOUT WARRANTY OF ANY KIND, either
14  * express or implied. See the GPL for the specific language
15  * governing rights and limitations.
16  *
17  * You should have received a copy of the GPL along with this
18  * program. If not, go to http://www.gnu.org/licenses/gpl.html
19  * or write to the Free Software Foundation, Inc.,
20  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21  *
22  *=END SONGBIRD GPL
23  */
24 
30 #ifndef __SB_MEDIACOREWRAPPER_H__
31 #define __SB_MEDIACOREWRAPPER_H__
32 
33 #include <sbIMediacoreWrapper.h>
34 
35 #include <nsIClassInfo.h>
36 #include <nsIDOMDataContainerEvent.h>
37 #include <nsIDOMDocument.h>
38 #include <nsIDOMDocumentEvent.h>
39 #include <nsIDOMEventListener.h>
40 #include <nsIDOMEventTarget.h>
41 #include <nsIDOMWindow.h>
42 #include <nsIDOMWindowInternal.h>
43 
44 #include <sbIMediacoreCapabilities.h>
45 #include <sbIMediacoreEventTarget.h>
46 #include <sbIMediacoreSequencer.h>
47 #include <sbIMediacoreStatus.h>
48 #include <sbIMediacoreVotingParticipant.h>
49 #include <sbIPrompter.h>
50 
51 #include "sbBaseMediacore.h"
55 #include "sbMediacoreEvent.h"
56 
57 #include <nsAutoLock.h>
58 #include <nsCOMPtr.h>
59 #include <nsStringGlue.h>
60 
65  public sbIMediacoreWrapper,
66  public nsIDOMEventListener
67 {
68 public:
70  NS_DECL_NSICLASSINFO
71  NS_DECL_NSIDOMEVENTLISTENER
72 
73  NS_DECL_SBIMEDIACOREVOTINGPARTICIPANT
74  NS_DECL_SBIMEDIACOREWRAPPER
75 
76  NS_FORWARD_SAFE_SBIMEDIACOREEVENTTARGET(mBaseEventTarget)
77 
79 
80  nsresult Init();
81 
82  // sbBaseMediacore overrides
83  virtual nsresult OnInitBaseMediacore();
84  virtual nsresult OnGetCapabilities();
85  virtual nsresult OnShutdown();
86 
87  // sbBaseMediacorePlaybackControl overrides
88  virtual nsresult OnInitBaseMediacorePlaybackControl();
89  virtual nsresult OnSetUri(nsIURI *aURI);
90  virtual nsresult OnGetDuration(PRUint64 *aDuration);
91  virtual nsresult OnGetPosition(PRUint64 *aPosition);
92  virtual nsresult OnSetPosition(PRUint64 aPosition);
93  virtual nsresult OnGetIsPlayingAudio(PRBool *aIsPlayingAudio);
94  virtual nsresult OnGetIsPlayingVideo(PRBool *aIsPlayingVideo);
95  virtual nsresult OnPlay();
96  virtual nsresult OnPause();
97  virtual nsresult OnStop();
98  virtual nsresult OnSeek(PRUint64 aPosition, PRUint32 aFlag);
99 
100  // sbBaseMediacoreVolumeControl overrides
101  virtual nsresult OnInitBaseMediacoreVolumeControl();
102  virtual nsresult OnSetMute(PRBool aMute);
103  virtual nsresult OnSetVolume(PRFloat64 aVolume);
104 
105 private:
106  nsresult AddSelfDOMListener();
107  nsresult RemoveSelfDOMListener();
108 
109  nsresult SendDOMEvent(const nsAString &aEventName,
110  const nsAString &aEventData,
111  nsIDOMDataContainerEvent **aEvent = nsnull);
112 
113  nsresult SendDOMEvent(const nsAString &aEventName,
114  const nsACString &aEventData,
115  nsIDOMDataContainerEvent **aEvent = nsnull);
116 
117  nsresult GetRetvalFromEvent(nsIDOMDataContainerEvent *aEvent,
118  nsAString &aRetval);
119 
120  nsresult DispatchMediacoreEvent(PRUint32 aType,
121  nsIVariant *aData = nsnull,
122  sbIMediacoreError *aError = nsnull);
123 
124 protected:
125  virtual ~sbMediacoreWrapper();
126 
127  nsAutoPtr<sbBaseMediacoreEventTarget> mBaseEventTarget;
128 
129  nsCOMPtr<nsIDOMDocumentEvent> mDocumentEvent;
130  nsCOMPtr<nsIDOMEventTarget> mDOMEventTarget;
131 
133  nsCOMPtr<nsIDOMEventTarget> mProxiedDOMEventTarget;
134  nsCOMPtr<nsIDOMDocumentEvent> mProxiedDocumentEvent;
135 
136  nsCOMPtr<nsIDOMWindow> mPluginHostWindow;
137 
138  nsCOMPtr<sbIPrompter> mPrompter;
139 
140  PRPackedBool mWindowIsReady;
141 };
142 
143 #endif /* __SB_MEDIACOREWRAPPER_H__ */
virtual nsresult OnSetPosition(PRUint64 aPosition)
virtual nsresult OnGetCapabilities()
nsCOMPtr< nsIDOMEventTarget > mProxiedDOMEventTarget
Songbird Mediacore Event Definition.
virtual nsresult OnPause()
virtual nsresult OnSetMute(PRBool aMute)
PRMonitor * mProxiedObjectsMonitor
nsCOMPtr< nsIDOMEventTarget > mDOMEventTarget
virtual nsresult OnInitBaseMediacore()
Songbird Base Mediacore Definition.
virtual nsresult OnShutdown()
Songbird Mediacore Event Definition.
virtual nsresult OnPlay()
virtual nsresult OnGetDuration(PRUint64 *aDuration)
nsCOMPtr< sbIPrompter > mPrompter
virtual nsresult OnSeek(PRUint64 aPosition, PRUint32 aFlag)
virtual nsresult OnInitBaseMediacorePlaybackControl()
nsCOMPtr< nsIDOMWindow > mPluginHostWindow
virtual nsresult OnSetUri(nsIURI *aURI)
virtual nsresult OnGetIsPlayingVideo(PRBool *aIsPlayingVideo)
virtual nsresult OnInitBaseMediacoreVolumeControl()
PRPackedBool mWindowIsReady
virtual nsresult OnGetPosition(PRUint64 *aPosition)
virtual nsresult OnSetVolume(PRFloat64 aVolume)
nsCOMPtr< nsIDOMDocumentEvent > mDocumentEvent
nsAutoPtr< sbBaseMediacoreEventTarget > mBaseEventTarget
virtual nsresult OnGetIsPlayingAudio(PRBool *aIsPlayingAudio)
nsCOMPtr< nsIDOMDocumentEvent > mProxiedDocumentEvent
Songbird Base Mediacore Playback Control Definition.
virtual nsresult OnStop()
nsIDOMEventListener
NS_DECL_ISUPPORTS NS_DECL_NSICLASSINFO NS_DECL_NSIDOMEVENTLISTENER NS_DECL_SBIMEDIACOREVOTINGPARTICIPANT NS_DECL_SBIMEDIACOREWRAPPER sbMediacoreWrapper()
_updateTextAndScrollDataForFrame aData