| 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 <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 using MessageRequestQueue = std::queue<std::unique_ptr<SendMessageRequest>>; | 151 using MessageRequestQueue = std::queue<std::unique_ptr<SendMessageRequest>>; |
| 152 MessageRequestQueue message_request_queue_; | 152 MessageRequestQueue message_request_queue_; |
| 153 | 153 |
| 154 enum class ListeningState { | 154 enum class ListeningState { |
| 155 INACTIVE, | 155 INACTIVE, |
| 156 WAITING, | 156 WAITING, |
| 157 ACTIVE, | 157 ACTIVE, |
| 158 }; | 158 }; |
| 159 | 159 |
| 160 using AvailabilityCallbacksMap = | 160 using AvailabilityCallbacksMap = |
| 161 IDMap<blink::WebPresentationAvailabilityCallbacks, IDMapOwnPointer>; | 161 IDMap<std::unique_ptr<blink::WebPresentationAvailabilityCallbacks>>; |
| 162 using AvailabilityObserversSet = | 162 using AvailabilityObserversSet = |
| 163 std::set<blink::WebPresentationAvailabilityObserver*>; | 163 std::set<blink::WebPresentationAvailabilityObserver*>; |
| 164 | 164 |
| 165 // Tracks status of presentation displays availability for |availability_url|. | 165 // Tracks status of presentation displays availability for |availability_url|. |
| 166 struct AvailabilityStatus { | 166 struct AvailabilityStatus { |
| 167 explicit AvailabilityStatus(const GURL& availability_url); | 167 explicit AvailabilityStatus(const GURL& availability_url); |
| 168 ~AvailabilityStatus(); | 168 ~AvailabilityStatus(); |
| 169 | 169 |
| 170 const GURL url; | 170 const GURL url; |
| 171 bool last_known_availability; | 171 bool last_known_availability; |
| 172 ListeningState listening_state; | 172 ListeningState listening_state; |
| 173 AvailabilityCallbacksMap availability_callbacks; | 173 AvailabilityCallbacksMap availability_callbacks; |
| 174 AvailabilityObserversSet availability_observers; | 174 AvailabilityObserversSet availability_observers; |
| 175 }; | 175 }; |
| 176 | 176 |
| 177 // Map of AvailabilityStatus for known URLs. | 177 // Map of AvailabilityStatus for known URLs. |
| 178 std::map<GURL, std::unique_ptr<AvailabilityStatus>> | 178 std::map<GURL, std::unique_ptr<AvailabilityStatus>> |
| 179 availability_status_; | 179 availability_status_; |
| 180 | 180 |
| 181 // Updates the listening state of availability for |status| and notifies the | 181 // Updates the listening state of availability for |status| and notifies the |
| 182 // client. | 182 // client. |
| 183 void UpdateListeningState(AvailabilityStatus* status); | 183 void UpdateListeningState(AvailabilityStatus* status); |
| 184 | 184 |
| 185 DISALLOW_COPY_AND_ASSIGN(PresentationDispatcher); | 185 DISALLOW_COPY_AND_ASSIGN(PresentationDispatcher); |
| 186 }; | 186 }; |
| 187 | 187 |
| 188 } // namespace content | 188 } // namespace content |
| 189 | 189 |
| 190 #endif // CONTENT_RENDERER_PRESENTATION_PRESENTATION_DISPATCHER_H_ | 190 #endif // CONTENT_RENDERER_PRESENTATION_PRESENTATION_DISPATCHER_H_ |
| OLD | NEW |