| 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 WebPresentationSessionClient; |
| 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; |
| 44 | 46 |
| 45 // Called when the first listener was added to or the last listener was remo
ved from the | 47 // Called when the first listener was added to or the last listener was remo
ved from the |
| 46 // |availablechange| event. | 48 // |availablechange| event. |
| 47 void updateAvailableChangeWatched(bool watched); | 49 void updateAvailableChangeWatched(bool watched); |
| 48 | 50 |
| 49 // Called when the frame wants to start a new presentation. | 51 // Called when the frame wants to start a new presentation. |
| 50 void startSession(const String& presentationUrl, const String& presentationI
d, WebPresentationSessionClientCallbacks*); | 52 void startSession(const String& presentationUrl, const String& presentationI
d, WebPresentationSessionClientCallbacks*); |
| 51 | 53 |
| 52 // Called when the frame wants to join an existing presentation. | 54 // Called when the frame wants to join an existing presentation. |
| 53 void joinSession(const String& presentationUrl, const String& presentationId
, WebPresentationSessionClientCallbacks*); | 55 void joinSession(const String& presentationUrl, const String& presentationId
, WebPresentationSessionClientCallbacks*); |
| 54 | 56 |
| 55 // Connects the |Presentation| object with this controller. | 57 // Connects the |Presentation| object with this controller. |
| 56 void setPresentation(Presentation*); | 58 void setPresentation(Presentation*); |
| 57 | 59 |
| 58 private: | 60 private: |
| 59 PresentationController(LocalFrame&, WebPresentationClient*); | 61 PresentationController(LocalFrame&, WebPresentationClient*); |
| 60 | 62 |
| 61 // Implementation of FrameDestructionObserver. | 63 // Implementation of FrameDestructionObserver. |
| 62 virtual void willDetachFrameHost() override; | 64 virtual void willDetachFrameHost() override; |
| 63 | 65 |
| 64 WebPresentationClient* m_client; | 66 WebPresentationClient* m_client; |
| 65 PersistentWillBeMember<Presentation> m_presentation; | 67 PersistentWillBeMember<Presentation> m_presentation; |
| 66 }; | 68 }; |
| 67 | 69 |
| 68 } // namespace blink | 70 } // namespace blink |
| 69 | 71 |
| 70 #endif // PresentationController_h | 72 #endif // PresentationController_h |
| OLD | NEW |