Commit 3eac14ba authored by Ryan Daum's avatar Ryan Daum Committed by Commit Bot

[chromecast] Null-check webview webcontents before focus

When obtaining initial focus when a webview becomes visible,
ensure that the contained web contents within a webview are valid
before attempting to focus it.

Bug: internal b/173633818
Test: manual
Change-Id: I7abec0ca2ccf4d4a804fbafc3c630d0def7ce242
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2550161
Commit-Queue: Ryan Daum <rdaum@chromium.org>
Reviewed-by: default avatarDaniel Nicoara <dnicoara@chromium.org>
Cr-Commit-Position: refs/heads/master@{#829276}
parent c846cbbc
......@@ -206,7 +206,12 @@ void WebContentController::AttachTo(aura::Window* window, int window_id) {
void WebContentController::OnVisible(aura::Window* window) {
// Acquire initial focus.
GetWebContents()->SetInitialFocus();
auto* contents = GetWebContents();
if (contents) contents->SetInitialFocus();
else {
LOG(WARNING)
<< "Webview unable to acquire initial focus due to missing webcontents";
}
// Register for IME events
input_method_observer_ = std::make_unique<WebviewInputMethodObserver>(
......
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