dpwa: Fix user_display_mode field migration.
Background: WebAppMigrationManager uses BookmarkAppRegistrar::GetAppUserDisplayMode() getter to obtain user_display_mode field. user_display_mode is a user-controllable field which we sync across all user's devices. user_display_mode shouldn't depend on anything else (like manifest display mode or any other web app field) The call path: BookmarkAppRegistrar::GetAppUserDisplayMode() -> extensions::GetLaunchContainer() -> extensions::GetLaunchType() -> extensions::GetLaunchTypePrefValue(). The problem: While extensions::GetLaunchTypePrefValue() returns a raw launch_type that we are really interested in, extensions::GetLaunchType() resets launch_type to "run as a tab" if the bookmark app is not locally installed (Background: we sync bookmark apps as non-locally installed on all OSes except ChromeOS): LaunchType GetLaunchType(const ExtensionPrefs* prefs, const Extension* extension) { ... // Force hosted apps that are not locally installed to open in tabs. if (extension->is_hosted_app() && !BookmarkAppIsLocallyInstalled(prefs, extension)) { result = LAUNCH_TYPE_REGULAR; } else ... } This is the place where we were loosing information. If local migration happens first on a device with non-locally installed app, this preference gets uploaded to the sync server as the source of truth. As a result, all secondary installs treat this "run as a tab" value as a user choice. Solution: Our ideal raw GetAppUserDisplayModeForMigration() getter must not "Force hosted apps that are not locally installed to open in tabs". We need to convert a raw value from prefs extensions::GetLaunchTypePrefValue() using a switch statement with all cases covered. This is a P0 bug. This CL will be merged into M85 branch ASAP. TBR=mgiuca@chromium.org Bug: 1125020 Change-Id: Ie68aa8a86a2a052456fa66349bbd86758aaa56db Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2392168 Commit-Queue: Alexey Baskakov <loyso@chromium.org> Reviewed-by:Alexey Baskakov <loyso@chromium.org> Cr-Commit-Position: refs/heads/master@{#804537}
Showing
Please register or sign in to comment