OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "config.h" | 5 #include "config.h" |
6 #include "modules/mediastream/MediaDevices.h" | 6 #include "modules/mediastream/MediaDevices.h" |
7 | 7 |
8 #include "bindings/core/v8/ScriptPromise.h" | 8 #include "bindings/core/v8/ScriptPromise.h" |
9 #include "bindings/core/v8/ScriptPromiseResolver.h" | 9 #include "bindings/core/v8/ScriptPromiseResolver.h" |
10 #include "bindings/core/v8/ScriptState.h" | 10 #include "bindings/core/v8/ScriptState.h" |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 UserMediaController* userMedia = UserMediaController::from(document->frame()
); | 98 UserMediaController* userMedia = UserMediaController::from(document->frame()
); |
99 if (!userMedia) | 99 if (!userMedia) |
100 return ScriptPromise::rejectWithDOMException(scriptState, DOMException::
create(NotSupportedError, "No media device controller available; is this a detac
hed window?")); | 100 return ScriptPromise::rejectWithDOMException(scriptState, DOMException::
create(NotSupportedError, "No media device controller available; is this a detac
hed window?")); |
101 | 101 |
102 UserMediaRequest* request = UserMediaRequest::create(document, userMedia, op
tions, successCallback, errorCallback, exceptionState); | 102 UserMediaRequest* request = UserMediaRequest::create(document, userMedia, op
tions, successCallback, errorCallback, exceptionState); |
103 if (!request) { | 103 if (!request) { |
104 ASSERT(exceptionState.hadException()); | 104 ASSERT(exceptionState.hadException()); |
105 return exceptionState.reject(scriptState); | 105 return exceptionState.reject(scriptState); |
106 } | 106 } |
107 | 107 |
108 String errorMessage; | |
109 if (!document->isPrivilegedContext(errorMessage)) { | |
110 return ScriptPromise::rejectWithDOMException(scriptState, DOMException::
create(NotSupportedError, errorMessage)); | |
111 } | |
112 | |
113 request->start(); | 108 request->start(); |
114 return resolver->promise(); | 109 return resolver->promise(); |
115 } | 110 } |
116 | 111 |
117 } // namespace blink | 112 } // namespace blink |
OLD | NEW |