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 <utility> | 7 #include <utility> |
| 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 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 345 // Prevent the infobar from disappearing, because the infobar will show | 345 // Prevent the infobar from disappearing, because the infobar will show |
| 346 // "Adding" during the installation process. | 346 // "Adding" during the installation process. |
| 347 return false; | 347 return false; |
| 348 } | 348 } |
| 349 | 349 |
| 350 bool AppBannerInfoBarDelegateAndroid::TriggeredFromBanner() const { | 350 bool AppBannerInfoBarDelegateAndroid::TriggeredFromBanner() const { |
| 351 return !is_webapk_ || webapk_install_source_ == webapk::INSTALL_SOURCE_BANNER; | 351 return !is_webapk_ || webapk_install_source_ == webapk::INSTALL_SOURCE_BANNER; |
| 352 } | 352 } |
| 353 | 353 |
| 354 void AppBannerInfoBarDelegateAndroid::SendBannerAccepted() { | 354 void AppBannerInfoBarDelegateAndroid::SendBannerAccepted() { |
| 355 if (weak_manager_ && TriggeredFromBanner()) { | 355 if (!weak_manager_) |
| 356 return; | |
| 357 | |
| 358 if (TriggeredFromBanner()) | |
| 356 weak_manager_->SendBannerAccepted(event_request_id_); | 359 weak_manager_->SendBannerAccepted(event_request_id_); |
| 357 // TODO(mgiuca): Send the appinstalled event for WebAPKs (but just removing | 360 |
| 358 // this check won't be sufficient). | 361 // Send the appinstalled event in all cases (whether triggered from a banner |
|
dominickn
2017/04/24 00:56:30
This comment seems superfluous. What's more import
Matt Giuca
2017/04/24 01:42:13
Done.
I don't think big-oh works like that...
| |
| 359 if (!is_webapk_) | 362 // or not). |
| 360 weak_manager_->OnInstall(); | 363 weak_manager_->OnInstall(); |
| 361 } | |
| 362 } | 364 } |
| 363 | 365 |
| 364 void AppBannerInfoBarDelegateAndroid::OnWebApkInstallFinished( | 366 void AppBannerInfoBarDelegateAndroid::OnWebApkInstallFinished( |
| 365 WebApkInstallResult result, | 367 WebApkInstallResult result, |
| 366 bool relax_updates, | 368 bool relax_updates, |
| 367 const std::string& webapk_package_name) { | 369 const std::string& webapk_package_name) { |
| 368 if (result != WebApkInstallResult::SUCCESS) { | 370 if (result != WebApkInstallResult::SUCCESS) { |
| 369 OnWebApkInstallFailed(result); | 371 OnWebApkInstallFailed(result); |
| 370 return; | 372 return; |
| 371 } | 373 } |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 464 | 466 |
| 465 TrackDismissEvent(DISMISS_EVENT_BANNER_CLICK); | 467 TrackDismissEvent(DISMISS_EVENT_BANNER_CLICK); |
| 466 return true; | 468 return true; |
| 467 } | 469 } |
| 468 | 470 |
| 469 bool RegisterAppBannerInfoBarDelegateAndroid(JNIEnv* env) { | 471 bool RegisterAppBannerInfoBarDelegateAndroid(JNIEnv* env) { |
| 470 return RegisterNativesImpl(env); | 472 return RegisterNativesImpl(env); |
| 471 } | 473 } |
| 472 | 474 |
| 473 } // namespace banners | 475 } // namespace banners |
| OLD | NEW |