| 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_infobar_delegate_android.h" | 5 #include "chrome/browser/android/banners/app_banner_infobar_delegate_android.h" |
| 6 | 6 |
| 7 #include "base/android/jni_android.h" | 7 #include "base/android/jni_android.h" |
| 8 #include "base/android/jni_string.h" | 8 #include "base/android/jni_string.h" |
| 9 #include "base/guid.h" | 9 #include "base/guid.h" |
| 10 #include "base/location.h" | 10 #include "base/location.h" |
| (...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 328 | 328 |
| 329 // If the WebAPK is not installed and the "Add to Home Screen" button is | 329 // If the WebAPK is not installed and the "Add to Home Screen" button is |
| 330 // clicked, install the WebAPK. | 330 // clicked, install the WebAPK. |
| 331 install_state_ = INSTALLING; | 331 install_state_ = INSTALLING; |
| 332 webapk::TrackInstallSource(webapk_install_source_); | 332 webapk::TrackInstallSource(webapk_install_source_); |
| 333 | 333 |
| 334 if (TriggeredFromBanner()) { | 334 if (TriggeredFromBanner()) { |
| 335 TrackUserResponse(USER_RESPONSE_WEB_APP_ACCEPTED); | 335 TrackUserResponse(USER_RESPONSE_WEB_APP_ACCEPTED); |
| 336 AppBannerSettingsHelper::RecordBannerInstallEvent( | 336 AppBannerSettingsHelper::RecordBannerInstallEvent( |
| 337 web_contents, shortcut_info_->url.spec(), AppBannerSettingsHelper::WEB); | 337 web_contents, shortcut_info_->url.spec(), AppBannerSettingsHelper::WEB); |
| 338 } else if (is_webapk_) { |
| 339 // This branch will be entered if we are a WebAPK that was triggered from |
| 340 // the add to homescreen menu item. Manually record the app banner added to |
| 341 // homescreen event in this case. Don't call |
| 342 // AppBannerSettingsHelper::RecordBannerInstallEvent as that records |
| 343 // banner-specific metrics in addition to this event. |
| 344 AppBannerSettingsHelper::RecordBannerEvent( |
| 345 web_contents, web_contents->GetLastCommittedURL(), |
| 346 shortcut_info_->url.spec(), |
| 347 AppBannerSettingsHelper::APP_BANNER_EVENT_DID_ADD_TO_HOMESCREEN, |
| 348 AppBannerManager::GetCurrentTime()); |
| 338 } | 349 } |
| 339 | 350 |
| 340 Java_AppBannerInfoBarDelegateAndroid_setWebApkInstallingState( | 351 Java_AppBannerInfoBarDelegateAndroid_setWebApkInstallingState( |
| 341 env, java_delegate_, true); | 352 env, java_delegate_, true); |
| 342 UpdateInstallState(env, nullptr); | 353 UpdateInstallState(env, nullptr); |
| 343 WebApkInstaller::FinishCallback callback = | 354 WebApkInstaller::FinishCallback callback = |
| 344 base::Bind(&AppBannerInfoBarDelegateAndroid::OnWebApkInstallFinished, | 355 base::Bind(&AppBannerInfoBarDelegateAndroid::OnWebApkInstallFinished, |
| 345 weak_ptr_factory_.GetWeakPtr()); | 356 weak_ptr_factory_.GetWeakPtr()); |
| 346 ShortcutHelper::InstallWebApkWithSkBitmap(web_contents->GetBrowserContext(), | 357 ShortcutHelper::InstallWebApkWithSkBitmap(web_contents->GetBrowserContext(), |
| 347 *shortcut_info_, | 358 *shortcut_info_, |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 460 | 471 |
| 461 TrackDismissEvent(DISMISS_EVENT_BANNER_CLICK); | 472 TrackDismissEvent(DISMISS_EVENT_BANNER_CLICK); |
| 462 return true; | 473 return true; |
| 463 } | 474 } |
| 464 | 475 |
| 465 bool RegisterAppBannerInfoBarDelegateAndroid(JNIEnv* env) { | 476 bool RegisterAppBannerInfoBarDelegateAndroid(JNIEnv* env) { |
| 466 return RegisterNativesImpl(env); | 477 return RegisterNativesImpl(env); |
| 467 } | 478 } |
| 468 | 479 |
| 469 } // namespace banners | 480 } // namespace banners |
| OLD | NEW |