Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4579)

Unified Diff: chrome/browser/android/banners/app_banner_infobar_delegate_android.cc

Issue 2324263002: Follow up "Trigger app banner when add to homescreen is pressed and WebAPKs are enabled." (Closed)
Patch Set: Nits. Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/android/banners/app_banner_manager_android.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/android/banners/app_banner_infobar_delegate_android.cc
diff --git a/chrome/browser/android/banners/app_banner_infobar_delegate_android.cc b/chrome/browser/android/banners/app_banner_infobar_delegate_android.cc
index 24b1523948bec8f5c58a8083c549c6c793d37c5c..c0b16e13fa8254362d3c237cd8218891e8845e9b 100644
--- a/chrome/browser/android/banners/app_banner_infobar_delegate_android.cc
+++ b/chrome/browser/android/banners/app_banner_infobar_delegate_android.cc
@@ -39,7 +39,7 @@ using base::android::ScopedJavaLocalRef;
namespace {
-bool IsInfoEmpty(const ShortcutInfo* info) {
+bool IsInfoEmpty(const std::unique_ptr<ShortcutInfo>& info) {
return !info || info->url.is_empty();
}
@@ -98,7 +98,7 @@ AppBannerInfoBarDelegateAndroid::~AppBannerInfoBarDelegateAndroid() {
if (!has_user_interaction_) {
if (!native_app_data_.is_null())
TrackUserResponse(USER_RESPONSE_NATIVE_APP_IGNORED);
- else if (!IsInfoEmpty(shortcut_info_.get()))
+ else if (!IsInfoEmpty(shortcut_info_))
TrackUserResponse(USER_RESPONSE_WEB_APP_IGNORED);
}
@@ -162,7 +162,7 @@ void AppBannerInfoBarDelegateAndroid::OnInstallFinished(
bool AppBannerInfoBarDelegateAndroid::AcceptWebApk(
content::WebContents* web_contents) {
- if (IsInfoEmpty(shortcut_info_.get()))
+ if (IsInfoEmpty(shortcut_info_))
return true;
JNIEnv* env = base::android::AttachCurrentThread();
@@ -217,7 +217,7 @@ AppBannerInfoBarDelegateAndroid::AppBannerInfoBarDelegateAndroid(
has_user_interaction_(false),
is_webapk_(is_webapk),
weak_ptr_factory_(this) {
- DCHECK(!IsInfoEmpty(shortcut_info_.get()));
+ DCHECK(!IsInfoEmpty(shortcut_info_));
CreateJavaDelegate();
}
@@ -276,14 +276,14 @@ void AppBannerInfoBarDelegateAndroid::InfoBarDismissed() {
web_contents->GetMainFrame()->GetRoutingID(),
event_request_id_));
- if (!native_app_data_.is_null()) {
- TrackUserResponse(USER_RESPONSE_NATIVE_APP_DISMISSED);
- AppBannerSettingsHelper::RecordBannerDismissEvent(
- web_contents, native_app_package_, AppBannerSettingsHelper::NATIVE);
- } else {
+ if (native_app_data_.is_null()) {
TrackUserResponse(USER_RESPONSE_WEB_APP_DISMISSED);
AppBannerSettingsHelper::RecordBannerDismissEvent(
web_contents, shortcut_info_->url.spec(), AppBannerSettingsHelper::WEB);
+ } else {
+ TrackUserResponse(USER_RESPONSE_NATIVE_APP_DISMISSED);
+ AppBannerSettingsHelper::RecordBannerDismissEvent(
+ web_contents, native_app_package_, AppBannerSettingsHelper::NATIVE);
}
}
@@ -340,7 +340,7 @@ bool AppBannerInfoBarDelegateAndroid::AcceptNativeApp(
bool AppBannerInfoBarDelegateAndroid::AcceptWebApp(
content::WebContents* web_contents) {
- if (IsInfoEmpty(shortcut_info_.get()))
+ if (IsInfoEmpty(shortcut_info_))
return true;
TrackUserResponse(USER_RESPONSE_WEB_APP_ACCEPTED);
@@ -363,11 +363,10 @@ void AppBannerInfoBarDelegateAndroid::OnWebApkInstallFinished(
const std::string& webapk_package_name) {
JNIEnv* env = base::android::AttachCurrentThread();
if (!success) {
- // The installation failed.
+ DVLOG(1) << "The WebAPK installation failed.";
+ Java_AppBannerInfoBarDelegateAndroid_showWebApkInstallFailureToast(env);
if (infobar())
infobar()->RemoveSelf();
- Java_AppBannerInfoBarDelegateAndroid_showWebApkInstallFailureToast(env);
- DVLOG(1) << "The WebAPK installation failed.";
return;
}
« no previous file with comments | « no previous file | chrome/browser/android/banners/app_banner_manager_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698