| 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/id_map.h" | 9 #include "base/id_map.h" |
| 10 #include "base/memory/linked_ptr.h" | 10 #include "base/memory/linked_ptr.h" |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 presentation::PresentationSessionInfoPtr session_info); | 91 presentation::PresentationSessionInfoPtr session_info); |
| 92 void OnSessionMessagesReceived( | 92 void OnSessionMessagesReceived( |
| 93 mojo::Array<presentation::SessionMessagePtr> messages); | 93 mojo::Array<presentation::SessionMessagePtr> messages); |
| 94 void DoSendMessage(const presentation::SessionMessage& session_message); | 94 void DoSendMessage(const presentation::SessionMessage& session_message); |
| 95 void HandleSendMessageRequests(bool success); | 95 void HandleSendMessageRequests(bool success); |
| 96 | 96 |
| 97 void ConnectToPresentationServiceIfNeeded(); | 97 void ConnectToPresentationServiceIfNeeded(); |
| 98 | 98 |
| 99 void UpdateListeningState(); | 99 void UpdateListeningState(); |
| 100 | 100 |
| 101 void StartListenForMessages(); |
| 102 |
| 101 // Used as a weak reference. Can be null since lifetime is bound to the frame. | 103 // Used as a weak reference. Can be null since lifetime is bound to the frame. |
| 102 blink::WebPresentationController* controller_; | 104 blink::WebPresentationController* controller_; |
| 103 presentation::PresentationServicePtr presentation_service_; | 105 presentation::PresentationServicePtr presentation_service_; |
| 104 mojo::Binding<presentation::PresentationServiceClient> binding_; | 106 mojo::Binding<presentation::PresentationServiceClient> binding_; |
| 105 | 107 |
| 106 // Message requests are queued here and only one message at a time is sent | 108 // Message requests are queued here and only one message at a time is sent |
| 107 // over mojo channel. | 109 // over mojo channel. |
| 108 using MessageRequestQueue = | 110 using MessageRequestQueue = |
| 109 std::queue<linked_ptr<presentation::SessionMessage>>; | 111 std::queue<linked_ptr<presentation::SessionMessage>>; |
| 110 MessageRequestQueue message_request_queue_; | 112 MessageRequestQueue message_request_queue_; |
| 111 | 113 |
| 112 enum class ListeningState { | 114 enum class ListeningState { |
| 113 Inactive, | 115 Inactive, |
| 114 Waiting, | 116 Waiting, |
| 115 Active, | 117 Active, |
| 116 }; | 118 }; |
| 117 | 119 |
| 118 ListeningState listening_state_; | 120 ListeningState listening_state_; |
| 119 bool last_known_availability_; | 121 bool last_known_availability_; |
| 120 | 122 |
| 121 using AvailabilityCallbacksMap = | 123 using AvailabilityCallbacksMap = |
| 122 IDMap<blink::WebPresentationAvailabilityCallbacks, IDMapOwnPointer>; | 124 IDMap<blink::WebPresentationAvailabilityCallbacks, IDMapOwnPointer>; |
| 123 AvailabilityCallbacksMap availability_callbacks_; | 125 AvailabilityCallbacksMap availability_callbacks_; |
| 124 | 126 |
| 125 using AvailabilityObserversSet = | 127 using AvailabilityObserversSet = |
| 126 std::set<blink::WebPresentationAvailabilityObserver*>; | 128 std::set<blink::WebPresentationAvailabilityObserver*>; |
| 127 AvailabilityObserversSet availability_observers_; | 129 AvailabilityObserversSet availability_observers_; |
| 128 | 130 |
| 131 bool listening_for_messages_; |
| 132 |
| 129 DISALLOW_COPY_AND_ASSIGN(PresentationDispatcher); | 133 DISALLOW_COPY_AND_ASSIGN(PresentationDispatcher); |
| 130 }; | 134 }; |
| 131 | 135 |
| 132 } // namespace content | 136 } // namespace content |
| 133 | 137 |
| 134 #endif // CONTENT_RENDERER_PRESENTATION_PRESENTATION_DISPATCHER_H_ | 138 #endif // CONTENT_RENDERER_PRESENTATION_PRESENTATION_DISPATCHER_H_ |
| OLD | NEW |