| 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 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 238 AppBannerManager::ResetCurrentPageData(); | 238 AppBannerManager::ResetCurrentPageData(); |
| 239 native_app_data_.Reset(); | 239 native_app_data_.Reset(); |
| 240 native_app_package_ = ""; | 240 native_app_package_ = ""; |
| 241 } | 241 } |
| 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 std::unique_ptr<ShortcutInfo> info = | |
| 249 CreateShortcutInfo(manifest_url_, manifest_, primary_icon_url_, | |
| 250 badge_icon_url_, can_install_webapk_); | |
| 251 if (AppBannerInfoBarDelegateAndroid::Create( | 248 if (AppBannerInfoBarDelegateAndroid::Create( |
| 252 contents, GetWeakPtr(), info->name, std::move(info), primary_icon_, | 249 contents, GetWeakPtr(), |
| 253 badge_icon_, event_request_id(), can_install_webapk_, | 250 CreateShortcutInfo(manifest_url_, manifest_, primary_icon_url_, |
| 251 badge_icon_url_, can_install_webapk_), |
| 252 primary_icon_, badge_icon_, event_request_id(), can_install_webapk_, |
| 254 webapk::INSTALL_SOURCE_BANNER)) { | 253 webapk::INSTALL_SOURCE_BANNER)) { |
| 255 RecordDidShowBanner("AppBanner.WebApp.Shown"); | 254 RecordDidShowBanner("AppBanner.WebApp.Shown"); |
| 256 TrackDisplayEvent(DISPLAY_EVENT_WEB_APP_BANNER_CREATED); | 255 TrackDisplayEvent(DISPLAY_EVENT_WEB_APP_BANNER_CREATED); |
| 257 ReportStatus(contents, SHOWING_WEB_APP_BANNER); | 256 ReportStatus(contents, SHOWING_WEB_APP_BANNER); |
| 258 } else { | 257 } else { |
| 259 ReportStatus(contents, FAILED_TO_CREATE_BANNER); | 258 ReportStatus(contents, FAILED_TO_CREATE_BANNER); |
| 260 } | 259 } |
| 261 } else { | 260 } else { |
| 262 if (AppBannerInfoBarDelegateAndroid::Create( | 261 if (AppBannerInfoBarDelegateAndroid::Create( |
| 263 contents, native_app_title_, native_app_data_, primary_icon_, | 262 contents, native_app_title_, native_app_data_, primary_icon_, |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 373 } | 372 } |
| 374 | 373 |
| 375 // static | 374 // static |
| 376 void SetTotalEngagementToTrigger(JNIEnv* env, | 375 void SetTotalEngagementToTrigger(JNIEnv* env, |
| 377 const JavaParamRef<jclass>& clazz, | 376 const JavaParamRef<jclass>& clazz, |
| 378 jdouble engagement) { | 377 jdouble engagement) { |
| 379 AppBannerSettingsHelper::SetTotalEngagementToTrigger(engagement); | 378 AppBannerSettingsHelper::SetTotalEngagementToTrigger(engagement); |
| 380 } | 379 } |
| 381 | 380 |
| 382 } // namespace banners | 381 } // namespace banners |
| OLD | NEW |