Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(579)

Side by Side Diff: Source/modules/mediastream/RTCDTMFSender.cpp

Issue 24469004: Amusingly deprecate the generic version of 'ExceptionState::throwDOMException'. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 29 matching lines...) Expand all
40 static const long defaultToneDurationMs = 100; 40 static const long defaultToneDurationMs = 100;
41 static const long maxToneDurationMs = 6000; 41 static const long maxToneDurationMs = 6000;
42 static const long minInterToneGapMs = 50; 42 static const long minInterToneGapMs = 50;
43 static const long defaultInterToneGapMs = 50; 43 static const long defaultInterToneGapMs = 50;
44 44
45 PassRefPtr<RTCDTMFSender> RTCDTMFSender::create(ScriptExecutionContext* context, RTCPeerConnectionHandler* peerConnectionHandler, PassRefPtr<MediaStreamTrack> p rpTrack, ExceptionState& es) 45 PassRefPtr<RTCDTMFSender> RTCDTMFSender::create(ScriptExecutionContext* context, RTCPeerConnectionHandler* peerConnectionHandler, PassRefPtr<MediaStreamTrack> p rpTrack, ExceptionState& es)
46 { 46 {
47 RefPtr<MediaStreamTrack> track = prpTrack; 47 RefPtr<MediaStreamTrack> track = prpTrack;
48 OwnPtr<RTCDTMFSenderHandler> handler = peerConnectionHandler->createDTMFSend er(track->component()); 48 OwnPtr<RTCDTMFSenderHandler> handler = peerConnectionHandler->createDTMFSend er(track->component());
49 if (!handler) { 49 if (!handler) {
50 es.throwDOMException(NotSupportedError); 50 es.throwUninformativeAndGenericDOMException(NotSupportedError);
51 return 0; 51 return 0;
52 } 52 }
53 53
54 RefPtr<RTCDTMFSender> dtmfSender = adoptRef(new RTCDTMFSender(context, track , handler.release())); 54 RefPtr<RTCDTMFSender> dtmfSender = adoptRef(new RTCDTMFSender(context, track , handler.release()));
55 dtmfSender->suspendIfNeeded(); 55 dtmfSender->suspendIfNeeded();
56 return dtmfSender.release(); 56 return dtmfSender.release();
57 } 57 }
58 58
59 RTCDTMFSender::RTCDTMFSender(ScriptExecutionContext* context, PassRefPtr<MediaSt reamTrack> track, PassOwnPtr<RTCDTMFSenderHandler> handler) 59 RTCDTMFSender::RTCDTMFSender(ScriptExecutionContext* context, PassRefPtr<MediaSt reamTrack> track, PassOwnPtr<RTCDTMFSenderHandler> handler)
60 : ActiveDOMObject(context) 60 : ActiveDOMObject(context)
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 } 94 }
95 95
96 void RTCDTMFSender::insertDTMF(const String& tones, long duration, ExceptionStat e& es) 96 void RTCDTMFSender::insertDTMF(const String& tones, long duration, ExceptionStat e& es)
97 { 97 {
98 insertDTMF(tones, duration, defaultInterToneGapMs, es); 98 insertDTMF(tones, duration, defaultInterToneGapMs, es);
99 } 99 }
100 100
101 void RTCDTMFSender::insertDTMF(const String& tones, long duration, long interTon eGap, ExceptionState& es) 101 void RTCDTMFSender::insertDTMF(const String& tones, long duration, long interTon eGap, ExceptionState& es)
102 { 102 {
103 if (!canInsertDTMF()) { 103 if (!canInsertDTMF()) {
104 es.throwDOMException(NotSupportedError); 104 es.throwUninformativeAndGenericDOMException(NotSupportedError);
105 return; 105 return;
106 } 106 }
107 107
108 if (duration > maxToneDurationMs || duration < minToneDurationMs) { 108 if (duration > maxToneDurationMs || duration < minToneDurationMs) {
109 es.throwDOMException(SyntaxError); 109 es.throwUninformativeAndGenericDOMException(SyntaxError);
110 return; 110 return;
111 } 111 }
112 112
113 if (interToneGap < minInterToneGapMs) { 113 if (interToneGap < minInterToneGapMs) {
114 es.throwDOMException(SyntaxError); 114 es.throwUninformativeAndGenericDOMException(SyntaxError);
115 return; 115 return;
116 } 116 }
117 117
118 m_duration = duration; 118 m_duration = duration;
119 m_interToneGap = interToneGap; 119 m_interToneGap = interToneGap;
120 120
121 if (!m_handler->insertDTMF(tones, m_duration, m_interToneGap)) 121 if (!m_handler->insertDTMF(tones, m_duration, m_interToneGap))
122 es.throwDOMException(SyntaxError); 122 es.throwUninformativeAndGenericDOMException(SyntaxError);
123 } 123 }
124 124
125 void RTCDTMFSender::didPlayTone(const String& tone) 125 void RTCDTMFSender::didPlayTone(const String& tone)
126 { 126 {
127 scheduleDispatchEvent(RTCDTMFToneChangeEvent::create(tone)); 127 scheduleDispatchEvent(RTCDTMFToneChangeEvent::create(tone));
128 } 128 }
129 129
130 const AtomicString& RTCDTMFSender::interfaceName() const 130 const AtomicString& RTCDTMFSender::interfaceName() const
131 { 131 {
132 return eventNames().interfaceForRTCDTMFSender; 132 return eventNames().interfaceForRTCDTMFSender;
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 168
169 Vector<RefPtr<Event> > events; 169 Vector<RefPtr<Event> > events;
170 events.swap(m_scheduledEvents); 170 events.swap(m_scheduledEvents);
171 171
172 Vector<RefPtr<Event> >::iterator it = events.begin(); 172 Vector<RefPtr<Event> >::iterator it = events.begin();
173 for (; it != events.end(); ++it) 173 for (; it != events.end(); ++it)
174 dispatchEvent((*it).release()); 174 dispatchEvent((*it).release());
175 } 175 }
176 176
177 } // namespace WebCore 177 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/modules/mediastream/NavigatorMediaStream.cpp ('k') | Source/modules/mediastream/RTCDataChannel.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698