Index: content/renderer/render_frame_impl.cc |
diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc |
index 8887a3dd1ac3e86347b1e38ce81d5d8d7f304b94..bfa26ac8d01275683229ae65c38b3988ce4df62f 100644 |
--- a/content/renderer/render_frame_impl.cc |
+++ b/content/renderer/render_frame_impl.cc |
@@ -1610,6 +1610,8 @@ bool RenderFrameImpl::OnMessageReceived(const IPC::Message& msg) { |
IPC_MESSAGE_HANDLER(FrameMsg_GetNearestFindResult, |
OnGetNearestFindResult) |
IPC_MESSAGE_HANDLER(FrameMsg_FindMatchRects, OnFindMatchRects) |
+ IPC_MESSAGE_HANDLER(FrameMsg_SetOverlayRoutingToken, |
+ OnSetOverlayRoutingToken) |
#endif |
#if BUILDFLAG(USE_EXTERNAL_POPUP_MENU) |
@@ -5850,6 +5852,28 @@ void RenderFrameImpl::OnFindMatchRects(int current_version) { |
Send(new FrameHostMsg_FindMatchRects_Reply(routing_id_, rects_version, |
match_rects, active_rect)); |
} |
+ |
+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::GetOverlayRoutingToken( |
+ 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); |
+} |
#endif |
#if BUILDFLAG(USE_EXTERNAL_POPUP_MENU) |