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

Side by Side Diff: third_party/WebKit/Source/modules/mediastream/MediaDevices.cpp

Issue 1373773003: Implement 'window.isSecureContext'. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: document. Created 5 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
OLDNEW
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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
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; 108 String errorMessage;
109 if (!request->isPrivilegedContextUse(errorMessage)) { 109 if (!request->isSecureContextUse(errorMessage)) {
110 return ScriptPromise::rejectWithDOMException(scriptState, DOMException:: create(NotSupportedError, errorMessage)); 110 return ScriptPromise::rejectWithDOMException(scriptState, DOMException:: create(NotSupportedError, errorMessage));
111 } 111 }
112 112
113 request->start(); 113 request->start();
114 return resolver->promise(); 114 return resolver->promise();
115 } 115 }
116 116
117 } // namespace blink 117 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698