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

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

Issue 2379923002: Implement "appinstalled" event on Android. (Closed)
Patch Set: Rebase. Created 4 years 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 40af6b5d348307d46c2cc2d30bb45d86549d2239..d55eb611e8f414af741d749f3d3e5fec499241c6 100644
--- a/chrome/browser/android/webapps/add_to_homescreen_manager.cc
+++ b/chrome/browser/android/webapps/add_to_homescreen_manager.cc
@@ -17,9 +17,13 @@
#include "chrome/browser/android/webapk/webapk_metrics.h"
#include "chrome/browser/banners/app_banner_settings_helper.h"
#include "content/public/browser/browser_thread.h"
+#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/web_contents.h"
#include "content/public/common/origin_util.h"
#include "jni/AddToHomescreenManager_jni.h"
+#include "mojo/public/cpp/bindings/interface_request.h"
+#include "services/service_manager/public/cpp/interface_provider.h"
+#include "third_party/WebKit/public/platform/modules/installation/installation.mojom.h"
#include "ui/gfx/android/java_bitmap.h"
using base::android::JavaParamRef;
@@ -115,6 +119,13 @@ void AddToHomescreenManager::AddShortcut(const ShortcutInfo& info,
ShortcutHelper::AddToLauncherWithSkBitmap(
web_contents->GetBrowserContext(), info, uid, icon,
data_fetcher_->FetchSplashScreenImageCallback(uid));
+
+ // Fire the appinstalled event.
+ blink::mojom::InstallationServicePtr installation_service;
+ web_contents->GetMainFrame()->GetRemoteInterfaces()->GetInterface(
+ mojo::GetProxy(&installation_service));
+ DCHECK(installation_service);
+ installation_service->OnInstall();
}
void AddToHomescreenManager::RecordAddToHomescreen() {
« 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