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

Unified Diff: chrome/browser/android/banners/app_banner_infobar_delegate_android.h

Issue 2290603005: Trigger app banner when add to homescreen is pressed and WebAPKs are enabled. (Closed)
Patch Set: Try to fix test failures Created 4 years, 3 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/banners/app_banner_infobar_delegate_android.h
diff --git a/chrome/browser/android/banners/app_banner_infobar_delegate_android.h b/chrome/browser/android/banners/app_banner_infobar_delegate_android.h
index c78aa8def8af41f30db46695348dfc8db65437ab..7e36595b10047ce7207c1b4a0240fa9f6125fb4a 100644
--- a/chrome/browser/android/banners/app_banner_infobar_delegate_android.h
+++ b/chrome/browser/android/banners/app_banner_infobar_delegate_android.h
@@ -11,7 +11,6 @@
#include "base/strings/string16.h"
#include "chrome/browser/banners/app_banner_manager.h"
#include "components/infobars/core/confirm_infobar_delegate.h"
-#include "content/public/common/manifest.h"
#include "ui/gfx/image/image.h"
#include "url/gurl.h"
@@ -24,25 +23,27 @@ class InfoBarManager;
}
class AppBannerInfoBar;
+struct ShortcutInfo;
namespace banners {
// Manages installation of an app being promoted by a page.
class AppBannerInfoBarDelegateAndroid : public ConfirmInfoBarDelegate {
public:
- // Delegate for promoting a web app.
- AppBannerInfoBarDelegateAndroid(
+ // Creates and shows the infobar a web app.
Peter Kasting 2016/09/08 04:56:57 Nit: Grammar. Also, rather than "shows" I would b
Xi Han 2016/09/08 15:49:10 Done.
+ static bool Create(
+ content::WebContents* web_contents,
base::WeakPtr<AppBannerManager> weak_manager,
const base::string16& app_title,
- const GURL& manifest_url,
- const content::Manifest& manifest,
- const GURL& icon_url,
+ std::unique_ptr<ShortcutInfo> info,
std::unique_ptr<SkBitmap> icon,
int event_request_id,
- bool is_webapk);
+ bool is_webapk,
+ bool start_install_webapk);
- // Delegate for promoting an Android app.
- AppBannerInfoBarDelegateAndroid(
+ // Creates and shows the infobar for an Android app.
+ static bool Create(
+ content::WebContents* web_contents,
const base::string16& app_title,
const base::android::ScopedJavaGlobalRef<jobject>& native_app_data,
std::unique_ptr<SkBitmap> icon,
@@ -67,11 +68,36 @@ class AppBannerInfoBarDelegateAndroid : public ConfirmInfoBarDelegate {
const base::android::JavaParamRef<jobject>& obj,
jboolean success);
+ // Called in the following cases:
+ // - when user clicks the "Add To Homescreen" from the app menu to install a
+ // WebAPK;
+ // - user accepts to install a WebAPK via the app banner;
+ // - user clicks the "open" button on the app banner after the WebAPK is
+ // installed.
Peter Kasting 2016/09/08 04:56:57 Rather than describing when this is called (which
Xi Han 2016/09/08 15:49:10 Done.
+ bool AcceptWebApk(content::WebContents* web_contents);
+
private:
+ // Delegate for promoting a web app.
+ AppBannerInfoBarDelegateAndroid(
+ base::WeakPtr<AppBannerManager> weak_manager,
+ const base::string16& app_title,
+ std::unique_ptr<ShortcutInfo> info,
+ std::unique_ptr<SkBitmap> icon,
+ int event_request_id,
+ bool is_webapk);
+
+ // Delegate for promoting an Android app.
+ AppBannerInfoBarDelegateAndroid(
+ const base::string16& app_title,
+ const base::android::ScopedJavaGlobalRef<jobject>& native_app_data,
+ std::unique_ptr<SkBitmap> icon,
+ const std::string& native_app_package,
+ const std::string& referrer,
+ int event_request_id);
+
void CreateJavaDelegate();
bool AcceptNativeApp(content::WebContents* web_contents);
bool AcceptWebApp(content::WebContents* web_contents);
- bool AcceptWebApk(content::WebContents* web_contents);
void SendBannerAccepted(content::WebContents* web_contents,
const std::string& platform);
void OnWebApkInstallFinished(bool success, const std::string& webapk_package);
@@ -91,12 +117,10 @@ class AppBannerInfoBarDelegateAndroid : public ConfirmInfoBarDelegate {
base::WeakPtr<AppBannerManager> weak_manager_;
base::string16 app_title_;
- GURL manifest_url_;
- content::Manifest manifest_;
+ std::unique_ptr<ShortcutInfo> shortcut_info_;
base::android::ScopedJavaGlobalRef<jobject> native_app_data_;
- GURL icon_url_;
std::unique_ptr<SkBitmap> icon_;
std::string native_app_package_;
@@ -110,7 +134,7 @@ class AppBannerInfoBarDelegateAndroid : public ConfirmInfoBarDelegate {
base::WeakPtrFactory<AppBannerInfoBarDelegateAndroid> weak_ptr_factory_;
DISALLOW_COPY_AND_ASSIGN(AppBannerInfoBarDelegateAndroid);
-}; // AppBannerInfoBarDelegateAndroid
+};
// Register native methods.
bool RegisterAppBannerInfoBarDelegateAndroid(JNIEnv* env);

Powered by Google App Engine
This is Rietveld 408576698