| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_ANDROID_BANNERS_APP_BANNER_INFOBAR_DELEGATE_ANDROID_H_ | 5 #ifndef CHROME_BROWSER_ANDROID_BANNERS_APP_BANNER_INFOBAR_DELEGATE_ANDROID_H_ |
| 6 #define CHROME_BROWSER_ANDROID_BANNERS_APP_BANNER_INFOBAR_DELEGATE_ANDROID_H_ | 6 #define CHROME_BROWSER_ANDROID_BANNERS_APP_BANNER_INFOBAR_DELEGATE_ANDROID_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 | 33 |
| 34 namespace banners { | 34 namespace banners { |
| 35 | 35 |
| 36 class AppBannerManager; | 36 class AppBannerManager; |
| 37 | 37 |
| 38 // Manages installation of an app being promoted by a page. | 38 // Manages installation of an app being promoted by a page. |
| 39 class AppBannerInfoBarDelegateAndroid : public ConfirmInfoBarDelegate { | 39 class AppBannerInfoBarDelegateAndroid : public ConfirmInfoBarDelegate { |
| 40 public: | 40 public: |
| 41 // Creates an infobar and delegate for promoting the installation of a web | 41 // Creates an infobar and delegate for promoting the installation of a web |
| 42 // app, and adds the infobar to the InfoBarManager for |web_contents|. | 42 // app, and adds the infobar to the InfoBarManager for |web_contents|. |
| 43 static bool Create( | 43 static bool Create(content::WebContents* web_contents, |
| 44 content::WebContents* web_contents, | 44 base::WeakPtr<AppBannerManager> weak_manager, |
| 45 base::WeakPtr<AppBannerManager> weak_manager, | 45 const base::string16& app_title, |
| 46 const base::string16& app_title, | 46 std::unique_ptr<ShortcutInfo> info, |
| 47 std::unique_ptr<ShortcutInfo> info, | 47 std::unique_ptr<SkBitmap> primary_icon, |
| 48 std::unique_ptr<SkBitmap> icon, | 48 std::unique_ptr<SkBitmap> badge_icon, |
| 49 int event_request_id, | 49 int event_request_id, |
| 50 webapk::InstallSource webapk_install_source); | 50 webapk::InstallSource webapk_install_source); |
| 51 | 51 |
| 52 // Creates an infobar and delegate for promoting the installation of an | 52 // Creates an infobar and delegate for promoting the installation of an |
| 53 // Android app, and adds the infobar to the InfoBarManager for |web_contents|. | 53 // Android app, and adds the infobar to the InfoBarManager for |web_contents|. |
| 54 static bool Create( | 54 static bool Create( |
| 55 content::WebContents* web_contents, | 55 content::WebContents* web_contents, |
| 56 const base::string16& app_title, | 56 const base::string16& app_title, |
| 57 const base::android::ScopedJavaGlobalRef<jobject>& native_app_data, | 57 const base::android::ScopedJavaGlobalRef<jobject>& native_app_data, |
| 58 std::unique_ptr<SkBitmap> icon, | 58 std::unique_ptr<SkBitmap> icon, |
| 59 const std::string& native_app_package, | 59 const std::string& native_app_package, |
| 60 const std::string& referrer, | 60 const std::string& referrer, |
| (...skipping 30 matching lines...) Expand all Loading... |
| 91 INSTALL_NOT_STARTED, | 91 INSTALL_NOT_STARTED, |
| 92 INSTALLING, | 92 INSTALLING, |
| 93 INSTALLED, | 93 INSTALLED, |
| 94 }; | 94 }; |
| 95 | 95 |
| 96 // Delegate for promoting a web app. | 96 // Delegate for promoting a web app. |
| 97 AppBannerInfoBarDelegateAndroid( | 97 AppBannerInfoBarDelegateAndroid( |
| 98 base::WeakPtr<AppBannerManager> weak_manager, | 98 base::WeakPtr<AppBannerManager> weak_manager, |
| 99 const base::string16& app_title, | 99 const base::string16& app_title, |
| 100 std::unique_ptr<ShortcutInfo> info, | 100 std::unique_ptr<ShortcutInfo> info, |
| 101 std::unique_ptr<SkBitmap> icon, | 101 std::unique_ptr<SkBitmap> primary_icon, |
| 102 std::unique_ptr<SkBitmap> badge_icon, |
| 102 int event_request_id, | 103 int event_request_id, |
| 103 bool is_webapk, | 104 bool is_webapk, |
| 104 webapk::InstallSource webapk_install_source); | 105 webapk::InstallSource webapk_install_source); |
| 105 | 106 |
| 106 // Delegate for promoting an Android app. | 107 // Delegate for promoting an Android app. |
| 107 AppBannerInfoBarDelegateAndroid( | 108 AppBannerInfoBarDelegateAndroid( |
| 108 const base::string16& app_title, | 109 const base::string16& app_title, |
| 109 const base::android::ScopedJavaGlobalRef<jobject>& native_app_data, | 110 const base::android::ScopedJavaGlobalRef<jobject>& native_app_data, |
| 110 std::unique_ptr<SkBitmap> icon, | 111 std::unique_ptr<SkBitmap> icon, |
| 111 const std::string& native_app_package, | 112 const std::string& native_app_package, |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 base::android::ScopedJavaGlobalRef<jobject> java_delegate_; | 146 base::android::ScopedJavaGlobalRef<jobject> java_delegate_; |
| 146 | 147 |
| 147 // Used to fetch the splash screen icon for webapps. | 148 // Used to fetch the splash screen icon for webapps. |
| 148 base::WeakPtr<AppBannerManager> weak_manager_; | 149 base::WeakPtr<AppBannerManager> weak_manager_; |
| 149 | 150 |
| 150 base::string16 app_title_; | 151 base::string16 app_title_; |
| 151 std::unique_ptr<ShortcutInfo> shortcut_info_; | 152 std::unique_ptr<ShortcutInfo> shortcut_info_; |
| 152 | 153 |
| 153 base::android::ScopedJavaGlobalRef<jobject> native_app_data_; | 154 base::android::ScopedJavaGlobalRef<jobject> native_app_data_; |
| 154 | 155 |
| 155 std::unique_ptr<SkBitmap> icon_; | 156 std::unique_ptr<SkBitmap> primary_icon_; |
| 157 std::unique_ptr<SkBitmap> badge_icon_; |
| 156 | 158 |
| 157 std::string native_app_package_; | 159 std::string native_app_package_; |
| 158 std::string referrer_; | 160 std::string referrer_; |
| 159 int event_request_id_; | 161 int event_request_id_; |
| 160 bool has_user_interaction_; | 162 bool has_user_interaction_; |
| 161 | 163 |
| 162 bool is_webapk_; | 164 bool is_webapk_; |
| 163 | 165 |
| 164 // Indicates the current state of a WebAPK installation. | 166 // Indicates the current state of a WebAPK installation. |
| 165 InstallState install_state_; | 167 InstallState install_state_; |
| 166 | 168 |
| 167 // Tracks how long it takes to install a WebAPK. | 169 // Tracks how long it takes to install a WebAPK. |
| 168 std::unique_ptr<base::ElapsedTimer> timer_; | 170 std::unique_ptr<base::ElapsedTimer> timer_; |
| 169 | 171 |
| 170 // Indicates the way in which a WebAPK (if applicable) is installed: from the | 172 // Indicates the way in which a WebAPK (if applicable) is installed: from the |
| 171 // menu or from an app banner. | 173 // menu or from an app banner. |
| 172 webapk::InstallSource webapk_install_source_; | 174 webapk::InstallSource webapk_install_source_; |
| 173 | 175 |
| 174 base::WeakPtrFactory<AppBannerInfoBarDelegateAndroid> weak_ptr_factory_; | 176 base::WeakPtrFactory<AppBannerInfoBarDelegateAndroid> weak_ptr_factory_; |
| 175 | 177 |
| 176 DISALLOW_COPY_AND_ASSIGN(AppBannerInfoBarDelegateAndroid); | 178 DISALLOW_COPY_AND_ASSIGN(AppBannerInfoBarDelegateAndroid); |
| 177 }; | 179 }; |
| 178 | 180 |
| 179 // Register native methods. | 181 // Register native methods. |
| 180 bool RegisterAppBannerInfoBarDelegateAndroid(JNIEnv* env); | 182 bool RegisterAppBannerInfoBarDelegateAndroid(JNIEnv* env); |
| 181 | 183 |
| 182 } // namespace banners | 184 } // namespace banners |
| 183 | 185 |
| 184 #endif // CHROME_BROWSER_ANDROID_BANNERS_APP_BANNER_INFOBAR_DELEGATE_ANDROID_H_ | 186 #endif // CHROME_BROWSER_ANDROID_BANNERS_APP_BANNER_INFOBAR_DELEGATE_ANDROID_H_ |
| OLD | NEW |