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

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

Issue 19724003: Revert "Transition modules/** to use ExceptionState" (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 5 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) 2011 Ericsson AB. All rights reserved. 2 * Copyright (C) 2011 Ericsson AB. All rights reserved.
3 * Copyright (C) 2012 Google Inc. All rights reserved. 3 * Copyright (C) 2012 Google Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 8 *
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 16 matching lines...) Expand all
27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 */ 30 */
31 31
32 #include "config.h" 32 #include "config.h"
33 33
34 #include "modules/mediastream/UserMediaRequest.h" 34 #include "modules/mediastream/UserMediaRequest.h"
35 35
36 #include "bindings/v8/Dictionary.h" 36 #include "bindings/v8/Dictionary.h"
37 #include "bindings/v8/ExceptionState.h"
38 #include "core/dom/Document.h" 37 #include "core/dom/Document.h"
38 #include "core/dom/ExceptionCode.h"
39 #include "core/dom/SpaceSplitString.h" 39 #include "core/dom/SpaceSplitString.h"
40 #include "core/platform/mediastream/MediaStreamCenter.h" 40 #include "core/platform/mediastream/MediaStreamCenter.h"
41 #include "core/platform/mediastream/MediaStreamDescriptor.h" 41 #include "core/platform/mediastream/MediaStreamDescriptor.h"
42 #include "modules/mediastream/MediaConstraintsImpl.h" 42 #include "modules/mediastream/MediaConstraintsImpl.h"
43 #include "modules/mediastream/MediaStream.h" 43 #include "modules/mediastream/MediaStream.h"
44 #include "modules/mediastream/UserMediaController.h" 44 #include "modules/mediastream/UserMediaController.h"
45 45
46 namespace WebCore { 46 namespace WebCore {
47 47
48 static PassRefPtr<MediaConstraintsImpl> parseOptions(const Dictionary& options, const String& mediaType, ExceptionState& es) 48 static PassRefPtr<MediaConstraintsImpl> parseOptions(const Dictionary& options, const String& mediaType, ExceptionCode& ec)
49 { 49 {
50 RefPtr<MediaConstraintsImpl> constraints; 50 RefPtr<MediaConstraintsImpl> constraints;
51 51
52 Dictionary constraintsDictionary; 52 Dictionary constraintsDictionary;
53 bool ok = options.get(mediaType, constraintsDictionary); 53 bool ok = options.get(mediaType, constraintsDictionary);
54 if (ok && !constraintsDictionary.isUndefinedOrNull()) 54 if (ok && !constraintsDictionary.isUndefinedOrNull())
55 constraints = MediaConstraintsImpl::create(constraintsDictionary, es); 55 constraints = MediaConstraintsImpl::create(constraintsDictionary, ec);
56 else { 56 else {
57 bool mediaRequested = false; 57 bool mediaRequested = false;
58 options.get(mediaType, mediaRequested); 58 options.get(mediaType, mediaRequested);
59 if (mediaRequested) 59 if (mediaRequested)
60 constraints = MediaConstraintsImpl::create(); 60 constraints = MediaConstraintsImpl::create();
61 } 61 }
62 62
63 return constraints.release(); 63 return constraints.release();
64 } 64 }
65 65
66 PassRefPtr<UserMediaRequest> UserMediaRequest::create(ScriptExecutionContext* co ntext, UserMediaController* controller, const Dictionary& options, PassRefPtr<Na vigatorUserMediaSuccessCallback> successCallback, PassRefPtr<NavigatorUserMediaE rrorCallback> errorCallback, ExceptionState& es) 66 PassRefPtr<UserMediaRequest> UserMediaRequest::create(ScriptExecutionContext* co ntext, UserMediaController* controller, const Dictionary& options, PassRefPtr<Na vigatorUserMediaSuccessCallback> successCallback, PassRefPtr<NavigatorUserMediaE rrorCallback> errorCallback, ExceptionCode& ec)
67 { 67 {
68 RefPtr<MediaConstraintsImpl> audio = parseOptions(options, ASCIILiteral("aud io"), es); 68 RefPtr<MediaConstraintsImpl> audio = parseOptions(options, ASCIILiteral("aud io"), ec);
69 if (es.hadException()) 69 if (ec)
70 return 0; 70 return 0;
71 71
72 RefPtr<MediaConstraintsImpl> video = parseOptions(options, ASCIILiteral("vid eo"), es); 72 RefPtr<MediaConstraintsImpl> video = parseOptions(options, ASCIILiteral("vid eo"), ec);
73 if (es.hadException()) 73 if (ec)
74 return 0; 74 return 0;
75 75
76 if (!audio && !video) 76 if (!audio && !video)
77 return 0; 77 return 0;
78 78
79 return adoptRef(new UserMediaRequest(context, controller, audio.release(), v ideo.release(), successCallback, errorCallback)); 79 return adoptRef(new UserMediaRequest(context, controller, audio.release(), v ideo.release(), successCallback, errorCallback));
80 } 80 }
81 81
82 UserMediaRequest::UserMediaRequest(ScriptExecutionContext* context, UserMediaCon troller* controller, PassRefPtr<MediaConstraintsImpl> audio, PassRefPtr<MediaCon straintsImpl> video, PassRefPtr<NavigatorUserMediaSuccessCallback> successCallba ck, PassRefPtr<NavigatorUserMediaErrorCallback> errorCallback) 82 UserMediaRequest::UserMediaRequest(ScriptExecutionContext* context, UserMediaCon troller* controller, PassRefPtr<MediaConstraintsImpl> audio, PassRefPtr<MediaCon straintsImpl> video, PassRefPtr<NavigatorUserMediaSuccessCallback> successCallba ck, PassRefPtr<NavigatorUserMediaErrorCallback> errorCallback)
83 : ContextLifecycleObserver(context) 83 : ContextLifecycleObserver(context)
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 177
178 if (m_controller) { 178 if (m_controller) {
179 m_controller->cancelUserMediaRequest(this); 179 m_controller->cancelUserMediaRequest(this);
180 m_controller = 0; 180 m_controller = 0;
181 } 181 }
182 182
183 ContextLifecycleObserver::contextDestroyed(); 183 ContextLifecycleObserver::contextDestroyed();
184 } 184 }
185 185
186 } // namespace WebCore 186 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/modules/mediastream/UserMediaRequest.h ('k') | Source/modules/navigatorcontentutils/NavigatorContentUtils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698