Index: content/renderer/render_frame_impl.cc |
diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc |
index 5582fb55ff94d3324b0e821f7570388a09147b6f..59ec80196bf01c7bdc3b04b89ee25c51df53f072 100644 |
--- a/content/renderer/render_frame_impl.cc |
+++ b/content/renderer/render_frame_impl.cc |
@@ -1629,6 +1629,8 @@ bool RenderFrameImpl::OnMessageReceived(const IPC::Message& msg) { |
IPC_MESSAGE_HANDLER(FrameMsg_BlinkFeatureUsageReport, |
OnBlinkFeatureUsageReport) |
IPC_MESSAGE_HANDLER(FrameMsg_MixedContentFound, OnMixedContentFound) |
+ IPC_MESSAGE_HANDLER(FrameMsg_SetOverlayRoutingToken, |
+ OnSetOverlayRoutingToken) |
#if defined(OS_ANDROID) |
IPC_MESSAGE_HANDLER(FrameMsg_ActivateNearestFindResult, |
OnActivateNearestFindResult) |
@@ -5923,6 +5925,28 @@ void RenderFrameImpl::OnFindMatchRects(int current_version) { |
} |
#endif |
+void RenderFrameImpl::OnSetOverlayRoutingToken( |
+ const base::UnguessableToken& token) { |
+ overlay_routing_token_ = token; |
+ for (const auto& cb : pending_routing_token_callbacks_) |
+ cb.Run(overlay_routing_token_.value()); |
+ pending_routing_token_callbacks_.clear(); |
+} |
+ |
+void RenderFrameImpl::RequestOverlayRoutingToken( |
+ const media::RoutingTokenCallback& callback) { |
+ if (overlay_routing_token_.has_value()) { |
+ callback.Run(overlay_routing_token_.value()); |
+ return; |
+ } |
+ |
+ // Send a request to the host for the token. We'll notify |callback| when it |
+ // arrives later. |
+ Send(new FrameHostMsg_RequestOverlayRoutingToken(routing_id_)); |
+ |
+ pending_routing_token_callbacks_.push_back(callback); |
+} |
+ |
#if BUILDFLAG(USE_EXTERNAL_POPUP_MENU) |
#if defined(OS_MACOSX) |
void RenderFrameImpl::OnSelectPopupMenuItem(int selected_index) { |