Index: content/renderer/presentation/presentation_dispatcher.h |
diff --git a/content/renderer/presentation/presentation_dispatcher.h b/content/renderer/presentation/presentation_dispatcher.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..2e582f1588e065c285287c970010eb0ecb051128 |
--- /dev/null |
+++ b/content/renderer/presentation/presentation_dispatcher.h |
@@ -0,0 +1,42 @@ |
+// 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 CONTENT_RENDERER_PRESENTATION_PRESENTATION_DISPATCHER_H_ |
+#define CONTENT_RENDERER_PRESENTATION_PRESENTATION_DISPATCHER_H_ |
+ |
+#include "content/common/presentation_service.mojom.h" |
+#include "content/public/renderer/render_frame_observer.h" |
+#include "third_party/WebKit/public/platform/WebPresentationClient.h" |
+ |
+namespace content { |
+ |
+// PresentationDispatcher is a delegate for Presentation API messages used by |
+// Blink. It forwards the calls to the Mojo PresentationService. |
+class PresentationDispatcher |
+ : public RenderFrameObserver, |
+ public blink::WebPresentationClient, |
+ public mojo::InterfaceImpl<presentation::PresentationServiceClient> { |
+ public: |
+ explicit PresentationDispatcher(RenderFrame* render_frame); |
+ ~PresentationDispatcher() override; |
+ |
+ private: |
+ // WebPresentationClient implementation. |
+ virtual void setController( |
+ blink::WebPresentationController* controller); |
+ virtual void addDeviceAvailabilityListener(); |
+ virtual void removeDeviceAvailabilityListener(); |
+ |
+ // PresentationServiceClient implementation. |
+ void DeviceAvailabilityChanged(bool available) override; |
+ |
+ void ConnectToPresentationServiceIfNeeded(); |
+ |
+ blink::WebPresentationController* controller_; |
Peter Beverloo
2015/01/07 19:41:21
nit: maybe add a comment about controller_ being a
mlamouri (slow - plz ping)
2015/01/08 15:08:54
A comment pointing that it is a weak reference wou
whywhat
2015/01/08 17:28:53
Done.
whywhat
2015/01/08 17:28:53
Done.
|
+ presentation::PresentationServicePtr presentation_service_; |
+}; |
+ |
+} // namespace content |
+ |
+#endif // CONTENT_RENDERER_PRESENTATION_PRESENTATION_DISPATCHER_H_ |