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/presentation/PresentationRequest.h" | 6 #include "modules/presentation/PresentationRequest.h" |
7 | 7 |
8 #include "bindings/core/v8/CallbackPromiseAdapter.h" | 8 #include "bindings/core/v8/CallbackPromiseAdapter.h" |
9 #include "bindings/core/v8/ExceptionState.h" | 9 #include "bindings/core/v8/ExceptionState.h" |
10 #include "bindings/core/v8/ScriptPromise.h" | 10 #include "bindings/core/v8/ScriptPromise.h" |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 WebPresentationClient* client = presentationClient(executionContext()); | 91 WebPresentationClient* client = presentationClient(executionContext()); |
92 if (!client) { | 92 if (!client) { |
93 resolver->reject(DOMException::create(InvalidStateError, "The Presentati
onRequest is no longer associated to a frame.")); | 93 resolver->reject(DOMException::create(InvalidStateError, "The Presentati
onRequest is no longer associated to a frame.")); |
94 return promise; | 94 return promise; |
95 } | 95 } |
96 client->startSession(m_url.string(), new PresentationSessionCallbacks(resolv
er, this)); | 96 client->startSession(m_url.string(), new PresentationSessionCallbacks(resolv
er, this)); |
97 | 97 |
98 return promise; | 98 return promise; |
99 } | 99 } |
100 | 100 |
101 ScriptPromise PresentationRequest::join(ScriptState* scriptState, const String&
id) | 101 ScriptPromise PresentationRequest::reconnect(ScriptState* scriptState, const Str
ing& id) |
102 { | 102 { |
103 ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState)
; | 103 ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState)
; |
104 ScriptPromise promise = resolver->promise(); | 104 ScriptPromise promise = resolver->promise(); |
105 | 105 |
106 WebPresentationClient* client = presentationClient(executionContext()); | 106 WebPresentationClient* client = presentationClient(executionContext()); |
107 if (!client) { | 107 if (!client) { |
108 resolver->reject(DOMException::create(InvalidStateError, "The Presentati
onRequest is no longer associated to a frame.")); | 108 resolver->reject(DOMException::create(InvalidStateError, "The Presentati
onRequest is no longer associated to a frame.")); |
109 return promise; | 109 return promise; |
110 } | 110 } |
111 client->joinSession(m_url.string(), id, new PresentationSessionCallbacks(res
olver, this)); | 111 client->joinSession(m_url.string(), id, new PresentationSessionCallbacks(res
olver, this)); |
(...skipping 26 matching lines...) Expand all Loading... |
138 ActiveDOMObject::trace(visitor); | 138 ActiveDOMObject::trace(visitor); |
139 } | 139 } |
140 | 140 |
141 PresentationRequest::PresentationRequest(ExecutionContext* executionContext, con
st KURL& url) | 141 PresentationRequest::PresentationRequest(ExecutionContext* executionContext, con
st KURL& url) |
142 : ActiveDOMObject(executionContext) | 142 : ActiveDOMObject(executionContext) |
143 , m_url(url) | 143 , m_url(url) |
144 { | 144 { |
145 } | 145 } |
146 | 146 |
147 } // namespace blink | 147 } // namespace blink |
OLD | NEW |