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

Side by Side Diff: third_party/WebKit/Source/modules/presentation/PresentationAvailabilityCallbacks.cpp

Issue 2552343009: [Presentation API] Adds DOMString[] constructor to PresentationRequest. (Closed)
Patch Set: resolve code review comments from foolip Created 3 years, 11 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
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/PresentationAvailabilityCallbacks.h" 5 #include "modules/presentation/PresentationAvailabilityCallbacks.h"
6 6
7 #include "bindings/core/v8/ScriptPromiseResolver.h" 7 #include "bindings/core/v8/ScriptPromiseResolver.h"
8 #include "core/dom/DOMException.h" 8 #include "core/dom/DOMException.h"
9 #include "modules/presentation/PresentationAvailability.h" 9 #include "modules/presentation/PresentationAvailability.h"
10 #include "modules/presentation/PresentationError.h" 10 #include "modules/presentation/PresentationError.h"
11 #include "modules/presentation/PresentationRequest.h" 11 #include "modules/presentation/PresentationRequest.h"
12 #include "public/platform/modules/presentation/WebPresentationError.h" 12 #include "public/platform/modules/presentation/WebPresentationError.h"
13 13
14 namespace blink { 14 namespace blink {
15 15
16 PresentationAvailabilityCallbacks::PresentationAvailabilityCallbacks( 16 PresentationAvailabilityCallbacks::PresentationAvailabilityCallbacks(
17 PresentationAvailabilityProperty* resolver, 17 PresentationAvailabilityProperty* resolver,
18 const KURL& url) 18 const Vector<KURL>& urls)
19 : m_resolver(resolver), m_url(url) { 19 : m_resolver(resolver), m_urls(urls) {
20 ASSERT(m_resolver); 20 ASSERT(m_resolver);
21 } 21 }
22 22
23 PresentationAvailabilityCallbacks::~PresentationAvailabilityCallbacks() {} 23 PresentationAvailabilityCallbacks::~PresentationAvailabilityCallbacks() {}
24 24
25 void PresentationAvailabilityCallbacks::onSuccess(bool value) { 25 void PresentationAvailabilityCallbacks::onSuccess(bool value) {
26 if (!m_resolver->getExecutionContext() || 26 if (!m_resolver->getExecutionContext() ||
27 m_resolver->getExecutionContext()->isContextDestroyed()) 27 m_resolver->getExecutionContext()->isContextDestroyed())
28 return; 28 return;
29 m_resolver->resolve( 29 m_resolver->resolve(
30 PresentationAvailability::take(m_resolver.get(), m_url, value)); 30 PresentationAvailability::take(m_resolver.get(), m_urls, value));
31 } 31 }
32 32
33 void PresentationAvailabilityCallbacks::onError( 33 void PresentationAvailabilityCallbacks::onError(
34 const WebPresentationError& error) { 34 const WebPresentationError& error) {
35 if (!m_resolver->getExecutionContext() || 35 if (!m_resolver->getExecutionContext() ||
36 m_resolver->getExecutionContext()->isContextDestroyed()) 36 m_resolver->getExecutionContext()->isContextDestroyed())
37 return; 37 return;
38 m_resolver->reject(PresentationError::take(error)); 38 m_resolver->reject(PresentationError::take(error));
39 } 39 }
40 40
41 } // namespace blink 41 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698