OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 14 matching lines...) Expand all Loading... |
25 | 25 |
26 #ifndef RTCDTMFSender_h | 26 #ifndef RTCDTMFSender_h |
27 #define RTCDTMFSender_h | 27 #define RTCDTMFSender_h |
28 | 28 |
29 #include "core/dom/ActiveDOMObject.h" | 29 #include "core/dom/ActiveDOMObject.h" |
30 #include "modules/EventTargetModules.h" | 30 #include "modules/EventTargetModules.h" |
31 #include "platform/Timer.h" | 31 #include "platform/Timer.h" |
32 #include "public/platform/WebRTCDTMFSenderHandlerClient.h" | 32 #include "public/platform/WebRTCDTMFSenderHandlerClient.h" |
33 | 33 |
34 namespace blink { | 34 namespace blink { |
35 class WebRTCDTMFSenderHandler; | |
36 class WebRTCPeerConnectionHandler; | |
37 } | |
38 | |
39 namespace blink { | |
40 | 35 |
41 class ExceptionState; | 36 class ExceptionState; |
42 class MediaStreamTrack; | 37 class MediaStreamTrack; |
| 38 class WebRTCDTMFSenderHandler; |
| 39 class WebRTCPeerConnectionHandler; |
43 | 40 |
44 class RTCDTMFSender FINAL | 41 class RTCDTMFSender FINAL |
45 : public RefCountedGarbageCollectedWillBeGarbageCollectedFinalized<RTCDTMFSe
nder> | 42 : public RefCountedGarbageCollectedWillBeGarbageCollectedFinalized<RTCDTMFSe
nder> |
46 , public EventTargetWithInlineData | 43 , public EventTargetWithInlineData |
47 , public blink::WebRTCDTMFSenderHandlerClient | 44 , public WebRTCDTMFSenderHandlerClient |
48 , public ActiveDOMObject { | 45 , public ActiveDOMObject { |
49 DEFINE_EVENT_TARGET_REFCOUNTING_WILL_BE_REMOVED(RefCountedGarbageCollectedWi
llBeGarbageCollectedFinalized<RTCDTMFSender>); | 46 DEFINE_EVENT_TARGET_REFCOUNTING_WILL_BE_REMOVED(RefCountedGarbageCollectedWi
llBeGarbageCollectedFinalized<RTCDTMFSender>); |
50 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(RTCDTMFSender); | 47 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(RTCDTMFSender); |
51 public: | 48 public: |
52 static RTCDTMFSender* create(ExecutionContext*, blink::WebRTCPeerConnectionH
andler*, MediaStreamTrack*, ExceptionState&); | 49 static RTCDTMFSender* create(ExecutionContext*, WebRTCPeerConnectionHandler*
, MediaStreamTrack*, ExceptionState&); |
53 virtual ~RTCDTMFSender(); | 50 virtual ~RTCDTMFSender(); |
54 | 51 |
55 bool canInsertDTMF() const; | 52 bool canInsertDTMF() const; |
56 MediaStreamTrack* track() const; | 53 MediaStreamTrack* track() const; |
57 String toneBuffer() const; | 54 String toneBuffer() const; |
58 long duration() const { return m_duration; } | 55 long duration() const { return m_duration; } |
59 long interToneGap() const { return m_interToneGap; } | 56 long interToneGap() const { return m_interToneGap; } |
60 | 57 |
61 void insertDTMF(const String& tones, ExceptionState&); | 58 void insertDTMF(const String& tones, ExceptionState&); |
62 void insertDTMF(const String& tones, long duration, ExceptionState&); | 59 void insertDTMF(const String& tones, long duration, ExceptionState&); |
63 void insertDTMF(const String& tones, long duration, long interToneGap, Excep
tionState&); | 60 void insertDTMF(const String& tones, long duration, long interToneGap, Excep
tionState&); |
64 | 61 |
65 DEFINE_ATTRIBUTE_EVENT_LISTENER(tonechange); | 62 DEFINE_ATTRIBUTE_EVENT_LISTENER(tonechange); |
66 | 63 |
67 // EventTarget | 64 // EventTarget |
68 virtual const AtomicString& interfaceName() const OVERRIDE; | 65 virtual const AtomicString& interfaceName() const OVERRIDE; |
69 virtual ExecutionContext* executionContext() const OVERRIDE; | 66 virtual ExecutionContext* executionContext() const OVERRIDE; |
70 | 67 |
71 // ActiveDOMObject | 68 // ActiveDOMObject |
72 virtual void stop() OVERRIDE; | 69 virtual void stop() OVERRIDE; |
73 | 70 |
74 virtual void trace(Visitor*) OVERRIDE; | 71 virtual void trace(Visitor*) OVERRIDE; |
75 | 72 |
76 private: | 73 private: |
77 RTCDTMFSender(ExecutionContext*, MediaStreamTrack*, PassOwnPtr<blink::WebRTC
DTMFSenderHandler>); | 74 RTCDTMFSender(ExecutionContext*, MediaStreamTrack*, PassOwnPtr<WebRTCDTMFSen
derHandler>); |
78 | 75 |
79 void scheduleDispatchEvent(PassRefPtrWillBeRawPtr<Event>); | 76 void scheduleDispatchEvent(PassRefPtrWillBeRawPtr<Event>); |
80 void scheduledEventTimerFired(Timer<RTCDTMFSender>*); | 77 void scheduledEventTimerFired(Timer<RTCDTMFSender>*); |
81 | 78 |
82 // blink::WebRTCDTMFSenderHandlerClient | 79 // WebRTCDTMFSenderHandlerClient |
83 virtual void didPlayTone(const blink::WebString&) OVERRIDE; | 80 virtual void didPlayTone(const WebString&) OVERRIDE; |
84 | 81 |
85 Member<MediaStreamTrack> m_track; | 82 Member<MediaStreamTrack> m_track; |
86 long m_duration; | 83 long m_duration; |
87 long m_interToneGap; | 84 long m_interToneGap; |
88 | 85 |
89 OwnPtr<blink::WebRTCDTMFSenderHandler> m_handler; | 86 OwnPtr<WebRTCDTMFSenderHandler> m_handler; |
90 | 87 |
91 bool m_stopped; | 88 bool m_stopped; |
92 | 89 |
93 Timer<RTCDTMFSender> m_scheduledEventTimer; | 90 Timer<RTCDTMFSender> m_scheduledEventTimer; |
94 WillBeHeapVector<RefPtrWillBeMember<Event> > m_scheduledEvents; | 91 WillBeHeapVector<RefPtrWillBeMember<Event> > m_scheduledEvents; |
95 }; | 92 }; |
96 | 93 |
97 } // namespace blink | 94 } // namespace blink |
98 | 95 |
99 #endif // RTCDTMFSender_h | 96 #endif // RTCDTMFSender_h |
OLD | NEW |