| 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 CONTENT_RENDERER_PRESENTATION_PRESENTATION_DISPATCHER_H_ | 5 #ifndef CONTENT_RENDERER_PRESENTATION_PRESENTATION_DISPATCHER_H_ |
| 6 #define CONTENT_RENDERER_PRESENTATION_PRESENTATION_DISPATCHER_H_ | 6 #define CONTENT_RENDERER_PRESENTATION_PRESENTATION_DISPATCHER_H_ |
| 7 | 7 |
| 8 #include "base/compiler_specific.h" |
| 9 #include "content/common/content_export.h" |
| 8 #include "content/common/presentation/presentation_service.mojom.h" | 10 #include "content/common/presentation/presentation_service.mojom.h" |
| 9 #include "content/public/renderer/render_frame_observer.h" | 11 #include "content/public/renderer/render_frame_observer.h" |
| 10 #include "third_party/WebKit/public/platform/modules/presentation/WebPresentatio
nClient.h" | 12 #include "third_party/WebKit/public/platform/modules/presentation/WebPresentatio
nClient.h" |
| 11 | 13 |
| 12 namespace content { | 14 namespace content { |
| 13 | 15 |
| 14 // PresentationDispatcher is a delegate for Presentation API messages used by | 16 // PresentationDispatcher is a delegate for Presentation API messages used by |
| 15 // Blink. It forwards the calls to the Mojo PresentationService. | 17 // Blink. It forwards the calls to the Mojo PresentationService. |
| 16 class PresentationDispatcher | 18 class CONTENT_EXPORT PresentationDispatcher |
| 17 : public RenderFrameObserver, | 19 : public RenderFrameObserver, |
| 18 public blink::WebPresentationClient { | 20 public NON_EXPORTED_BASE(blink::WebPresentationClient) { |
| 19 public: | 21 public: |
| 20 explicit PresentationDispatcher(RenderFrame* render_frame); | 22 explicit PresentationDispatcher(RenderFrame* render_frame); |
| 21 ~PresentationDispatcher() override; | 23 ~PresentationDispatcher() override; |
| 22 | 24 |
| 23 private: | 25 private: |
| 24 // WebPresentationClient implementation. | 26 // WebPresentationClient implementation. |
| 25 virtual void setController( | 27 virtual void setController( |
| 26 blink::WebPresentationController* controller); | 28 blink::WebPresentationController* controller); |
| 27 virtual void updateAvailableChangeWatched(bool watched); | 29 virtual void updateAvailableChangeWatched(bool watched); |
| 28 | 30 |
| 29 void OnScreenAvailabilityChanged(bool available); | 31 void OnScreenAvailabilityChanged(bool available); |
| 30 | 32 |
| 31 void ConnectToPresentationServiceIfNeeded(); | 33 void ConnectToPresentationServiceIfNeeded(); |
| 32 | 34 |
| 33 // Used as a weak reference. Can be null since lifetime is bound to the frame. | 35 // Used as a weak reference. Can be null since lifetime is bound to the frame. |
| 34 blink::WebPresentationController* controller_; | 36 blink::WebPresentationController* controller_; |
| 35 presentation::PresentationServicePtr presentation_service_; | 37 presentation::PresentationServicePtr presentation_service_; |
| 36 }; | 38 }; |
| 37 | 39 |
| 38 } // namespace content | 40 } // namespace content |
| 39 | 41 |
| 40 #endif // CONTENT_RENDERER_PRESENTATION_PRESENTATION_DISPATCHER_H_ | 42 #endif // CONTENT_RENDERER_PRESENTATION_PRESENTATION_DISPATCHER_H_ |
| OLD | NEW |