Commit 05099f34 authored by nancy's avatar nancy Committed by Commit Bot

Check MultiUserWindowManager before setting window's owner.

When adding a new user, although IsMultiProfileAvailable return true,
MultiUserWindowManagerHelper::GetWindowManager is still null. So add a
check for MultiUserWindowManagerHelper::GetWindowManager. When
MultiUserWindowManagerHelper::GetWindowManager is still null, we don't
need set owner for windows, because multiple user window manager is not
ready yet.

BUG=1047376

Change-Id: Idb527b24e0f7d66714b6f408b08f20e50b6f8c32
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2032486Reviewed-by: default avatarDominick Ng <dominickn@chromium.org>
Commit-Queue: Nancy Wang <nancylingwang@chromium.org>
Cr-Commit-Position: refs/heads/master@{#737225}
parent c8e042cb
......@@ -783,9 +783,13 @@ void ExtensionApps::OnAppWindowAdded(extensions::AppWindow* app_window) {
// Attach window to multi-user manager now to let it manage visibility state
// of the window correctly.
if (SessionControllerClientImpl::IsMultiProfileAvailable()) {
MultiUserWindowManagerHelper::GetWindowManager()->SetWindowOwner(
app_window->GetNativeWindow(),
multi_user_util::GetAccountIdFromProfile(profile_));
auto* multi_user_window_manager =
MultiUserWindowManagerHelper::GetWindowManager();
if (multi_user_window_manager) {
multi_user_window_manager->SetWindowOwner(
app_window->GetNativeWindow(),
multi_user_util::GetAccountIdFromProfile(profile_));
}
}
RegisterInstance(app_window, InstanceState::kStarted);
}
......
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