Description[Hotword] Uninstall and reinstall the extension upon language change.
There are two places we check to see if we need uninstall-install. The first is on startup when the extension system is ready (in response to the ExtensionSystem::ready() OneShot timer). If the extension is currently pending, then we'll check again when we get the notification that the extension has installed when OnExtensionInstalled is called.
The function MaybeUninstallHotwordExtension does a series of checks to determine if we should uninstall the extension based on pending installs and previous vs. current locale. If an uninstall is necessary, it kicks it off.
Upon Uninstall, OnExtensionUninstalled is triggered. When OnExtensionUninstalled is triggered for the hotword extension, it will reinstall it and update the previous locale (language). If the user goes in to try to uninstall the hotword extension manually, this change will also force it to be reinstalled.
This will trigger a second call to OnExtensionInstalled. To prevent a loop, we use HotwordService::uninstall_pending_ to prevent another uninstall attempt.
This CL also removes the dependency on the deprecated NOTIFICATION_EXTENSION_INSTALLED as a side effect.
Several unittests were added to the unittest suite to test various parts of the uninstall-install pipeline. In order to have access to the extension system during tests, the HotwordServiceTest now extends ExtensionServiceTestBase.
BUG=345806
Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=278644
Patch Set 1 #Patch Set 2 : fixing logic #Patch Set 3 : revert files only touched for debugging #Patch Set 4 : cleanup, fix previous locale logic #Patch Set 5 : cleanup #Patch Set 6 : more cleanup #
Total comments: 27
Patch Set 7 : uninstall->reinstall, typos, other fixes #Patch Set 8 : fix comment #
Total comments: 17
Patch Set 9 : responding to comments #
Total comments: 6
Patch Set 10 : typo, reinstall_pending_ fix #Patch Set 11 : compile error: only reference an extension installer if extensions are enabled #Patch Set 12 : fix unittest compile errors #
Messages
Total messages: 19 (0 generated)
|