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

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

Issue 1222623003: Presentation API: implement .getAvalability() (Blink side). (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: fix tests Created 5 years, 5 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/PresentationAvailabilityCallback.h"
7
8 #include "bindings/core/v8/ScriptPromiseResolver.h"
9 #include "modules/presentation/PresentationAvailability.h"
10
11 namespace blink {
12
13 PresentationAvailabilityCallback::PresentationAvailabilityCallback(PassRefPtr<Sc riptPromiseResolver> resolver)
14 : m_resolver(resolver)
15 {
16 ASSERT(m_resolver);
17 }
18
19 void PresentationAvailabilityCallback::onSuccess(bool* result)
20 {
21 OwnPtr<bool> availability = adoptPtr(result);
22 if (!m_resolver->executionContext() || m_resolver->executionContext()->activ eDOMObjectsAreStopped())
23 return;
24 m_resolver->resolve(PresentationAvailability::take(m_resolver.get(), *availa bility));
25 }
26
27 void PresentationAvailabilityCallback::onError()
28 {
29 if (!m_resolver->executionContext() || m_resolver->executionContext()->activ eDOMObjectsAreStopped())
30 return;
31 m_resolver->reject();
32 }
33
34 } // namespace blink
OLDNEW
« no previous file with comments | « Source/modules/presentation/PresentationAvailabilityCallback.h ('k') | Source/modules/presentation/PresentationController.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698