| 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/FrameDestructionObserver.h" | 8 #include "core/frame/FrameDestructionObserver.h" |
| 9 #include "modules/presentation/Presentation.h" | 9 #include "modules/presentation/Presentation.h" |
| 10 #include "platform/Supplementable.h" | 10 #include "platform/Supplementable.h" |
| 11 #include "platform/heap/Handle.h" | 11 #include "platform/heap/Handle.h" |
| 12 #include "public/platform/modules/presentation/WebPresentationClient.h" | 12 #include "public/platform/modules/presentation/WebPresentationClient.h" |
| 13 #include "public/platform/modules/presentation/WebPresentationController.h" | 13 #include "public/platform/modules/presentation/WebPresentationController.h" |
| 14 | 14 |
| 15 namespace blink { | 15 namespace blink { |
| 16 | 16 |
| 17 class LocalFrame; | 17 class LocalFrame; |
| 18 class PresentationSession; |
| 18 | 19 |
| 19 // The coordinator between the various page exposed properties and the content | 20 // The coordinator between the various page exposed properties and the content |
| 20 // layer represented via |WebPresentationClient|. | 21 // layer represented via |WebPresentationClient|. |
| 21 class PresentationController final | 22 class PresentationController final |
| 22 : public NoBaseWillBeGarbageCollectedFinalized<PresentationController> | 23 : public NoBaseWillBeGarbageCollectedFinalized<PresentationController> |
| 23 , public WillBeHeapSupplement<LocalFrame> | 24 , public WillBeHeapSupplement<LocalFrame> |
| 24 , public FrameDestructionObserver | 25 , public FrameDestructionObserver |
| 25 , public WebPresentationController { | 26 , public WebPresentationController { |
| 26 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(PresentationController); | 27 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(PresentationController); |
| 27 WTF_MAKE_NONCOPYABLE(PresentationController); | 28 WTF_MAKE_NONCOPYABLE(PresentationController); |
| 28 public: | 29 public: |
| 29 virtual ~PresentationController(); | 30 virtual ~PresentationController(); |
| 30 | 31 |
| 31 static PassOwnPtrWillBeRawPtr<PresentationController> create(LocalFrame&, We
bPresentationClient*); | 32 static PassOwnPtrWillBeRawPtr<PresentationController> create(LocalFrame&, We
bPresentationClient*); |
| 32 | 33 |
| 33 static const char* supplementName(); | 34 static const char* supplementName(); |
| 34 static PresentationController* from(LocalFrame&); | 35 static PresentationController* from(LocalFrame&); |
| 35 | 36 |
| 36 static void provideTo(LocalFrame&, WebPresentationClient*); | 37 static void provideTo(LocalFrame&, WebPresentationClient*); |
| 37 | 38 |
| 38 // Implementation of HeapSupplement. | 39 // Implementation of HeapSupplement. |
| 39 DECLARE_VIRTUAL_TRACE(); | 40 DECLARE_VIRTUAL_TRACE(); |
| 40 | 41 |
| 41 // Implementation of WebPresentationController. | 42 // Implementation of WebPresentationController. |
| 42 virtual void didChangeAvailability(bool available) override; | 43 virtual void didChangeAvailability(bool available) override; |
| 43 virtual bool isAvailableChangeWatched() const override; | 44 virtual bool isAvailableChangeWatched() const override; |
| 45 virtual void didStartDefaultPresentation(WebPresentationSessionClient*) over
ride; |
| 46 virtual bool isDefaultPresentationStartWatched() const override; |
| 44 | 47 |
| 45 // Called when the first listener was added to or the last listener was remo
ved from the | 48 // Called when the first listener was added to or the last listener was remo
ved from the |
| 46 // |availablechange| event. | 49 // |availablechange| event. |
| 47 void updateAvailableChangeWatched(bool watched); | 50 void updateAvailableChangeWatched(bool watched); |
| 48 | 51 |
| 52 // Called when the first listener was added to or the last listener was remo
ved from the |
| 53 // |defaultpresentationstart| event. |
| 54 void updateDefaultPresentationStartWatched(bool watched); |
| 55 |
| 49 // Called when the frame wants to start a new presentation. | 56 // Called when the frame wants to start a new presentation. |
| 50 void startSession(const String& presentationUrl, const String& presentationI
d, WebPresentationSessionClientCallbacks*); | 57 void startSession(const String& presentationUrl, const String& presentationI
d, WebPresentationSessionClientCallbacks*); |
| 51 | 58 |
| 52 // Called when the frame wants to join an existing presentation. | 59 // Called when the frame wants to join an existing presentation. |
| 53 void joinSession(const String& presentationUrl, const String& presentationId
, WebPresentationSessionClientCallbacks*); | 60 void joinSession(const String& presentationUrl, const String& presentationId
, WebPresentationSessionClientCallbacks*); |
| 54 | 61 |
| 55 // Connects the |Presentation| object with this controller. | 62 // Connects the |Presentation| object with this controller. |
| 56 void setPresentation(Presentation*); | 63 void setPresentation(Presentation*); |
| 57 | 64 |
| 58 private: | 65 private: |
| 59 PresentationController(LocalFrame&, WebPresentationClient*); | 66 PresentationController(LocalFrame&, WebPresentationClient*); |
| 60 | 67 |
| 61 // Implementation of FrameDestructionObserver. | 68 // Implementation of FrameDestructionObserver. |
| 62 virtual void willDetachFrameHost() override; | 69 virtual void willDetachFrameHost() override; |
| 63 | 70 |
| 64 WebPresentationClient* m_client; | 71 WebPresentationClient* m_client; |
| 65 PersistentWillBeMember<Presentation> m_presentation; | 72 PersistentWillBeMember<Presentation> m_presentation; |
| 66 }; | 73 }; |
| 67 | 74 |
| 68 } // namespace blink | 75 } // namespace blink |
| 69 | 76 |
| 70 #endif // PresentationController_h | 77 #endif // PresentationController_h |
| OLD | NEW |