| 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 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 WebPresentationClient* client = PresentationClient(GetExecutionContext()); | 191 WebPresentationClient* client = PresentationClient(GetExecutionContext()); |
| 192 if (!client) | 192 if (!client) |
| 193 return ScriptPromise::RejectWithDOMException( | 193 return ScriptPromise::RejectWithDOMException( |
| 194 script_state, | 194 script_state, |
| 195 DOMException::Create( | 195 DOMException::Create( |
| 196 kInvalidStateError, | 196 kInvalidStateError, |
| 197 "The PresentationRequest is no longer associated to a frame.")); | 197 "The PresentationRequest is no longer associated to a frame.")); |
| 198 | 198 |
| 199 if (!availability_property_) { | 199 if (!availability_property_) { |
| 200 availability_property_ = new PresentationAvailabilityProperty( | 200 availability_property_ = new PresentationAvailabilityProperty( |
| 201 script_state->GetExecutionContext(), this, | 201 ExecutionContext::From(script_state), this, |
| 202 PresentationAvailabilityProperty::kReady); | 202 PresentationAvailabilityProperty::kReady); |
| 203 | 203 |
| 204 client->GetAvailability(urls_, | 204 client->GetAvailability(urls_, |
| 205 WTF::MakeUnique<PresentationAvailabilityCallbacks>( | 205 WTF::MakeUnique<PresentationAvailabilityCallbacks>( |
| 206 availability_property_, urls_)); | 206 availability_property_, urls_)); |
| 207 } | 207 } |
| 208 return availability_property_->Promise(script_state->World()); | 208 return availability_property_->Promise(script_state->World()); |
| 209 } | 209 } |
| 210 | 210 |
| 211 const Vector<KURL>& PresentationRequest::Urls() const { | 211 const Vector<KURL>& PresentationRequest::Urls() const { |
| (...skipping 18 matching lines...) Expand all Loading... |
| 230 if (execution_context->IsSecureContext()) { | 230 if (execution_context->IsSecureContext()) { |
| 231 UseCounter::Count(execution_context, | 231 UseCounter::Count(execution_context, |
| 232 UseCounter::kPresentationRequestSecureOrigin); | 232 UseCounter::kPresentationRequestSecureOrigin); |
| 233 } else { | 233 } else { |
| 234 UseCounter::Count(execution_context, | 234 UseCounter::Count(execution_context, |
| 235 UseCounter::kPresentationRequestInsecureOrigin); | 235 UseCounter::kPresentationRequestInsecureOrigin); |
| 236 } | 236 } |
| 237 } | 237 } |
| 238 | 238 |
| 239 } // namespace blink | 239 } // namespace blink |
| OLD | NEW |