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

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

Issue 2379923002: Implement "appinstalled" event on Android. (Closed)
Patch Set: Rebase. Created 4 years 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 | « chrome/browser/DEPS ('k') | 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 "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
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_);
363 // TODO(mgiuca): Send the appinstalled event for WebAPKs (but just removing
364 // this check won't be sufficient).
365 if (!is_webapk_)
366 weak_manager_->OnInstall();
367 }
363 } 368 }
364 369
365 void AppBannerInfoBarDelegateAndroid::OnWebApkInstallFinished( 370 void AppBannerInfoBarDelegateAndroid::OnWebApkInstallFinished(
366 bool success, 371 bool success,
367 const std::string& webapk_package_name) { 372 const std::string& webapk_package_name) {
368 JNIEnv* env = base::android::AttachCurrentThread(); 373 JNIEnv* env = base::android::AttachCurrentThread();
369 if (!success) { 374 if (!success) {
370 DVLOG(1) << "The WebAPK installation failed."; 375 DVLOG(1) << "The WebAPK installation failed.";
371 Java_AppBannerInfoBarDelegateAndroid_showWebApkInstallFailureToast(env); 376 Java_AppBannerInfoBarDelegateAndroid_showWebApkInstallFailureToast(env);
372 webapk::TrackInstallEvent(webapk::INSTALL_FAILED); 377 webapk::TrackInstallEvent(webapk::INSTALL_FAILED);
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
455 460
456 TrackDismissEvent(DISMISS_EVENT_BANNER_CLICK); 461 TrackDismissEvent(DISMISS_EVENT_BANNER_CLICK);
457 return true; 462 return true;
458 } 463 }
459 464
460 bool RegisterAppBannerInfoBarDelegateAndroid(JNIEnv* env) { 465 bool RegisterAppBannerInfoBarDelegateAndroid(JNIEnv* env) {
461 return RegisterNativesImpl(env); 466 return RegisterNativesImpl(env);
462 } 467 }
463 468
464 } // namespace banners 469 } // namespace banners
OLDNEW
« no previous file with comments | « chrome/browser/DEPS ('k') | chrome/browser/android/webapps/add_to_homescreen_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698