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 #include <utility> | 5 #include <utility> |
6 | 6 |
7 #include "chrome/browser/android/banners/app_banner_manager_android.h" | 7 #include "chrome/browser/android/banners/app_banner_manager_android.h" |
8 | 8 |
9 #include "base/android/jni_android.h" | 9 #include "base/android/jni_android.h" |
10 #include "base/android/jni_string.h" | 10 #include "base/android/jni_string.h" |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 icon_.reset(new SkBitmap(bitmap)); | 180 icon_.reset(new SkBitmap(bitmap)); |
181 SendBannerPromptRequest(); | 181 SendBannerPromptRequest(); |
182 } | 182 } |
183 | 183 |
184 void AppBannerManagerAndroid::ShowBanner() { | 184 void AppBannerManagerAndroid::ShowBanner() { |
185 content::WebContents* contents = web_contents(); | 185 content::WebContents* contents = web_contents(); |
186 DCHECK(contents); | 186 DCHECK(contents); |
187 | 187 |
188 infobars::InfoBar* infobar = nullptr; | 188 infobars::InfoBar* infobar = nullptr; |
189 if (native_app_data_.is_null()) { | 189 if (native_app_data_.is_null()) { |
| 190 bool is_webapk = ChromeWebApkHost::AreWebApkEnabled(); |
190 std::unique_ptr<AppBannerInfoBarDelegateAndroid> delegate( | 191 std::unique_ptr<AppBannerInfoBarDelegateAndroid> delegate( |
191 new AppBannerInfoBarDelegateAndroid( | 192 new AppBannerInfoBarDelegateAndroid( |
192 GetWeakPtr(), app_title_, manifest_url_, manifest_, icon_url_, | 193 GetWeakPtr(), app_title_, manifest_url_, manifest_, icon_url_, |
193 std::move(icon_), event_request_id())); | 194 std::move(icon_), event_request_id(), is_webapk)); |
194 | 195 |
195 infobar = new AppBannerInfoBarAndroid(std::move(delegate), | 196 infobar = new AppBannerInfoBarAndroid( |
196 manifest_.start_url); | 197 std::move(delegate), manifest_.start_url, is_webapk); |
197 if (infobar) { | 198 if (infobar) { |
198 RecordDidShowBanner("AppBanner.WebApp.Shown"); | 199 RecordDidShowBanner("AppBanner.WebApp.Shown"); |
199 TrackDisplayEvent(DISPLAY_EVENT_WEB_APP_BANNER_CREATED); | 200 TrackDisplayEvent(DISPLAY_EVENT_WEB_APP_BANNER_CREATED); |
200 ReportStatus(contents, SHOWING_WEB_APP_BANNER); | 201 ReportStatus(contents, SHOWING_WEB_APP_BANNER); |
201 } else { | 202 } else { |
202 ReportStatus(contents, FAILED_TO_CREATE_BANNER); | 203 ReportStatus(contents, FAILED_TO_CREATE_BANNER); |
203 } | 204 } |
204 } else { | 205 } else { |
205 std::unique_ptr<AppBannerInfoBarDelegateAndroid> delegate( | 206 std::unique_ptr<AppBannerInfoBarDelegateAndroid> delegate( |
206 new AppBannerInfoBarDelegateAndroid( | 207 new AppBannerInfoBarDelegateAndroid( |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
330 } | 331 } |
331 | 332 |
332 // static | 333 // static |
333 void SetTimeDeltaForTesting(JNIEnv* env, | 334 void SetTimeDeltaForTesting(JNIEnv* env, |
334 const JavaParamRef<jclass>& clazz, | 335 const JavaParamRef<jclass>& clazz, |
335 jint days) { | 336 jint days) { |
336 AppBannerManager::SetTimeDeltaForTesting(days); | 337 AppBannerManager::SetTimeDeltaForTesting(days); |
337 } | 338 } |
338 | 339 |
339 } // namespace banners | 340 } // namespace banners |
OLD | NEW |