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

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

Issue 2729993002: WebAPKs: Pass callback of type WebApkInstallService::FinishCallback to ShortcutHelper (Closed)
Patch Set: Merge branch 'master' into refactor_shortcut_helper29 Created 3 years, 9 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/shortcut_helper.h » ('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/location.h" 9 #include "base/location.h"
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
11 #include "base/timer/elapsed_timer.h" 11 #include "base/timer/elapsed_timer.h"
12 #include "chrome/browser/android/shortcut_helper.h" 12 #include "chrome/browser/android/shortcut_helper.h"
13 #include "chrome/browser/android/shortcut_info.h" 13 #include "chrome/browser/android/shortcut_info.h"
14 #include "chrome/browser/android/tab_android.h" 14 #include "chrome/browser/android/tab_android.h"
15 #include "chrome/browser/android/webapk/chrome_webapk_host.h" 15 #include "chrome/browser/android/webapk/chrome_webapk_host.h"
16 #include "chrome/browser/android/webapk/webapk_installer.h" 16 #include "chrome/browser/android/webapk/webapk_install_service.h"
17 #include "chrome/browser/banners/app_banner_manager.h" 17 #include "chrome/browser/banners/app_banner_manager.h"
18 #include "chrome/browser/banners/app_banner_metrics.h" 18 #include "chrome/browser/banners/app_banner_metrics.h"
19 #include "chrome/browser/banners/app_banner_settings_helper.h" 19 #include "chrome/browser/banners/app_banner_settings_helper.h"
20 #include "chrome/browser/browser_process.h" 20 #include "chrome/browser/browser_process.h"
21 #include "chrome/browser/infobars/infobar_service.h" 21 #include "chrome/browser/infobars/infobar_service.h"
22 #include "chrome/browser/ui/android/infobars/app_banner_infobar_android.h" 22 #include "chrome/browser/ui/android/infobars/app_banner_infobar_android.h"
23 #include "components/rappor/public/rappor_utils.h" 23 #include "components/rappor/public/rappor_utils.h"
24 #include "components/rappor/rappor_service_impl.h" 24 #include "components/rappor/rappor_service_impl.h"
25 #include "content/public/browser/web_contents.h" 25 #include "content/public/browser/web_contents.h"
26 #include "content/public/common/manifest.h" 26 #include "content/public/common/manifest.h"
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 AppBannerSettingsHelper::RecordBannerEvent( 339 AppBannerSettingsHelper::RecordBannerEvent(
340 web_contents, web_contents->GetLastCommittedURL(), 340 web_contents, web_contents->GetLastCommittedURL(),
341 shortcut_info_->url.spec(), 341 shortcut_info_->url.spec(),
342 AppBannerSettingsHelper::APP_BANNER_EVENT_DID_ADD_TO_HOMESCREEN, 342 AppBannerSettingsHelper::APP_BANNER_EVENT_DID_ADD_TO_HOMESCREEN,
343 AppBannerManager::GetCurrentTime()); 343 AppBannerManager::GetCurrentTime());
344 } 344 }
345 345
346 Java_AppBannerInfoBarDelegateAndroid_setWebApkInstallingState( 346 Java_AppBannerInfoBarDelegateAndroid_setWebApkInstallingState(
347 env, java_delegate_, true); 347 env, java_delegate_, true);
348 UpdateInstallState(env, nullptr); 348 UpdateInstallState(env, nullptr);
349 WebApkInstaller::FinishCallback callback = 349 WebApkInstallService::FinishCallback callback =
350 base::Bind(&AppBannerInfoBarDelegateAndroid::OnWebApkInstallFinished, 350 base::Bind(&AppBannerInfoBarDelegateAndroid::OnWebApkInstallFinished,
351 weak_ptr_factory_.GetWeakPtr()); 351 weak_ptr_factory_.GetWeakPtr());
352 ShortcutHelper::InstallWebApkWithSkBitmap(web_contents, *shortcut_info_, 352 ShortcutHelper::InstallWebApkWithSkBitmap(web_contents, *shortcut_info_,
353 *icon_.get(), callback); 353 *icon_.get(), callback);
354 SendBannerAccepted(); 354 SendBannerAccepted();
355 355
356 // Prevent the infobar from disappearing, because the infobar will show 356 // Prevent the infobar from disappearing, because the infobar will show
357 // "Adding" during the installation process. 357 // "Adding" during the installation process.
358 return false; 358 return false;
359 } 359 }
360 360
361 bool AppBannerInfoBarDelegateAndroid::TriggeredFromBanner() const { 361 bool AppBannerInfoBarDelegateAndroid::TriggeredFromBanner() const {
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
481 481
482 TrackDismissEvent(DISMISS_EVENT_BANNER_CLICK); 482 TrackDismissEvent(DISMISS_EVENT_BANNER_CLICK);
483 return true; 483 return true;
484 } 484 }
485 485
486 bool RegisterAppBannerInfoBarDelegateAndroid(JNIEnv* env) { 486 bool RegisterAppBannerInfoBarDelegateAndroid(JNIEnv* env) {
487 return RegisterNativesImpl(env); 487 return RegisterNativesImpl(env);
488 } 488 }
489 489
490 } // namespace banners 490 } // namespace banners
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/android/shortcut_helper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698