| 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 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 std::unique_ptr<AppBannerInfoBarDelegateAndroid> delegate( | 179 std::unique_ptr<AppBannerInfoBarDelegateAndroid> delegate( |
| 180 new AppBannerInfoBarDelegateAndroid( | 180 new AppBannerInfoBarDelegateAndroid( |
| 181 GetWeakPtr(), app_title_, manifest_url_, manifest_, icon_url_, | 181 GetWeakPtr(), app_title_, manifest_url_, manifest_, icon_url_, |
| 182 std::move(icon_), event_request_id())); | 182 std::move(icon_), event_request_id())); |
| 183 | 183 |
| 184 infobar = new AppBannerInfoBarAndroid(std::move(delegate), | 184 infobar = new AppBannerInfoBarAndroid(std::move(delegate), |
| 185 manifest_.start_url); | 185 manifest_.start_url); |
| 186 if (infobar) { | 186 if (infobar) { |
| 187 RecordDidShowBanner("AppBanner.WebApp.Shown"); | 187 RecordDidShowBanner("AppBanner.WebApp.Shown"); |
| 188 TrackDisplayEvent(DISPLAY_EVENT_WEB_APP_BANNER_CREATED); | 188 TrackDisplayEvent(DISPLAY_EVENT_WEB_APP_BANNER_CREATED); |
| 189 TrackInstallableErrorCode(SHOWING_WEB_APP_BANNER); |
| 190 } else { |
| 191 TrackInstallableErrorCode(FAILED_TO_CREATE_BANNER); |
| 189 } | 192 } |
| 190 } else { | 193 } else { |
| 191 std::unique_ptr<AppBannerInfoBarDelegateAndroid> delegate( | 194 std::unique_ptr<AppBannerInfoBarDelegateAndroid> delegate( |
| 192 new AppBannerInfoBarDelegateAndroid( | 195 new AppBannerInfoBarDelegateAndroid( |
| 193 app_title_, native_app_data_, std::move(icon_), native_app_package_, | 196 app_title_, native_app_data_, std::move(icon_), native_app_package_, |
| 194 referrer_, event_request_id())); | 197 referrer_, event_request_id())); |
| 195 infobar = | 198 infobar = |
| 196 new AppBannerInfoBarAndroid(std::move(delegate), native_app_data_); | 199 new AppBannerInfoBarAndroid(std::move(delegate), native_app_data_); |
| 197 if (infobar) { | 200 if (infobar) { |
| 198 RecordDidShowBanner("AppBanner.NativeApp.Shown"); | 201 RecordDidShowBanner("AppBanner.NativeApp.Shown"); |
| 199 TrackDisplayEvent(DISPLAY_EVENT_NATIVE_APP_BANNER_CREATED); | 202 TrackDisplayEvent(DISPLAY_EVENT_NATIVE_APP_BANNER_CREATED); |
| 203 TrackInstallableErrorCode(SHOWING_NATIVE_APP_BANNER); |
| 204 } else { |
| 205 TrackInstallableErrorCode(FAILED_TO_CREATE_BANNER); |
| 200 } | 206 } |
| 201 } | 207 } |
| 202 | 208 |
| 203 if (infobar) { | 209 if (infobar) { |
| 204 InfoBarService::FromWebContents(contents)->AddInfoBar( | 210 InfoBarService::FromWebContents(contents)->AddInfoBar( |
| 205 base::WrapUnique(infobar)); | 211 base::WrapUnique(infobar)); |
| 206 } | 212 } |
| 207 } | 213 } |
| 208 | 214 |
| 209 bool AppBannerManagerAndroid::CanHandleNonWebApp(const std::string& platform, | 215 bool AppBannerManagerAndroid::CanHandleNonWebApp(const std::string& platform, |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 313 } | 319 } |
| 314 | 320 |
| 315 // static | 321 // static |
| 316 void SetTimeDeltaForTesting(JNIEnv* env, | 322 void SetTimeDeltaForTesting(JNIEnv* env, |
| 317 const JavaParamRef<jclass>& clazz, | 323 const JavaParamRef<jclass>& clazz, |
| 318 jint days) { | 324 jint days) { |
| 319 AppBannerManager::SetTimeDeltaForTesting(days); | 325 AppBannerManager::SetTimeDeltaForTesting(days); |
| 320 } | 326 } |
| 321 | 327 |
| 322 } // namespace banners | 328 } // namespace banners |
| OLD | NEW |