| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 NavigatorShare_h | 5 #ifndef NavigatorShare_h |
| 6 #define NavigatorShare_h | 6 #define NavigatorShare_h |
| 7 | 7 |
| 8 #include "bindings/core/v8/ScriptPromise.h" | 8 #include "bindings/core/v8/ScriptPromise.h" |
| 9 #include "bindings/core/v8/ScriptPromiseResolver.h" | 9 #include "bindings/core/v8/ScriptPromiseResolver.h" |
| 10 #include "bindings/core/v8/ScriptWrappable.h" | 10 #include "bindings/core/v8/ScriptWrappable.h" |
| 11 #include "core/dom/ContextLifecycleObserver.h" | 11 #include "core/dom/ContextLifecycleObserver.h" |
| 12 #include "core/events/EventTarget.h" | 12 #include "core/events/EventTarget.h" |
| 13 #include "platform/Supplementable.h" | 13 #include "platform/Supplementable.h" |
| 14 #include "platform/heap/Handle.h" | 14 #include "platform/heap/Handle.h" |
| 15 #include "public/platform/modules/webshare/webshare.mojom-blink.h" | 15 #include "public/platform/modules/webshare/webshare.mojom-blink.h" |
| 16 #include "wtf/HashSet.h" | 16 #include "wtf/HashSet.h" |
| 17 | 17 |
| 18 namespace blink { | 18 namespace blink { |
| 19 | 19 |
| 20 class Navigator; | 20 class Navigator; |
| 21 class ShareData; |
| 21 | 22 |
| 22 class NavigatorShare final : public GarbageCollectedFinalized<NavigatorShare>, p
ublic Supplement<Navigator> { | 23 class NavigatorShare final : public GarbageCollectedFinalized<NavigatorShare>, p
ublic Supplement<Navigator> { |
| 23 USING_GARBAGE_COLLECTED_MIXIN(NavigatorShare); | 24 USING_GARBAGE_COLLECTED_MIXIN(NavigatorShare); |
| 24 public: | 25 public: |
| 25 ~NavigatorShare(); | 26 ~NavigatorShare(); |
| 26 | 27 |
| 27 // Gets, or creates, NavigatorShare supplement on Navigator. | 28 // Gets, or creates, NavigatorShare supplement on Navigator. |
| 28 // See platform/Supplementable.h | 29 // See platform/Supplementable.h |
| 29 static NavigatorShare& from(Navigator&); | 30 static NavigatorShare& from(Navigator&); |
| 30 | 31 |
| 31 // Navigator partial interface | 32 // Navigator partial interface |
| 32 ScriptPromise share(ScriptState*, const String& title, const String& text); | 33 ScriptPromise share(ScriptState*, const ShareData&); |
| 33 static ScriptPromise share(ScriptState*, Navigator&, const String& title, co
nst String& text); | 34 static ScriptPromise share(ScriptState*, Navigator&, const ShareData&); |
| 34 | 35 |
| 35 DECLARE_TRACE(); | 36 DECLARE_TRACE(); |
| 36 | 37 |
| 37 private: | 38 private: |
| 38 class ShareClientImpl; | 39 class ShareClientImpl; |
| 39 | 40 |
| 40 NavigatorShare(); | 41 NavigatorShare(); |
| 41 static const char* supplementName(); | 42 static const char* supplementName(); |
| 42 | 43 |
| 43 blink::mojom::blink::ShareServicePtr m_service; | 44 blink::mojom::blink::ShareServicePtr m_service; |
| 44 | 45 |
| 45 HeapHashSet<Member<ShareClientImpl>> m_clients; | 46 HeapHashSet<Member<ShareClientImpl>> m_clients; |
| 46 }; | 47 }; |
| 47 | 48 |
| 48 } // namespace blink | 49 } // namespace blink |
| 49 | 50 |
| 50 #endif // NavigatorShare_h | 51 #endif // NavigatorShare_h |
| OLD | NEW |