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

Side by Side Diff: Source/modules/presentation/PresentationSessionClientCallbacks.cpp

Issue 940503002: [PresentationAPI] Added plumbing for start/joinSession from JS to platform (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Full change Created 5 years, 10 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "config.h"
6 #include "modules/presentation/PresentationSessionClientCallbacks.h"
7
8 #include "bindings/core/v8/ScriptPromiseResolver.h"
9 #include "core/dom/DOMException.h"
10 #include "core/dom/ExceptionCode.h"
11 #include "modules/presentation/Presentation.h"
12 #include "modules/presentation/PresentationError.h"
13 #include "modules/presentation/PresentationSession.h"
14 #include "public/platform/WebString.h"
15 #include "public/platform/modules/presentation/WebPresentationError.h"
16 #include "wtf/OwnPtr.h"
17
18 namespace blink {
19
20 PresentationSessionClientCallbacks::PresentationSessionClientCallbacks(
21 PassRefPtrWillBeRawPtr<ScriptPromiseResolver> resolver,
22 Presentation* presentation)
23 : m_resolver(resolver)
24 , m_presentation(presentation)
25 {
26 ASSERT(m_resolver);
27 ASSERT(m_presentation);
28 }
29
30 PresentationSessionClientCallbacks::~PresentationSessionClientCallbacks()
31 {
32 }
33
34 void PresentationSessionClientCallbacks::onSuccess(WebPresentationSessionClient* client)
35 {
36 ASSERT(client);
37 if (!m_resolver->executionContext() || m_resolver->executionContext()->activ eDOMObjectsAreStopped()) {
38 PresentationSession::dispose(client);
39 return;
40 }
41
42 m_resolver->resolve(PresentationSession::take(client, m_presentation));
43 }
44
45 void PresentationSessionClientCallbacks::onError(WebPresentationError* error)
46 {
47 ASSERT(error);
48 if (!m_resolver->executionContext() || m_resolver->executionContext()->activ eDOMObjectsAreStopped()) {
49 PresentationError::dispose(error);
50 return;
51 }
52
53 m_resolver->reject(PresentationError::take(error));
54 }
55
56 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698