Chromium Code Reviews| 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..591979aff56353b2925460f9ff12be629f6379b1 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 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: |
| + 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 install_source); |
| // Delegate for promoting an Android app. |
| AppBannerInfoBarDelegateAndroid( |
| @@ -109,6 +107,13 @@ 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); |
|
pkotwicz
2016/09/26 20:23:10
Nit: New line
Whenever I add a function which has
Xi Han
2016/09/26 20:33:31
Done.
|
| void SendBannerAccepted(content::WebContents* web_contents, |
| const std::string& platform); |
| void OnWebApkInstallFinished(bool success, const std::string& webapk_package); |
| @@ -120,7 +125,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 +150,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 install_source_; |
|
pkotwicz
2016/09/26 20:23:10
Nit: |install_source_| -> |webapk_install_source_|
Xi Han
2016/09/26 20:33:31
Done.
|
| + |
| base::WeakPtrFactory<AppBannerInfoBarDelegateAndroid> weak_ptr_factory_; |
| DISALLOW_COPY_AND_ASSIGN(AppBannerInfoBarDelegateAndroid); |