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 21 matching lines...) Expand all Loading... |
32 | 32 |
33 namespace banners { | 33 namespace banners { |
34 | 34 |
35 class AppBannerManager; | 35 class AppBannerManager; |
36 | 36 |
37 // Manages installation of an app being promoted by a page. | 37 // Manages installation of an app being promoted by a page. |
38 class AppBannerInfoBarDelegateAndroid : public ConfirmInfoBarDelegate { | 38 class AppBannerInfoBarDelegateAndroid : public ConfirmInfoBarDelegate { |
39 public: | 39 public: |
40 // Creates an infobar and delegate for promoting the installation of a web | 40 // Creates an infobar and delegate for promoting the installation of a web |
41 // app, and adds the infobar to the InfoBarManager for |web_contents|. | 41 // app, and adds the infobar to the InfoBarManager for |web_contents|. |
42 static bool Create( | 42 static bool Create(content::WebContents* web_contents, |
43 content::WebContents* web_contents, | 43 base::WeakPtr<AppBannerManager> weak_manager, |
44 base::WeakPtr<AppBannerManager> weak_manager, | 44 const base::string16& app_title, |
45 const base::string16& app_title, | 45 std::unique_ptr<ShortcutInfo> info, |
46 std::unique_ptr<ShortcutInfo> info, | 46 std::unique_ptr<SkBitmap> primary_icon, |
47 std::unique_ptr<SkBitmap> icon, | 47 std::unique_ptr<SkBitmap> badge_icon, |
48 int event_request_id, | 48 int event_request_id, |
49 webapk::InstallSource webapk_install_source); | 49 webapk::InstallSource webapk_install_source); |
50 | 50 |
51 // Creates an infobar and delegate for promoting the installation of an | 51 // Creates an infobar and delegate for promoting the installation of an |
52 // Android app, and adds the infobar to the InfoBarManager for |web_contents|. | 52 // Android app, and adds the infobar to the InfoBarManager for |web_contents|. |
53 static bool Create( | 53 static bool Create( |
54 content::WebContents* web_contents, | 54 content::WebContents* web_contents, |
55 const base::string16& app_title, | 55 const base::string16& app_title, |
56 const base::android::ScopedJavaGlobalRef<jobject>& native_app_data, | 56 const base::android::ScopedJavaGlobalRef<jobject>& native_app_data, |
57 std::unique_ptr<SkBitmap> icon, | 57 std::unique_ptr<SkBitmap> icon, |
58 const std::string& native_app_package, | 58 const std::string& native_app_package, |
59 const std::string& referrer, | 59 const std::string& referrer, |
(...skipping 26 matching lines...) Expand all Loading... |
86 // The states of a WebAPK installation, where the infobar is displayed during | 86 // The states of a WebAPK installation, where the infobar is displayed during |
87 // the entire installation process. This state is used to correctly record | 87 // the entire installation process. This state is used to correctly record |
88 // UMA metrics. | 88 // UMA metrics. |
89 enum InstallState { | 89 enum InstallState { |
90 INSTALL_NOT_STARTED, | 90 INSTALL_NOT_STARTED, |
91 INSTALLING, | 91 INSTALLING, |
92 INSTALLED, | 92 INSTALLED, |
93 }; | 93 }; |
94 | 94 |
95 // Delegate for promoting a web app. | 95 // Delegate for promoting a web app. |
96 AppBannerInfoBarDelegateAndroid( | 96 AppBannerInfoBarDelegateAndroid(base::WeakPtr<AppBannerManager> weak_manager, |
97 base::WeakPtr<AppBannerManager> weak_manager, | 97 const base::string16& app_title, |
98 const base::string16& app_title, | 98 std::unique_ptr<ShortcutInfo> info, |
99 std::unique_ptr<ShortcutInfo> info, | 99 std::unique_ptr<SkBitmap> primary_icon, |
100 std::unique_ptr<SkBitmap> icon, | 100 std::unique_ptr<SkBitmap> badge_icon, |
101 int event_request_id, | 101 int event_request_id, |
102 bool is_webapk, | 102 bool is_webapk, |
103 bool is_webapk_already_installed, | 103 bool is_webapk_already_installed, |
104 webapk::InstallSource webapk_install_source); | 104 webapk::InstallSource webapk_install_source); |
105 | 105 |
106 // Delegate for promoting an Android app. | 106 // Delegate for promoting an Android app. |
107 AppBannerInfoBarDelegateAndroid( | 107 AppBannerInfoBarDelegateAndroid( |
108 const base::string16& app_title, | 108 const base::string16& app_title, |
109 const base::android::ScopedJavaGlobalRef<jobject>& native_app_data, | 109 const base::android::ScopedJavaGlobalRef<jobject>& native_app_data, |
110 std::unique_ptr<SkBitmap> icon, | 110 std::unique_ptr<SkBitmap> icon, |
111 const std::string& native_app_package, | 111 const std::string& native_app_package, |
112 const std::string& referrer, | 112 const std::string& referrer, |
113 int event_request_id); | 113 int event_request_id); |
114 | 114 |
(...skipping 25 matching lines...) Expand all Loading... |
140 base::android::ScopedJavaGlobalRef<jobject> java_delegate_; | 140 base::android::ScopedJavaGlobalRef<jobject> java_delegate_; |
141 | 141 |
142 // Used to fetch the splash screen icon for webapps. | 142 // Used to fetch the splash screen icon for webapps. |
143 base::WeakPtr<AppBannerManager> weak_manager_; | 143 base::WeakPtr<AppBannerManager> weak_manager_; |
144 | 144 |
145 base::string16 app_title_; | 145 base::string16 app_title_; |
146 std::unique_ptr<ShortcutInfo> shortcut_info_; | 146 std::unique_ptr<ShortcutInfo> shortcut_info_; |
147 | 147 |
148 base::android::ScopedJavaGlobalRef<jobject> native_app_data_; | 148 base::android::ScopedJavaGlobalRef<jobject> native_app_data_; |
149 | 149 |
150 std::unique_ptr<SkBitmap> icon_; | 150 std::unique_ptr<SkBitmap> primary_icon_; |
| 151 std::unique_ptr<SkBitmap> badge_icon_; |
151 | 152 |
152 std::string native_app_package_; | 153 std::string native_app_package_; |
153 std::string referrer_; | 154 std::string referrer_; |
154 int event_request_id_; | 155 int event_request_id_; |
155 bool has_user_interaction_; | 156 bool has_user_interaction_; |
156 | 157 |
157 bool is_webapk_; | 158 bool is_webapk_; |
158 bool is_webapk_already_installed_; | 159 bool is_webapk_already_installed_; |
159 | 160 |
160 // Indicates the current state of a WebAPK installation. | 161 // Indicates the current state of a WebAPK installation. |
(...skipping 10 matching lines...) Expand all Loading... |
171 | 172 |
172 DISALLOW_COPY_AND_ASSIGN(AppBannerInfoBarDelegateAndroid); | 173 DISALLOW_COPY_AND_ASSIGN(AppBannerInfoBarDelegateAndroid); |
173 }; | 174 }; |
174 | 175 |
175 // Register native methods. | 176 // Register native methods. |
176 bool RegisterAppBannerInfoBarDelegateAndroid(JNIEnv* env); | 177 bool RegisterAppBannerInfoBarDelegateAndroid(JNIEnv* env); |
177 | 178 |
178 } // namespace banners | 179 } // namespace banners |
179 | 180 |
180 #endif // CHROME_BROWSER_ANDROID_BANNERS_APP_BANNER_INFOBAR_DELEGATE_ANDROID_H_ | 181 #endif // CHROME_BROWSER_ANDROID_BANNERS_APP_BANNER_INFOBAR_DELEGATE_ANDROID_H_ |
OLD | NEW |