Commit e54c1e5b authored by Dave Tapuska's avatar Dave Tapuska Committed by Chromium LUCI CQ

Update the controls state when the main frame is available.

In https://crrev.com/2613151 we waited until the view was to send the
message. Which when creating the view and the main frame is correct, but
when it gets navigated it isn't what we want.

A new scenario crept up with opening a preview image first, and then
loading a preview page. This caused the RenderFrameCreated gets called
before the main frame mojo channel is attached and the message is dropped.

To mitigate this use a different callback (DocumentAvailableInMainFrame)
which guarantees the main frame has been attached.

BUG=1158712

Change-Id: I91f61ebec049690bc0fa8ef053612dd985c12443
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2622276Reviewed-by: default avatarShakti Sahu <shaktisahu@chromium.org>
Commit-Queue: Dave Tapuska <dtapuska@chromium.org>
Cr-Commit-Position: refs/heads/master@{#842532}
parent 6ece5244
......@@ -47,13 +47,9 @@ void ThinWebView::Destroy(JNIEnv* env, const JavaParamRef<jobject>& object) {
delete this;
}
void ThinWebView::RenderFrameCreated(
content::RenderFrameHost* render_frame_host) {
// Only update the browser controls state for the main frame.
if (render_frame_host->GetParent())
return;
void ThinWebView::DocumentAvailableInMainFrame() {
// Disable browser controls when used for thin webview.
render_frame_host->UpdateBrowserControlsState(
web_contents_->GetMainFrame()->UpdateBrowserControlsState(
cc::BrowserControlsState::kHidden, cc::BrowserControlsState::kHidden,
false);
}
......
......@@ -46,7 +46,7 @@ class ThinWebView : public content::WebContentsObserver {
private:
// content::WebContentsObserver overrides:
void RenderFrameCreated(content::RenderFrameHost* render_frame_host) override;
void DocumentAvailableInMainFrame() override;
void SetWebContents(
content::WebContents* web_contents,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment