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 ee90ad6479dc71ec9881b27e593ac61ff9819e82..92d5bdd0aeb2ffd3dca134ff6ca9b3c4fa6f7454 100644 |
--- a/chrome/browser/android/banners/app_banner_infobar_delegate_android.h |
+++ b/chrome/browser/android/banners/app_banner_infobar_delegate_android.h |
@@ -9,6 +9,7 @@ |
#include "base/macros.h" |
#include "base/memory/weak_ptr.h" |
#include "base/strings/string16.h" |
+#include "chrome/browser/android/webapk/webapk_metrics.h" |
#include "chrome/browser/banners/app_banner_manager.h" |
#include "components/infobars/core/confirm_infobar_delegate.h" |
#include "ui/gfx/image/image.h" |
@@ -40,7 +41,7 @@ class AppBannerInfoBarDelegateAndroid : public ConfirmInfoBarDelegate { |
std::unique_ptr<SkBitmap> icon, |
int event_request_id, |
bool is_webapk, |
- bool start_install_webapk); |
+ webapk::InstallSource webapk_install_source); |
// Creates and shows the infobar for an Android app. |
// Creates an infobar and delegate for promoting the installation of an |
@@ -71,12 +72,8 @@ class AppBannerInfoBarDelegateAndroid : public ConfirmInfoBarDelegate { |
const base::android::JavaParamRef<jobject>& obj, |
jboolean success); |
- // When user accepts to install a WebAPK, this function sends a request |
- // to the WebAPK Server to create a WebAPK and install it. It returns |
- // false to prevent infobar from disappearing when installation starts. |
- // When user clicks the Open button after the intallation is compelete, this |
- // function launches the installed WebAPK and returns true. |
- bool AcceptWebApk(content::WebContents* web_contents); |
+ // ConfirmInfoBarDelegate: |
dominickn
2016/09/27 01:36:55
Does this method need to be public? If it's only b
Xi Han
2016/09/27 13:44:04
Well, it has to be public. The AppBannerInfoBarDel
|
+ bool Accept() override; |
private: |
// The states of a WebAPK installation, where the infobar is displayed during |
@@ -95,7 +92,8 @@ class AppBannerInfoBarDelegateAndroid : public ConfirmInfoBarDelegate { |
std::unique_ptr<ShortcutInfo> info, |
std::unique_ptr<SkBitmap> icon, |
int event_request_id, |
- bool is_webapk); |
+ bool is_webapk, |
+ webapk::InstallSource webapk_install_source); |
// Delegate for promoting an Android app. |
AppBannerInfoBarDelegateAndroid( |
@@ -109,6 +107,14 @@ class AppBannerInfoBarDelegateAndroid : public ConfirmInfoBarDelegate { |
void CreateJavaDelegate(); |
bool AcceptNativeApp(content::WebContents* web_contents); |
bool AcceptWebApp(content::WebContents* web_contents); |
+ |
+ // When user accepts to install a WebAPK, this function sends a request |
+ // to the WebAPK Server to create a WebAPK and install it. It returns |
+ // false to prevent infobar from disappearing when installation starts. |
+ // When user clicks the Open button after the intallation is compelete, this |
+ // function launches the installed WebAPK and returns true. |
+ 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); |
@@ -120,7 +126,6 @@ class AppBannerInfoBarDelegateAndroid : public ConfirmInfoBarDelegate { |
void InfoBarDismissed() override; |
base::string16 GetMessageText() const override; |
int GetButtons() const override; |
- bool Accept() override; |
bool LinkClicked(WindowOpenDisposition disposition) override; |
base::android::ScopedJavaGlobalRef<jobject> java_delegate_; |
@@ -146,6 +151,10 @@ class AppBannerInfoBarDelegateAndroid : public ConfirmInfoBarDelegate { |
// Indicates the current state of a WebAPK installation. |
InstallState install_state_; |
+ // Indicates the way in which a WebAPK (if applicable) is installed: from the |
+ // menu or from an app banner. |
+ webapk::InstallSource webapk_install_source_; |
+ |
base::WeakPtrFactory<AppBannerInfoBarDelegateAndroid> weak_ptr_factory_; |
DISALLOW_COPY_AND_ASSIGN(AppBannerInfoBarDelegateAndroid); |