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

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

Issue 2670963002: Android: Fire the appinstalled event on WebAPK installation. (Closed)
Patch Set: Respond to review. Created 3 years, 7 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 | chrome/browser/android/webapps/add_to_homescreen_manager.cc » ('j') | 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 <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
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. Note that this is fired *before* the
359 if (!is_webapk_) 362 // installation actually takes place (which can be a significant amount of
360 weak_manager_->OnInstall(); 363 // time later, especially if using WebAPKs).
361 } 364 // TODO(mgiuca): Fire the event *after* the installation is completed.
365 weak_manager_->OnInstall();
362 } 366 }
363 367
364 void AppBannerInfoBarDelegateAndroid::OnWebApkInstallFinished( 368 void AppBannerInfoBarDelegateAndroid::OnWebApkInstallFinished(
365 WebApkInstallResult result, 369 WebApkInstallResult result,
366 bool relax_updates, 370 bool relax_updates,
367 const std::string& webapk_package_name) { 371 const std::string& webapk_package_name) {
368 if (result != WebApkInstallResult::SUCCESS) { 372 if (result != WebApkInstallResult::SUCCESS) {
369 OnWebApkInstallFailed(result); 373 OnWebApkInstallFailed(result);
370 return; 374 return;
371 } 375 }
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
464 468
465 TrackDismissEvent(DISMISS_EVENT_BANNER_CLICK); 469 TrackDismissEvent(DISMISS_EVENT_BANNER_CLICK);
466 return true; 470 return true;
467 } 471 }
468 472
469 bool RegisterAppBannerInfoBarDelegateAndroid(JNIEnv* env) { 473 bool RegisterAppBannerInfoBarDelegateAndroid(JNIEnv* env) {
470 return RegisterNativesImpl(env); 474 return RegisterNativesImpl(env);
471 } 475 }
472 476
473 } // namespace banners 477 } // namespace banners
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/android/webapps/add_to_homescreen_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698