Created
October 15, 2023 05:49
-
-
Save t4kemyh4nd/34daed00c7437c63b5ae5029691e6f0c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void AddToHomescreenInstaller::Install( | |
content::WebContents* web_contents, | |
const AddToHomescreenParams& params, | |
const base::RepeatingCallback<void(Event, const AddToHomescreenParams&)>& | |
event_callback) { | |
if (!web_contents) { | |
event_callback.Run(Event::INSTALL_FAILED, params); | |
return; | |
} | |
event_callback.Run(Event::INSTALL_STARTED, params); | |
switch (params.app_type) { | |
case AddToHomescreenParams::AppType::NATIVE: | |
InstallOrOpenNativeApp(web_contents, params, event_callback); | |
break; | |
case AddToHomescreenParams::AppType::WEBAPK: | |
WebappsClient::Get()->InstallWebApk(web_contents, params); | |
break; | |
case AddToHomescreenParams::AppType::SHORTCUT: | |
WebappsClient::Get()->InstallShortcut(web_contents, params); | |
break; | |
} | |
event_callback.Run(Event::INSTALL_REQUEST_FINISHED, params); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment