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

Side by Side Diff: chrome/browser/android/banners/app_banner_infobar_delegate_android.cc

Issue 2638213002: Ensure WebAPK installation always records the app banner installation event. (Closed)
Patch Set: Don't pollute banner statistics Created 3 years, 11 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698