Commit c57fd53f authored by Christopher Cameron's avatar Christopher Cameron Committed by Commit Bot

MacPWAs: Fix crash in non-multi-profile

The funciton UpdateAppProfileMenu should only be hit when in
multi-profile mode.

TBR=dominickn

Bug: 1017755
Change-Id: Ib35aeb8ed4da2ff2af669c01d4996e4c278adfff
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1879687Reviewed-by: default avatarccameron <ccameron@chromium.org>
Commit-Queue: ccameron <ccameron@chromium.org>
Cr-Commit-Position: refs/heads/master@{#709116}
parent 4c4800ca
...@@ -970,6 +970,7 @@ void ExtensionAppShimHandler::OnGotProfilesForApp( ...@@ -970,6 +970,7 @@ void ExtensionAppShimHandler::OnGotProfilesForApp(
if (found_app == apps_.end()) if (found_app == apps_.end())
return; return;
AppState* app_state = found_app->second.get(); AppState* app_state = found_app->second.get();
DCHECK(app_state->IsMultiProfile());
app_state->installed_profiles.clear(); app_state->installed_profiles.clear();
for (const auto& profile_path : profiles) for (const auto& profile_path : profiles)
app_state->installed_profiles.insert(profile_path); app_state->installed_profiles.insert(profile_path);
...@@ -1043,10 +1044,12 @@ ExtensionAppShimHandler::GetOrCreateProfileState( ...@@ -1043,10 +1044,12 @@ ExtensionAppShimHandler::GetOrCreateProfileState(
// ideally this should be done when when |multi_profile_host| is created // ideally this should be done when when |multi_profile_host| is created
// above, and should be updated when apps are installed or uninstalled // above, and should be updated when apps are installed or uninstalled
// (but do not). // (but do not).
UpdateProfileMenuItems(); if (app_state->IsMultiProfile()) {
GetProfilesForAppAsync( UpdateProfileMenuItems();
app_id, base::BindOnce(&ExtensionAppShimHandler::OnGotProfilesForApp, GetProfilesForAppAsync(
weak_factory_.GetWeakPtr(), app_id)); app_id, base::BindOnce(&ExtensionAppShimHandler::OnGotProfilesForApp,
weak_factory_.GetWeakPtr(), app_id));
}
} }
return found_profile->second.get(); return found_profile->second.get();
} }
......
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