Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1336)

Unified Diff: Source/modules/presentation/PresentationController.h

Issue 832263007: Added plumbing for the availablechange event from Blink to WebPresentationClient. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Added onClientDestroyed Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/modules/presentation/PresentationController.h
diff --git a/Source/modules/presentation/PresentationController.h b/Source/modules/presentation/PresentationController.h
new file mode 100644
index 0000000000000000000000000000000000000000..4a8acc181cb207c9cd76252f9814542b3f211b72
--- /dev/null
+++ b/Source/modules/presentation/PresentationController.h
@@ -0,0 +1,65 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef PresentationController_h
+#define PresentationController_h
+
+#include "core/frame/FrameDestructionObserver.h"
+#include "modules/presentation/Presentation.h"
+#include "platform/Supplementable.h"
+#include "platform/heap/Handle.h"
+#include "public/platform/WebPresentationController.h"
+
+namespace blink {
+
+class LocalFrame;
+class WebPresentationClient;
+
+// The coordinator between the various page exposed properties and the content
+// layer represented via |WebPresentationClient|.
+class PresentationController final
+ : public NoBaseWillBeGarbageCollectedFinalized<PresentationController>
+ , public WillBeHeapSupplement<LocalFrame>
+ , public FrameDestructionObserver
+ , public WebPresentationController {
+ WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(PresentationController);
+ WTF_MAKE_NONCOPYABLE(PresentationController);
+public:
+ virtual ~PresentationController();
+
+ static PassOwnPtrWillBeRawPtr<PresentationController> create(LocalFrame&, WebPresentationClient*);
+
+ static const char* supplementName();
+ static PresentationController* from(LocalFrame&);
+
+ static void provideTo(LocalFrame&, WebPresentationClient*);
+
+ // Implementation of HeapSupplement.
+ virtual void trace(Visitor*) override;
+
+ // Implementation of WebPresentationController.
+ virtual void didChangeAvailability(bool available) override;
+ virtual bool isAvailableChangeWatched() const override;
+ virtual void onClientDestroyed() override;
+
+ // Called when the first listener was added to or the last listener was removed from the
+ // |availablechange| event.
+ void updateAvailableChangeWatched(bool watched);
+
+ // Connects the |Presentation| object with this controller.
+ void setPresentation(Presentation*);
+
+private:
+ PresentationController(LocalFrame&, WebPresentationClient*);
+
+ // Implementation of FrameDestructionObserver.
+ virtual void willDetachFrameHost() override;
+
+ WebPresentationClient* m_client;
+ PersistentWillBeMember<Presentation> m_presentation;
+};
+
+} // namespace blink
+
+#endif // PresentationController_h
« no previous file with comments | « Source/modules/presentation/Presentation.idl ('k') | Source/modules/presentation/PresentationController.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698