| 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 #ifndef PresentationAvailabilityCallbacks_h | 5 #ifndef PresentationAvailabilityCallbacks_h |
| 6 #define PresentationAvailabilityCallbacks_h | 6 #define PresentationAvailabilityCallbacks_h |
| 7 | 7 |
| 8 #include "platform/heap/Handle.h" | 8 #include "platform/heap/Handle.h" |
| 9 #include "platform/weborigin/KURL.h" | 9 #include "platform/weborigin/KURL.h" |
| 10 #include "public/platform/WebCallbacks.h" | 10 #include "public/platform/WebCallbacks.h" |
| 11 #include "wtf/Noncopyable.h" | 11 #include "wtf/Noncopyable.h" |
| 12 #include "wtf/Vector.h" |
| 12 | 13 |
| 13 namespace blink { | 14 namespace blink { |
| 14 | 15 |
| 15 class ScriptPromiseResolver; | 16 class ScriptPromiseResolver; |
| 16 struct WebPresentationError; | 17 struct WebPresentationError; |
| 17 | 18 |
| 18 // PresentationAvailabilityCallback extends WebCallbacks to resolve the | 19 // PresentationAvailabilityCallback extends WebCallbacks to resolve the |
| 19 // underlying promise depending on the result passed to the callback. It takes a | 20 // underlying promise depending on the result passed to the callback. It takes a |
| 20 // KURL in its constructor and will pass it to the WebAvailabilityObserver. | 21 // WTF::Vector<KURL> in its constructor and will pass it to the |
| 22 // WebAvailabilityObserver. |
| 21 class PresentationAvailabilityCallbacks final | 23 class PresentationAvailabilityCallbacks final |
| 22 : public WebCallbacks<bool, const WebPresentationError&> { | 24 : public WebCallbacks<bool, const WebPresentationError&> { |
| 23 public: | 25 public: |
| 24 PresentationAvailabilityCallbacks(ScriptPromiseResolver*, const KURL&); | 26 PresentationAvailabilityCallbacks(ScriptPromiseResolver*, |
| 27 const WTF::Vector<KURL>&); |
| 25 ~PresentationAvailabilityCallbacks() override; | 28 ~PresentationAvailabilityCallbacks() override; |
| 26 | 29 |
| 27 void onSuccess(bool value) override; | 30 void onSuccess(bool value) override; |
| 28 void onError(const WebPresentationError&) override; | 31 void onError(const WebPresentationError&) override; |
| 29 | 32 |
| 30 private: | 33 private: |
| 31 Persistent<ScriptPromiseResolver> m_resolver; | 34 Persistent<ScriptPromiseResolver> m_resolver; |
| 32 const KURL m_url; | 35 const WTF::Vector<KURL> m_urls; |
| 33 | 36 |
| 34 WTF_MAKE_NONCOPYABLE(PresentationAvailabilityCallbacks); | 37 WTF_MAKE_NONCOPYABLE(PresentationAvailabilityCallbacks); |
| 35 }; | 38 }; |
| 36 | 39 |
| 37 } // namespace blink | 40 } // namespace blink |
| 38 | 41 |
| 39 #endif // PresentationAvailabilityCallbacks_h | 42 #endif // PresentationAvailabilityCallbacks_h |
| OLD | NEW |