Chromium Code Reviews| 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 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 351 // Prevent the infobar from disappearing, because the infobar will show | 351 // Prevent the infobar from disappearing, because the infobar will show |
| 352 // "Adding" during the installation process. | 352 // "Adding" during the installation process. |
| 353 return false; | 353 return false; |
| 354 } | 354 } |
| 355 | 355 |
| 356 bool AppBannerInfoBarDelegateAndroid::TriggeredFromBanner() const { | 356 bool AppBannerInfoBarDelegateAndroid::TriggeredFromBanner() const { |
| 357 return !is_webapk_ || webapk_install_source_ == webapk::INSTALL_SOURCE_BANNER; | 357 return !is_webapk_ || webapk_install_source_ == webapk::INSTALL_SOURCE_BANNER; |
| 358 } | 358 } |
| 359 | 359 |
| 360 void AppBannerInfoBarDelegateAndroid::SendBannerAccepted() { | 360 void AppBannerInfoBarDelegateAndroid::SendBannerAccepted() { |
| 361 if (weak_manager_ && TriggeredFromBanner()) | 361 if (weak_manager_ && TriggeredFromBanner()) { |
| 362 weak_manager_->SendBannerAccepted(event_request_id_); | 362 weak_manager_->SendBannerAccepted(event_request_id_); |
|
dominickn
2016/12/12 05:03:30
You need if (!is_webapk_) to stop this triggering
Matt Giuca
2016/12/14 03:39:40
Done.
| |
| 363 weak_manager_->OnInstall(); | |
| 364 } | |
| 363 } | 365 } |
| 364 | 366 |
| 365 void AppBannerInfoBarDelegateAndroid::OnWebApkInstallFinished( | 367 void AppBannerInfoBarDelegateAndroid::OnWebApkInstallFinished( |
| 366 bool success, | 368 bool success, |
| 367 const std::string& webapk_package_name) { | 369 const std::string& webapk_package_name) { |
| 368 JNIEnv* env = base::android::AttachCurrentThread(); | 370 JNIEnv* env = base::android::AttachCurrentThread(); |
| 369 if (!success) { | 371 if (!success) { |
| 370 DVLOG(1) << "The WebAPK installation failed."; | 372 DVLOG(1) << "The WebAPK installation failed."; |
| 371 Java_AppBannerInfoBarDelegateAndroid_showWebApkInstallFailureToast(env); | 373 Java_AppBannerInfoBarDelegateAndroid_showWebApkInstallFailureToast(env); |
| 372 webapk::TrackInstallEvent(webapk::INSTALL_FAILED); | 374 webapk::TrackInstallEvent(webapk::INSTALL_FAILED); |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 455 | 457 |
| 456 TrackDismissEvent(DISMISS_EVENT_BANNER_CLICK); | 458 TrackDismissEvent(DISMISS_EVENT_BANNER_CLICK); |
| 457 return true; | 459 return true; |
| 458 } | 460 } |
| 459 | 461 |
| 460 bool RegisterAppBannerInfoBarDelegateAndroid(JNIEnv* env) { | 462 bool RegisterAppBannerInfoBarDelegateAndroid(JNIEnv* env) { |
| 461 return RegisterNativesImpl(env); | 463 return RegisterNativesImpl(env); |
| 462 } | 464 } |
| 463 | 465 |
| 464 } // namespace banners | 466 } // namespace banners |
| OLD | NEW |