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

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

Issue 2670963002: Android: Fire the appinstalled event on WebAPK installation. (Closed)
Patch Set: Respond to review. 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..822513778ba7058da78a23735100cd0a1bbf2398 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"
@@ -119,11 +120,9 @@ 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();
+ banners::AppBannerManagerAndroid* app_banner_manager =
+ banners::AppBannerManagerAndroid::FromWebContents(web_contents);
+ app_banner_manager->OnInstall();
}
void AddToHomescreenManager::RecordAddToHomescreen() {
@@ -191,8 +190,11 @@ void AddToHomescreenManager::CreateInfoBarForWebApk(
const ShortcutInfo& info,
const SkBitmap& primary_icon,
const SkBitmap& badge_icon) {
+ content::WebContents* web_contents = data_fetcher_->web_contents();
+ banners::AppBannerManagerAndroid* app_banner_manager =
+ banners::AppBannerManagerAndroid::FromWebContents(web_contents);
banners::AppBannerInfoBarDelegateAndroid::Create(
- data_fetcher_->web_contents(), nullptr, info.user_title,
+ 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);
}
« no previous file with comments | « chrome/browser/android/banners/app_banner_infobar_delegate_android.cc ('k') | chrome/browser/banners/app_banner_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698