New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 621393 link

Starred by 5 users

Issue metadata

Status: Fixed
Owner:
Long OOO (go/where-is-mgiuca)
Closed: Sep 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: All
Pri: 3
Type: Feature

Blocked on:
issue 688178
issue 688179
issue 688183
issue 772282

Blocking:
issue 623821



Sign in to add a comment

Web App Manifest: Implement appinstalled event

Project Member Reported by mgiuca@chromium.org, Jun 20 2016

Issue description

Spec: https://www.w3.org/TR/appmanifest/#oninstall-attribute

This essentially involves notifying the website that it has been installed by the user.

It isn't clear whether this needs a separate Blink intent-to-implement or whether it fits into the existing mandate for implementing Web App Manifest.
 

Comment 1 by mgiuca@chromium.org, Jun 20 2016

I did some research, looking at the Android implementation first.

1. This is where it's initiated in the Android UI: https://cs.chromium.org/chromium/src/chrome/android/java/src/org/chromium/chrome/browser/webapps/AddToHomescreenDialogHelper.java
2. It calls to https://cs.chromium.org/chromium/src/chrome/browser/android/webapps/add_to_homescreen_dialog_helper.cc to actually create the shortcuts. That's likely where the event would be triggered from.

Unfortunately, that code is in the Browser process and has no knowledge (that I can find) if what Renderer process it came from). Sending that message back into the Renderer and into Blink will require some gymnastics.
The add to homescreen dialog helper should have a WebContents available via data_fetcher_->web_contents(), which gives you the appropriate renderer. The app banner system does something very similar to this for the beforeinstallprompt event, which calls from the browser process to Blink via WebContents::GetMainFrame::Send, fires off a Javascript event, and waits for a response back before proceeding.

As an aside, you'll also need to trigger this event from the app banner code. That means you probably want to fire it in shortcut_helper.cc, since both add to homescreen and app banners call into there.

I'm thinking of porting the app banner IPCs to Mojo in the near future. This new event should probably use Mojo from the start. It may be worth doing the app banner port first before implementing this event.
Cc: owe...@chromium.org
Components: -Blink UI>Browser>AppShortcuts

Comment 5 by mgiuca@chromium.org, Jun 20 2016

OK I'll do the app banner as a Mojo service (since I know how to do that already). Let's not block on porting the app banner IPCs but we can use the oninstall service as a template for doing that later. Thanks for the tips.

Comment 6 by mgiuca@chromium.org, Jun 23 2016

Notes from Dom:

AddToHomescreenDataFetcher::FetchSplashScreenImageCallback -- this is called back *after* the app is installed and is therefore the correct time to deliver the oninstall event. Rename or rework around this and send message to its web_contents().

Comment 7 by mgiuca@chromium.org, Jun 28 2016

Blocking: 623821

Comment 8 by mgiuca@chromium.org, Oct 12 2016

