Add new CastWebContents::Observer callback
This CL adds a new callback to the public implementation of CastWebContents. This is used to allow clients to hook in to when navigation is ready, which is needed for including mirroring in the Cast Runtime. For comparison with eqivalent fuchsia code, see: https://source.chromium.org/chromium/chromium/src/+/main:fuchsia/engine/browser/frame_impl.cc;l=1161 Bug: internal b/188547579 Change-Id: I5bb83e021b6073e965bdada7769a1cdcdec0fb61 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2915660 Reviewed-by: Sean Topping <seantopping@chromium.org> Commit-Queue: Ryan Keane <rwkeane@google.com> Cr-Commit-Position: refs/heads/master@{#886335}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
f7bc050733
commit
0d0493d4f0
chromecast/browser
@ -27,6 +27,7 @@ class AssociatedInterfaceProvider;
|
||||
} // namespace blink
|
||||
|
||||
namespace content {
|
||||
class NavigationHandle;
|
||||
class WebContents;
|
||||
} // namespace content
|
||||
|
||||
@ -155,6 +156,11 @@ class CastWebContents {
|
||||
service_manager::InterfaceProvider* frame_interfaces,
|
||||
blink::AssociatedInterfaceProvider* frame_associated_interfaces) {}
|
||||
|
||||
// Called when the navigation is ready to be committed in the WebContents'
|
||||
// main frame.
|
||||
virtual void MainFrameReadyToCommitNavigation(
|
||||
content::NavigationHandle* navigation_handle) {}
|
||||
|
||||
// A navigation has finished in the WebContents' main frame.
|
||||
virtual void MainFrameFinishedNavigation() {}
|
||||
|
||||
|
@ -643,14 +643,17 @@ void CastWebContentsImpl::ReadyToCommitNavigation(
|
||||
// Skip injecting bindings scripts if |navigation_handle| is not
|
||||
// 'current' main frame navigation, e.g. another DidStartNavigation is
|
||||
// emitted. Also skip injecting for same document navigation and error page.
|
||||
if (navigation_handle != active_navigation_ ||
|
||||
navigation_handle->IsErrorPage()) {
|
||||
return;
|
||||
if (navigation_handle == active_navigation_ &&
|
||||
!navigation_handle->IsErrorPage()) {
|
||||
// Injects registered bindings script into the main frame.
|
||||
script_injector_.InjectScriptsForURL(
|
||||
navigation_handle->GetURL(), navigation_handle->GetRenderFrameHost());
|
||||
}
|
||||
|
||||
// Injects registered bindings script into the main frame.
|
||||
script_injector_.InjectScriptsForURL(navigation_handle->GetURL(),
|
||||
navigation_handle->GetRenderFrameHost());
|
||||
// Notifies observers that the navigation of the main frame is ready.
|
||||
for (Observer& observer : observer_list_) {
|
||||
observer.MainFrameReadyToCommitNavigation(navigation_handle);
|
||||
}
|
||||
}
|
||||
|
||||
void CastWebContentsImpl::DidFinishNavigation(
|
||||
|
Reference in New Issue
Block a user