| 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 PresentationController_h | 5 #ifndef PresentationController_h |
| 6 #define PresentationController_h | 6 #define PresentationController_h |
| 7 | 7 |
| 8 #include "core/frame/DOMWindowProperty.h" | 8 #include "core/dom/ContextLifecycleObserver.h" |
| 9 #include "core/frame/LocalFrame.h" | 9 #include "core/frame/LocalFrame.h" |
| 10 #include "modules/ModulesExport.h" | 10 #include "modules/ModulesExport.h" |
| 11 #include "modules/presentation/Presentation.h" | 11 #include "modules/presentation/Presentation.h" |
| 12 #include "modules/presentation/PresentationRequest.h" | 12 #include "modules/presentation/PresentationRequest.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/presentation/WebPresentationClient.h" | 15 #include "public/platform/modules/presentation/WebPresentationClient.h" |
| 16 #include "public/platform/modules/presentation/WebPresentationController.h" | 16 #include "public/platform/modules/presentation/WebPresentationController.h" |
| 17 | 17 |
| 18 namespace blink { | 18 namespace blink { |
| 19 | 19 |
| 20 class PresentationConnection; | 20 class PresentationConnection; |
| 21 class WebPresentationConnectionClient; | 21 class WebPresentationConnectionClient; |
| 22 enum class WebPresentationConnectionCloseReason; | 22 enum class WebPresentationConnectionCloseReason; |
| 23 enum class WebPresentationConnectionState; | 23 enum class WebPresentationConnectionState; |
| 24 | 24 |
| 25 // The coordinator between the various page exposed properties and the content | 25 // The coordinator between the various page exposed properties and the content |
| 26 // layer represented via |WebPresentationClient|. | 26 // layer represented via |WebPresentationClient|. |
| 27 class MODULES_EXPORT PresentationController final | 27 class MODULES_EXPORT PresentationController final |
| 28 : public GarbageCollectedFinalized<PresentationController>, | 28 : public GarbageCollectedFinalized<PresentationController>, |
| 29 public Supplement<LocalFrame>, | 29 public Supplement<LocalFrame>, |
| 30 public DOMWindowProperty, | 30 public ContextLifecycleObserver, |
| 31 public WebPresentationController { | 31 public WebPresentationController { |
| 32 USING_GARBAGE_COLLECTED_MIXIN(PresentationController); | 32 USING_GARBAGE_COLLECTED_MIXIN(PresentationController); |
| 33 WTF_MAKE_NONCOPYABLE(PresentationController); | 33 WTF_MAKE_NONCOPYABLE(PresentationController); |
| 34 | 34 |
| 35 public: | 35 public: |
| 36 ~PresentationController() override; | 36 ~PresentationController() override; |
| 37 | 37 |
| 38 static PresentationController* create(LocalFrame&, WebPresentationClient*); | 38 static PresentationController* create(LocalFrame&, WebPresentationClient*); |
| 39 | 39 |
| 40 static const char* supplementName(); | 40 static const char* supplementName(); |
| (...skipping 28 matching lines...) Expand all Loading... |
| 69 // in order to notify the client about the change of default presentation | 69 // in order to notify the client about the change of default presentation |
| 70 // url. | 70 // url. |
| 71 void setDefaultRequestUrl(const KURL&); | 71 void setDefaultRequestUrl(const KURL&); |
| 72 | 72 |
| 73 // Handling of running connections. | 73 // Handling of running connections. |
| 74 void registerConnection(PresentationConnection*); | 74 void registerConnection(PresentationConnection*); |
| 75 | 75 |
| 76 private: | 76 private: |
| 77 PresentationController(LocalFrame&, WebPresentationClient*); | 77 PresentationController(LocalFrame&, WebPresentationClient*); |
| 78 | 78 |
| 79 // Implementation of DOMWindowProperty. | 79 // Implementation of ContextLifecycleObserver. |
| 80 void frameDestroyed() override; | 80 void contextDestroyed() override; |
| 81 | 81 |
| 82 // Return the connection associated with the given |connectionClient| or | 82 // Return the connection associated with the given |connectionClient| or |
| 83 // null if it doesn't exist. | 83 // null if it doesn't exist. |
| 84 PresentationConnection* findConnection(WebPresentationConnectionClient*); | 84 PresentationConnection* findConnection(WebPresentationConnectionClient*); |
| 85 | 85 |
| 86 // The WebPresentationClient which allows communicating with the embedder. | 86 // The WebPresentationClient which allows communicating with the embedder. |
| 87 // It is not owned by the PresentationController but the controller will | 87 // It is not owned by the PresentationController but the controller will |
| 88 // set it to null when the LocalFrame will be detached at which point the | 88 // set it to null when the LocalFrame will be detached at which point the |
| 89 // client can't be used. | 89 // client can't be used. |
| 90 WebPresentationClient* m_client; | 90 WebPresentationClient* m_client; |
| 91 | 91 |
| 92 // Default PresentationRequest used by the embedder. | 92 // Default PresentationRequest used by the embedder. |
| 93 // Member<PresentationRequest> m_defaultRequest; | 93 // Member<PresentationRequest> m_defaultRequest; |
| 94 WeakMember<Presentation> m_presentation; | 94 WeakMember<Presentation> m_presentation; |
| 95 | 95 |
| 96 // The presentation connections associated with that frame. | 96 // The presentation connections associated with that frame. |
| 97 // TODO(mlamouri): the PresentationController will keep any created | 97 // TODO(mlamouri): the PresentationController will keep any created |
| 98 // connections alive until the frame is detached. These should be weak ptr | 98 // connections alive until the frame is detached. These should be weak ptr |
| 99 // so that the connection can be GC'd. | 99 // so that the connection can be GC'd. |
| 100 HeapHashSet<Member<PresentationConnection>> m_connections; | 100 HeapHashSet<Member<PresentationConnection>> m_connections; |
| 101 }; | 101 }; |
| 102 | 102 |
| 103 } // namespace blink | 103 } // namespace blink |
| 104 | 104 |
| 105 #endif // PresentationController_h | 105 #endif // PresentationController_h |
| OLD | NEW |