Chromium Code Reviews| 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" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/memory/scoped_vector.h" | |
| 9 #include "content/common/content_export.h" | 10 #include "content/common/content_export.h" |
| 10 #include "content/common/presentation/presentation_service.mojom.h" | 11 #include "content/common/presentation/presentation_service.mojom.h" |
| 11 #include "content/public/renderer/render_frame_observer.h" | 12 #include "content/public/renderer/render_frame_observer.h" |
| 13 #include "content/renderer/presentation/presentation_session_dispatcher.h" | |
| 12 #include "third_party/WebKit/public/platform/modules/presentation/WebPresentatio nClient.h" | 14 #include "third_party/WebKit/public/platform/modules/presentation/WebPresentatio nClient.h" |
| 13 | 15 |
| 14 namespace content { | 16 namespace content { |
| 15 | 17 |
| 16 // PresentationDispatcher is a delegate for Presentation API messages used by | 18 // PresentationDispatcher is a delegate for Presentation API messages used by |
| 17 // Blink. It forwards the calls to the Mojo PresentationService. | 19 // Blink. It forwards the calls to the Mojo PresentationService. |
| 18 class CONTENT_EXPORT PresentationDispatcher | 20 class CONTENT_EXPORT PresentationDispatcher |
| 19 : public RenderFrameObserver, | 21 : public RenderFrameObserver, |
| 20 public NON_EXPORTED_BASE(blink::WebPresentationClient) { | 22 public NON_EXPORTED_BASE(blink::WebPresentationClient) { |
| 21 public: | 23 public: |
| 22 explicit PresentationDispatcher(RenderFrame* render_frame); | 24 explicit PresentationDispatcher(RenderFrame* render_frame); |
| 23 ~PresentationDispatcher() override; | 25 ~PresentationDispatcher() override; |
| 24 | 26 |
| 25 private: | 27 private: |
| 26 // WebPresentationClient implementation. | 28 // WebPresentationClient implementation. |
| 27 virtual void setController( | 29 virtual void setController( |
| 28 blink::WebPresentationController* controller); | 30 blink::WebPresentationController* controller); |
| 29 virtual void updateAvailableChangeWatched(bool watched); | 31 virtual void updateAvailableChangeWatched(bool watched); |
| 32 virtual void startSession( | |
| 33 const blink::WebString& presentationUrl, | |
| 34 const blink::WebString& presentationId, | |
| 35 blink::WebPresentationSessionClientCallbacks* callback); | |
| 36 virtual void joinSession( | |
| 37 const blink::WebString& presentationUrl, | |
| 38 const blink::WebString& presentationId, | |
| 39 blink::WebPresentationSessionClientCallbacks* callback); | |
| 30 | 40 |
| 31 void OnScreenAvailabilityChanged(bool available); | 41 void OnScreenAvailabilityChanged(bool available); |
| 42 void OnSessionCreated( | |
| 43 blink::WebPresentationSessionClientCallbacks* callback, | |
| 44 presentation::PresentationSessionInfoPtr session_info, | |
| 45 presentation::PresentationErrorPtr error); | |
| 32 | 46 |
| 33 void ConnectToPresentationServiceIfNeeded(); | 47 void ConnectToPresentationServiceIfNeeded(); |
| 34 | 48 |
| 35 // Used as a weak reference. Can be null since lifetime is bound to the frame. | 49 // Used as a weak reference. Can be null since lifetime is bound to the frame. |
| 36 blink::WebPresentationController* controller_; | 50 blink::WebPresentationController* controller_; |
| 37 presentation::PresentationServicePtr presentation_service_; | 51 presentation::PresentationServicePtr presentation_service_; |
| 52 | |
| 53 // Wrappers around the PresentationSessionPtr corresponding to each Javascript | |
| 54 // PresentationSession object passed back to the frame. | |
| 55 typedef ScopedVector<PresentationSessionDispatcher> PresentationSessions; | |
|
mlamouri (slow - plz ping)
2015/02/23 14:07:39
using PresentationSessions = ScopedVector<Presenta
whywhat
2015/02/25 14:12:42
Done.
| |
| 56 PresentationSessions presentation_sessions_; | |
| 38 }; | 57 }; |
| 39 | 58 |
| 40 } // namespace content | 59 } // namespace content |
| 41 | 60 |
| 42 #endif // CONTENT_RENDERER_PRESENTATION_PRESENTATION_DISPATCHER_H_ | 61 #endif // CONTENT_RENDERER_PRESENTATION_PRESENTATION_DISPATCHER_H_ |
| OLD | NEW |