Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(163)

Unified Diff: chrome/browser/android/webapps/add_to_homescreen_manager.cc

Issue 2670963002: Android: Fire the appinstalled event on WebAPK installation. (Closed)
Patch Set: Rebase. Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/android/webapps/add_to_homescreen_manager.cc
diff --git a/chrome/browser/android/webapps/add_to_homescreen_manager.cc b/chrome/browser/android/webapps/add_to_homescreen_manager.cc
index 65ab2632057de7f340d6a500f8e3eff6e8bd0b74..064cf1f3cb2ee93fafe929a81115840f7115664d 100644
--- a/chrome/browser/android/webapps/add_to_homescreen_manager.cc
+++ b/chrome/browser/android/webapps/add_to_homescreen_manager.cc
@@ -12,6 +12,7 @@
#include "base/strings/utf_string_conversions.h"
#include "base/threading/sequenced_worker_pool.h"
#include "chrome/browser/android/banners/app_banner_infobar_delegate_android.h"
+#include "chrome/browser/android/banners/app_banner_manager_android.h"
#include "chrome/browser/android/shortcut_helper.h"
#include "chrome/browser/android/webapk/chrome_webapk_host.h"
#include "chrome/browser/android/webapk/webapk_install_service.h"
@@ -90,6 +91,10 @@ void AddToHomescreenManager::Start(content::WebContents* web_contents) {
ShortcutHelper::GetMinimumSplashImageSizeInPx(),
ShortcutHelper::GetIdealBadgeIconSizeInPx(),
check_webapk_compatible, this);
+
+ app_banner_manager_ =
dominickn 2017/04/24 00:56:30 Having thought about this, I think it's better to
Matt Giuca 2017/04/24 01:42:13 Done.
+ banners::AppBannerManagerAndroid::FromWebContents(web_contents);
+ DCHECK(app_banner_manager_);
}
AddToHomescreenManager::~AddToHomescreenManager() {
@@ -119,11 +124,7 @@ void AddToHomescreenManager::AddShortcut(const ShortcutInfo& info,
ShortcutHelper::AddToLauncherWithSkBitmap(web_contents, info, icon);
// Fire the appinstalled event.
- blink::mojom::InstallationServicePtr installation_service;
- web_contents->GetMainFrame()->GetRemoteInterfaces()->GetInterface(
- mojo::MakeRequest(&installation_service));
- DCHECK(installation_service);
- installation_service->OnInstall();
+ app_banner_manager_->OnInstall();
}
void AddToHomescreenManager::RecordAddToHomescreen() {
@@ -192,9 +193,9 @@ void AddToHomescreenManager::CreateInfoBarForWebApk(
const SkBitmap& primary_icon,
const SkBitmap& badge_icon) {
banners::AppBannerInfoBarDelegateAndroid::Create(
- data_fetcher_->web_contents(), nullptr, info.user_title,
- base::MakeUnique<ShortcutInfo>(info), primary_icon, badge_icon,
- -1 /* event_request_id */, webapk::INSTALL_SOURCE_MENU);
+ data_fetcher_->web_contents(), app_banner_manager_->GetWeakPtr(),
+ info.user_title, base::MakeUnique<ShortcutInfo>(info), primary_icon,
+ badge_icon, -1 /* event_request_id */, webapk::INSTALL_SOURCE_MENU);
}
SkBitmap AddToHomescreenManager::FinalizeLauncherIconInBackground(

Powered by Google App Engine
This is Rietveld 408576698