| OLD | NEW |
| 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" | |
| 10 #include "base/location.h" | 9 #include "base/location.h" |
| 11 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| 12 #include "base/timer/elapsed_timer.h" | 11 #include "base/timer/elapsed_timer.h" |
| 13 #include "chrome/browser/android/shortcut_helper.h" | 12 #include "chrome/browser/android/shortcut_helper.h" |
| 14 #include "chrome/browser/android/shortcut_info.h" | 13 #include "chrome/browser/android/shortcut_info.h" |
| 15 #include "chrome/browser/android/tab_android.h" | 14 #include "chrome/browser/android/tab_android.h" |
| 16 #include "chrome/browser/android/webapk/chrome_webapk_host.h" | 15 #include "chrome/browser/android/webapk/chrome_webapk_host.h" |
| 17 #include "chrome/browser/android/webapk/webapk_installer.h" | 16 #include "chrome/browser/android/webapk/webapk_installer.h" |
| 18 #include "chrome/browser/banners/app_banner_manager.h" | 17 #include "chrome/browser/banners/app_banner_manager.h" |
| 19 #include "chrome/browser/banners/app_banner_metrics.h" | 18 #include "chrome/browser/banners/app_banner_metrics.h" |
| (...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 288 | 287 |
| 289 bool AppBannerInfoBarDelegateAndroid::AcceptWebApp( | 288 bool AppBannerInfoBarDelegateAndroid::AcceptWebApp( |
| 290 content::WebContents* web_contents) { | 289 content::WebContents* web_contents) { |
| 291 if (IsInfoEmpty(shortcut_info_)) | 290 if (IsInfoEmpty(shortcut_info_)) |
| 292 return true; | 291 return true; |
| 293 TrackUserResponse(USER_RESPONSE_WEB_APP_ACCEPTED); | 292 TrackUserResponse(USER_RESPONSE_WEB_APP_ACCEPTED); |
| 294 | 293 |
| 295 AppBannerSettingsHelper::RecordBannerInstallEvent( | 294 AppBannerSettingsHelper::RecordBannerInstallEvent( |
| 296 web_contents, shortcut_info_->url.spec(), AppBannerSettingsHelper::WEB); | 295 web_contents, shortcut_info_->url.spec(), AppBannerSettingsHelper::WEB); |
| 297 | 296 |
| 298 if (weak_manager_) { | 297 ShortcutHelper::AddToLauncherWithSkBitmap(web_contents, *shortcut_info_, |
| 299 const std::string& uid = base::GenerateGUID(); | 298 *icon_.get()); |
| 300 ShortcutHelper::AddToLauncherWithSkBitmap( | |
| 301 web_contents->GetBrowserContext(), *shortcut_info_, uid, | |
| 302 *icon_.get(), weak_manager_->FetchWebappSplashScreenImageCallback(uid)); | |
| 303 } | |
| 304 | 299 |
| 305 SendBannerAccepted(); | 300 SendBannerAccepted(); |
| 306 return true; | 301 return true; |
| 307 } | 302 } |
| 308 | 303 |
| 309 bool AppBannerInfoBarDelegateAndroid::AcceptWebApk( | 304 bool AppBannerInfoBarDelegateAndroid::AcceptWebApk( |
| 310 content::WebContents* web_contents) { | 305 content::WebContents* web_contents) { |
| 311 if (IsInfoEmpty(shortcut_info_)) | 306 if (IsInfoEmpty(shortcut_info_)) |
| 312 return true; | 307 return true; |
| 313 | 308 |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 473 | 468 |
| 474 TrackDismissEvent(DISMISS_EVENT_BANNER_CLICK); | 469 TrackDismissEvent(DISMISS_EVENT_BANNER_CLICK); |
| 475 return true; | 470 return true; |
| 476 } | 471 } |
| 477 | 472 |
| 478 bool RegisterAppBannerInfoBarDelegateAndroid(JNIEnv* env) { | 473 bool RegisterAppBannerInfoBarDelegateAndroid(JNIEnv* env) { |
| 479 return RegisterNativesImpl(env); | 474 return RegisterNativesImpl(env); |
| 480 } | 475 } |
| 481 | 476 |
| 482 } // namespace banners | 477 } // namespace banners |
| OLD | NEW |