| 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" | |
| 10 #include "content/common/content_export.h" | 9 #include "content/common/content_export.h" |
| 11 #include "content/common/presentation/presentation_service.mojom.h" | 10 #include "content/common/presentation/presentation_service.mojom.h" |
| 12 #include "content/public/renderer/render_frame_observer.h" | 11 #include "content/public/renderer/render_frame_observer.h" |
| 13 #include "content/renderer/presentation/presentation_session_dispatcher.h" | |
| 14 #include "third_party/WebKit/public/platform/modules/presentation/WebPresentatio
nClient.h" | 12 #include "third_party/WebKit/public/platform/modules/presentation/WebPresentatio
nClient.h" |
| 15 | 13 |
| 16 namespace blink { | 14 namespace blink { |
| 17 class WebString; | 15 class WebString; |
| 18 } // namespace blink | 16 } // namespace blink |
| 19 | 17 |
| 20 namespace content { | 18 namespace content { |
| 21 | 19 |
| 22 // PresentationDispatcher is a delegate for Presentation API messages used by | 20 // PresentationDispatcher is a delegate for Presentation API messages used by |
| 23 // Blink. It forwards the calls to the Mojo PresentationService. | 21 // Blink. It forwards the calls to the Mojo PresentationService. |
| (...skipping 26 matching lines...) Expand all Loading... |
| 50 | 48 |
| 51 void OnScreenAvailabilityChanged( | 49 void OnScreenAvailabilityChanged( |
| 52 const std::string& presentation_url, | 50 const std::string& presentation_url, |
| 53 bool available); | 51 bool available); |
| 54 void OnSessionCreated( | 52 void OnSessionCreated( |
| 55 blink::WebPresentationSessionClientCallbacks* callback, | 53 blink::WebPresentationSessionClientCallbacks* callback, |
| 56 presentation::PresentationSessionInfoPtr session_info, | 54 presentation::PresentationSessionInfoPtr session_info, |
| 57 presentation::PresentationErrorPtr error); | 55 presentation::PresentationErrorPtr error); |
| 58 void OnDefaultSessionStarted( | 56 void OnDefaultSessionStarted( |
| 59 presentation::PresentationSessionInfoPtr session_info); | 57 presentation::PresentationSessionInfoPtr session_info); |
| 58 void OnSessionStateChange( |
| 59 presentation::PresentationSessionInfoPtr session_info, |
| 60 presentation::PresentationSessionState session_state); |
| 60 | 61 |
| 61 void ConnectToPresentationServiceIfNeeded(); | 62 void ConnectToPresentationServiceIfNeeded(); |
| 62 | 63 |
| 63 void DoUpdateAvailableChangeWatched( | 64 void DoUpdateAvailableChangeWatched( |
| 64 const std::string& presentation_url, | 65 const std::string& presentation_url, |
| 65 bool watched); | 66 bool watched); |
| 66 | 67 |
| 67 // Used as a weak reference. Can be null since lifetime is bound to the frame. | 68 // Used as a weak reference. Can be null since lifetime is bound to the frame. |
| 68 blink::WebPresentationController* controller_; | 69 blink::WebPresentationController* controller_; |
| 69 presentation::PresentationServicePtr presentation_service_; | 70 presentation::PresentationServicePtr presentation_service_; |
| 70 | |
| 71 // Wrappers around the PresentationSessionPtr corresponding to each Javascript | |
| 72 // PresentationSession object passed back to the frame. | |
| 73 // TODO(avayvod): Switch to base::IDMap when the lookup by presentation id is | |
| 74 // needed. | |
| 75 using PresentationSessionDispatchers = | |
| 76 ScopedVector<PresentationSessionDispatcher>; | |
| 77 PresentationSessionDispatchers presentation_session_dispatchers_; | |
| 78 }; | 71 }; |
| 79 | 72 |
| 80 } // namespace content | 73 } // namespace content |
| 81 | 74 |
| 82 #endif // CONTENT_RENDERER_PRESENTATION_PRESENTATION_DISPATCHER_H_ | 75 #endif // CONTENT_RENDERER_PRESENTATION_PRESENTATION_DISPATCHER_H_ |
| OLD | NEW |