| 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 "modules/presentation/PresentationRequest.h" | 5 #include "modules/presentation/PresentationRequest.h" |
| 6 | 6 |
| 7 #include "bindings/core/v8/CallbackPromiseAdapter.h" | 7 #include "bindings/core/v8/CallbackPromiseAdapter.h" |
| 8 #include "bindings/core/v8/ExceptionState.h" | 8 #include "bindings/core/v8/ExceptionState.h" |
| 9 #include "bindings/core/v8/ScriptPromise.h" | 9 #include "bindings/core/v8/ScriptPromise.h" |
| 10 #include "bindings/core/v8/ScriptPromiseResolver.h" | 10 #include "bindings/core/v8/ScriptPromiseResolver.h" |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 | 99 |
| 100 bool PresentationRequest::hasPendingActivity() const { | 100 bool PresentationRequest::hasPendingActivity() const { |
| 101 // Prevents garbage collecting of this object when not hold by another | 101 // Prevents garbage collecting of this object when not hold by another |
| 102 // object but still has listeners registered. | 102 // object but still has listeners registered. |
| 103 return getExecutionContext() && hasEventListeners(); | 103 return getExecutionContext() && hasEventListeners(); |
| 104 } | 104 } |
| 105 | 105 |
| 106 ScriptPromise PresentationRequest::start(ScriptState* scriptState) { | 106 ScriptPromise PresentationRequest::start(ScriptState* scriptState) { |
| 107 Settings* contextSettings = settings(getExecutionContext()); | 107 Settings* contextSettings = settings(getExecutionContext()); |
| 108 bool isUserGestureRequired = | 108 bool isUserGestureRequired = |
| 109 !contextSettings || contextSettings->presentationRequiresUserGesture(); | 109 !contextSettings || contextSettings->getPresentationRequiresUserGesture(); |
| 110 | 110 |
| 111 if (isUserGestureRequired && !UserGestureIndicator::utilizeUserGesture()) | 111 if (isUserGestureRequired && !UserGestureIndicator::utilizeUserGesture()) |
| 112 return ScriptPromise::rejectWithDOMException( | 112 return ScriptPromise::rejectWithDOMException( |
| 113 scriptState, | 113 scriptState, |
| 114 DOMException::create( | 114 DOMException::create( |
| 115 InvalidAccessError, | 115 InvalidAccessError, |
| 116 "PresentationRequest::start() requires user gesture.")); | 116 "PresentationRequest::start() requires user gesture.")); |
| 117 | 117 |
| 118 if (MixedContentChecker::isMixedContent( | 118 if (MixedContentChecker::isMixedContent( |
| 119 getExecutionContext()->getSecurityOrigin(), m_url)) { | 119 getExecutionContext()->getSecurityOrigin(), m_url)) { |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 visitor->trace(m_availabilityProperty); | 206 visitor->trace(m_availabilityProperty); |
| 207 EventTargetWithInlineData::trace(visitor); | 207 EventTargetWithInlineData::trace(visitor); |
| 208 ContextClient::trace(visitor); | 208 ContextClient::trace(visitor); |
| 209 } | 209 } |
| 210 | 210 |
| 211 PresentationRequest::PresentationRequest(ExecutionContext* executionContext, | 211 PresentationRequest::PresentationRequest(ExecutionContext* executionContext, |
| 212 const KURL& url) | 212 const KURL& url) |
| 213 : ContextClient(executionContext), m_url(url) {} | 213 : ContextClient(executionContext), m_url(url) {} |
| 214 | 214 |
| 215 } // namespace blink | 215 } // namespace blink |
| OLD | NEW |