Commit f1d3e023 authored by Josh Simmons's avatar Josh Simmons Committed by Commit Bot

Ensure AppServiceProxy is present before use in ExecuteWebTask.

The App Service is not present for all profiles (ie. when in Incognito
mode). After requesting it for a profile, ensure we got back a valid
pointer before use.

      Incognito mode. Expect Chrome not to crash. Chrome does not Crash.

Bug: 1111695
Test: Try to launch default app from "File Saved" notification while in
Test: out/Default/browser_tests --gtest-filter="*FilesAppBrowserTest*"
Change-Id: I04a88fc756bcba2898f4b990dc412b58e6df0c63
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2360089Reviewed-by: default avatarAlex Danilo <adanilo@chromium.org>
Commit-Queue: Josh Simmons <simmonsjosh@google.com>
Cr-Commit-Position: refs/heads/master@{#799543}
parent 565de6ec
...@@ -142,6 +142,14 @@ void ExecuteWebTask(Profile* profile, ...@@ -142,6 +142,14 @@ void ExecuteWebTask(Profile* profile,
for (const auto& file_system_url : file_system_urls) for (const auto& file_system_url : file_system_urls)
launch_files->file_paths.push_back(file_system_url.path()); launch_files->file_paths.push_back(file_system_url.path());
// App Service doesn't exist in Incognito mode but apps can be
// launched (ie. default handler to open a download from its
// notification) from Incognito mode. Use the base profile in these
// cases (see crbug.com/1111695).
if (profile->IsOffTheRecord()) {
profile = profile->GetOriginalProfile();
}
apps::AppServiceProxy* proxy = apps::AppServiceProxy* proxy =
apps::AppServiceProxyFactory::GetForProfile(profile); apps::AppServiceProxyFactory::GetForProfile(profile);
proxy->LaunchAppWithFiles( proxy->LaunchAppWithFiles(
......
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