| 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 "chrome/browser/android/banners/app_banner_manager_android.h" | 5 #include "chrome/browser/android/banners/app_banner_manager_android.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 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 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 242 | 242 |
| 243 void AppBannerManagerAndroid::ShowBanner() { | 243 void AppBannerManagerAndroid::ShowBanner() { |
| 244 content::WebContents* contents = web_contents(); | 244 content::WebContents* contents = web_contents(); |
| 245 DCHECK(contents); | 245 DCHECK(contents); |
| 246 | 246 |
| 247 if (native_app_data_.is_null()) { | 247 if (native_app_data_.is_null()) { |
| 248 if (AppBannerInfoBarDelegateAndroid::Create( | 248 if (AppBannerInfoBarDelegateAndroid::Create( |
| 249 contents, GetWeakPtr(), | 249 contents, GetWeakPtr(), |
| 250 CreateShortcutInfo(manifest_url_, manifest_, primary_icon_url_, | 250 CreateShortcutInfo(manifest_url_, manifest_, primary_icon_url_, |
| 251 badge_icon_url_, can_install_webapk_), | 251 badge_icon_url_, can_install_webapk_), |
| 252 primary_icon_, badge_icon_, event_request_id(), can_install_webapk_, | 252 primary_icon_, badge_icon_, can_install_webapk_, |
| 253 webapk::INSTALL_SOURCE_BANNER)) { | 253 webapk::INSTALL_SOURCE_BANNER)) { |
| 254 RecordDidShowBanner("AppBanner.WebApp.Shown"); | 254 RecordDidShowBanner("AppBanner.WebApp.Shown"); |
| 255 TrackDisplayEvent(DISPLAY_EVENT_WEB_APP_BANNER_CREATED); | 255 TrackDisplayEvent(DISPLAY_EVENT_WEB_APP_BANNER_CREATED); |
| 256 ReportStatus(contents, SHOWING_WEB_APP_BANNER); | 256 ReportStatus(contents, SHOWING_WEB_APP_BANNER); |
| 257 } else { | 257 } else { |
| 258 ReportStatus(contents, FAILED_TO_CREATE_BANNER); | 258 ReportStatus(contents, FAILED_TO_CREATE_BANNER); |
| 259 } | 259 } |
| 260 } else { | 260 } else { |
| 261 if (AppBannerInfoBarDelegateAndroid::Create( | 261 if (AppBannerInfoBarDelegateAndroid::Create( |
| 262 contents, native_app_title_, native_app_data_, primary_icon_, | 262 contents, native_app_title_, native_app_data_, primary_icon_, |
| 263 native_app_package_, referrer_, event_request_id())) { | 263 native_app_package_, referrer_)) { |
| 264 RecordDidShowBanner("AppBanner.NativeApp.Shown"); | 264 RecordDidShowBanner("AppBanner.NativeApp.Shown"); |
| 265 TrackDisplayEvent(DISPLAY_EVENT_NATIVE_APP_BANNER_CREATED); | 265 TrackDisplayEvent(DISPLAY_EVENT_NATIVE_APP_BANNER_CREATED); |
| 266 ReportStatus(contents, SHOWING_NATIVE_APP_BANNER); | 266 ReportStatus(contents, SHOWING_NATIVE_APP_BANNER); |
| 267 } else { | 267 } else { |
| 268 ReportStatus(contents, FAILED_TO_CREATE_BANNER); | 268 ReportStatus(contents, FAILED_TO_CREATE_BANNER); |
| 269 } | 269 } |
| 270 } | 270 } |
| 271 } | 271 } |
| 272 | 272 |
| 273 bool AppBannerManagerAndroid::CanHandleNonWebApp(const std::string& platform, | 273 bool AppBannerManagerAndroid::CanHandleNonWebApp(const std::string& platform, |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 372 } | 372 } |
| 373 | 373 |
| 374 // static | 374 // static |
| 375 void SetTotalEngagementToTrigger(JNIEnv* env, | 375 void SetTotalEngagementToTrigger(JNIEnv* env, |
| 376 const JavaParamRef<jclass>& clazz, | 376 const JavaParamRef<jclass>& clazz, |
| 377 jdouble engagement) { | 377 jdouble engagement) { |
| 378 AppBannerSettingsHelper::SetTotalEngagementToTrigger(engagement); | 378 AppBannerSettingsHelper::SetTotalEngagementToTrigger(engagement); |
| 379 } | 379 } |
| 380 | 380 |
| 381 } // namespace banners | 381 } // namespace banners |
| OLD | NEW |