[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 Review URL: https://codereview.chromium.org/330193005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@278644 0039d316-1c4b-4281-b951-d872f2087c98
Showing
This diff is collapsed.
Please register or sign in to comment