| 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 "modules/presentation/PresentationPromiseProperty.h" | 8 #include "modules/presentation/PresentationPromiseProperty.h" |
| 9 #include "platform/heap/Handle.h" | 9 #include "platform/heap/Handle.h" |
| 10 #include "platform/weborigin/KURL.h" | 10 #include "platform/weborigin/KURL.h" |
| 11 #include "platform/wtf/Noncopyable.h" |
| 12 #include "platform/wtf/Vector.h" |
| 11 #include "public/platform/WebCallbacks.h" | 13 #include "public/platform/WebCallbacks.h" |
| 12 #include "wtf/Noncopyable.h" | |
| 13 #include "wtf/Vector.h" | |
| 14 | 14 |
| 15 namespace blink { | 15 namespace blink { |
| 16 | 16 |
| 17 struct WebPresentationError; | 17 struct WebPresentationError; |
| 18 | 18 |
| 19 // PresentationAvailabilityCallback extends WebCallbacks to resolve the | 19 // PresentationAvailabilityCallback extends WebCallbacks to resolve the |
| 20 // 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 |
| 21 // WTF::Vector<KURL> in its constructor and will pass it to the | 21 // WTF::Vector<KURL> in its constructor and will pass it to the |
| 22 // WebAvailabilityObserver. | 22 // WebAvailabilityObserver. |
| 23 class PresentationAvailabilityCallbacks final | 23 class PresentationAvailabilityCallbacks final |
| 24 : public WebCallbacks<bool, const WebPresentationError&> { | 24 : public WebCallbacks<bool, const WebPresentationError&> { |
| 25 public: | 25 public: |
| 26 PresentationAvailabilityCallbacks(PresentationAvailabilityProperty*, | 26 PresentationAvailabilityCallbacks(PresentationAvailabilityProperty*, |
| 27 const WTF::Vector<KURL>&); | 27 const WTF::Vector<KURL>&); |
| 28 ~PresentationAvailabilityCallbacks() override; | 28 ~PresentationAvailabilityCallbacks() override; |
| 29 | 29 |
| 30 void OnSuccess(bool value) override; | 30 void OnSuccess(bool value) override; |
| 31 void OnError(const WebPresentationError&) override; | 31 void OnError(const WebPresentationError&) override; |
| 32 | 32 |
| 33 private: | 33 private: |
| 34 Persistent<PresentationAvailabilityProperty> resolver_; | 34 Persistent<PresentationAvailabilityProperty> resolver_; |
| 35 const WTF::Vector<KURL> urls_; | 35 const WTF::Vector<KURL> urls_; |
| 36 | 36 |
| 37 WTF_MAKE_NONCOPYABLE(PresentationAvailabilityCallbacks); | 37 WTF_MAKE_NONCOPYABLE(PresentationAvailabilityCallbacks); |
| 38 }; | 38 }; |
| 39 | 39 |
| 40 } // namespace blink | 40 } // namespace blink |
| 41 | 41 |
| 42 #endif // PresentationAvailabilityCallbacks_h | 42 #endif // PresentationAvailabilityCallbacks_h |
| OLD | NEW |