Status: Started (was: Assigned)
Summary: Web App Manifest: Implement appinstalled event (was: Web App Manifest: Implement oninstall event)
This event has been renamed in the spec (see https://github.com/w3c/manifest/pull/503). It is now "appinstalled".

https://www.w3.org/TR/appmanifest/#onappinstalled-attribute
Project Member

Comment 9 by bugdroid1@chromium.org, Dec 19 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/b02c2580cd1427502c41072ebe834993b1d139d0

commit b02c2580cd1427502c41072ebe834993b1d139d0
Author: mgiuca <mgiuca@chromium.org>
Date: Mon Dec 19 05:44:02 2016

Implement "appinstalled" event on Android.

This event is fired when a web app is "installed" (i.e., a shortcut is
added to home screen).

This implements from the working draft of Web App Manifest:
https://www.w3.org/TR/appmanifest/#onappinstalled-attribute

BUG= 621393 

Review-Url: https://codereview.chromium.org/2379923002
Cr-Commit-Position: refs/heads/master@{#439416}

[modify] https://crrev.com/b02c2580cd1427502c41072ebe834993b1d139d0/chrome/android/javatests/src/org/chromium/chrome/browser/banners/AppBannerManagerTest.java
[modify] https://crrev.com/b02c2580cd1427502c41072ebe834993b1d139d0/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/AddToHomescreenManagerTest.java
[modify] https://crrev.com/b02c2580cd1427502c41072ebe834993b1d139d0/chrome/browser/DEPS
[modify] https://crrev.com/b02c2580cd1427502c41072ebe834993b1d139d0/chrome/browser/android/banners/app_banner_infobar_delegate_android.cc
[modify] https://crrev.com/b02c2580cd1427502c41072ebe834993b1d139d0/chrome/browser/android/webapps/add_to_homescreen_manager.cc
[modify] https://crrev.com/b02c2580cd1427502c41072ebe834993b1d139d0/chrome/browser/banners/app_banner_manager.cc
[modify] https://crrev.com/b02c2580cd1427502c41072ebe834993b1d139d0/chrome/browser/banners/app_banner_manager.h
[add] https://crrev.com/b02c2580cd1427502c41072ebe834993b1d139d0/chrome/test/data/banners/appinstalled_test_page.html
[modify] https://crrev.com/b02c2580cd1427502c41072ebe834993b1d139d0/chrome/test/data/banners/main.js
[modify] https://crrev.com/b02c2580cd1427502c41072ebe834993b1d139d0/content/public/app/mojo/content_renderer_manifest.json
[modify] https://crrev.com/b02c2580cd1427502c41072ebe834993b1d139d0/third_party/WebKit/Source/core/events/EventTarget.cpp
[modify] https://crrev.com/b02c2580cd1427502c41072ebe834993b1d139d0/third_party/WebKit/Source/core/events/EventTypeNames.in
[modify] https://crrev.com/b02c2580cd1427502c41072ebe834993b1d139d0/third_party/WebKit/Source/core/frame/UseCounter.h
[modify] https://crrev.com/b02c2580cd1427502c41072ebe834993b1d139d0/third_party/WebKit/Source/modules/BUILD.gn
[add] https://crrev.com/b02c2580cd1427502c41072ebe834993b1d139d0/third_party/WebKit/Source/modules/installation/BUILD.gn
[add] https://crrev.com/b02c2580cd1427502c41072ebe834993b1d139d0/third_party/WebKit/Source/modules/installation/DEPS
[add] https://crrev.com/b02c2580cd1427502c41072ebe834993b1d139d0/third_party/WebKit/Source/modules/installation/InstallationServiceImpl.cpp
[add] https://crrev.com/b02c2580cd1427502c41072ebe834993b1d139d0/third_party/WebKit/Source/modules/installation/InstallationServiceImpl.h
[modify] https://crrev.com/b02c2580cd1427502c41072ebe834993b1d139d0/third_party/WebKit/Source/web/WebLocalFrameImpl.cpp
[modify] https://crrev.com/b02c2580cd1427502c41072ebe834993b1d139d0/third_party/WebKit/public/BUILD.gn
[add] https://crrev.com/b02c2580cd1427502c41072ebe834993b1d139d0/third_party/WebKit/public/platform/modules/installation/OWNERS
[add] https://crrev.com/b02c2580cd1427502c41072ebe834993b1d139d0/third_party/WebKit/public/platform/modules/installation/installation.mojom
[modify] https://crrev.com/b02c2580cd1427502c41072ebe834993b1d139d0/tools/metrics/histograms/histograms.xml

Blockedon: 688178
Blockedon: 688179
Blockedon: 688183
Added some sub-bugs, including (importantly) firing the event for WebAPKs on Android ( Issue 688178 ).
Components: -Manifest Blink>AppManifest
Deprecate (and bulk edit/ move) Manifest
Components: UI>Browser>WebAppInstalls
Status: Fixed (was: Started)
Blockedon: 772282

Sign in to add a comment