| 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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 | 102 |
| 103 bool PresentationRequest::hasPendingActivity() const { | 103 bool PresentationRequest::hasPendingActivity() const { |
| 104 // Prevents garbage collecting of this object when not hold by another | 104 // Prevents garbage collecting of this object when not hold by another |
| 105 // object but still has listeners registered. | 105 // object but still has listeners registered. |
| 106 return getExecutionContext() && hasEventListeners(); | 106 return getExecutionContext() && hasEventListeners(); |
| 107 } | 107 } |
| 108 | 108 |
| 109 ScriptPromise PresentationRequest::start(ScriptState* scriptState) { | 109 ScriptPromise PresentationRequest::start(ScriptState* scriptState) { |
| 110 Settings* contextSettings = settings(getExecutionContext()); | 110 Settings* contextSettings = settings(getExecutionContext()); |
| 111 bool isUserGestureRequired = | 111 bool isUserGestureRequired = |
| 112 !contextSettings || contextSettings->presentationRequiresUserGesture(); | 112 !contextSettings || contextSettings->GetPresentationRequiresUserGesture(); |
| 113 | 113 |
| 114 if (isUserGestureRequired && !UserGestureIndicator::utilizeUserGesture()) | 114 if (isUserGestureRequired && !UserGestureIndicator::utilizeUserGesture()) |
| 115 return ScriptPromise::rejectWithDOMException( | 115 return ScriptPromise::rejectWithDOMException( |
| 116 scriptState, | 116 scriptState, |
| 117 DOMException::create( | 117 DOMException::create( |
| 118 InvalidAccessError, | 118 InvalidAccessError, |
| 119 "PresentationRequest::start() requires user gesture.")); | 119 "PresentationRequest::start() requires user gesture.")); |
| 120 | 120 |
| 121 if (MixedContentChecker::isMixedContent( | 121 if (MixedContentChecker::isMixedContent( |
| 122 getExecutionContext()->getSecurityOrigin(), m_url)) { | 122 getExecutionContext()->getSecurityOrigin(), m_url)) { |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 visitor->trace(m_availabilityProperty); | 209 visitor->trace(m_availabilityProperty); |
| 210 EventTargetWithInlineData::trace(visitor); | 210 EventTargetWithInlineData::trace(visitor); |
| 211 SuspendableObject::trace(visitor); | 211 SuspendableObject::trace(visitor); |
| 212 } | 212 } |
| 213 | 213 |
| 214 PresentationRequest::PresentationRequest(ExecutionContext* executionContext, | 214 PresentationRequest::PresentationRequest(ExecutionContext* executionContext, |
| 215 const KURL& url) | 215 const KURL& url) |
| 216 : SuspendableObject(executionContext), m_url(url) {} | 216 : SuspendableObject(executionContext), m_url(url) {} |
| 217 | 217 |
| 218 } // namespace blink | 218 } // namespace blink |
| OLD | NEW |