| 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" | 9 #include "base/guid.h" |
| 10 #include "base/location.h" | 10 #include "base/location.h" |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 bool AppBannerInfoBarDelegateAndroid::Create( | 49 bool AppBannerInfoBarDelegateAndroid::Create( |
| 50 content::WebContents* web_contents, | 50 content::WebContents* web_contents, |
| 51 base::WeakPtr<AppBannerManager> weak_manager, | 51 base::WeakPtr<AppBannerManager> weak_manager, |
| 52 const base::string16& app_title, | 52 const base::string16& app_title, |
| 53 std::unique_ptr<ShortcutInfo> shortcut_info, | 53 std::unique_ptr<ShortcutInfo> shortcut_info, |
| 54 std::unique_ptr<SkBitmap> icon, | 54 std::unique_ptr<SkBitmap> icon, |
| 55 int event_request_id, | 55 int event_request_id, |
| 56 webapk::InstallSource webapk_install_source) { | 56 webapk::InstallSource webapk_install_source) { |
| 57 bool is_webapk = ChromeWebApkHost::AreWebApkEnabled(); | 57 bool is_webapk = ChromeWebApkHost::AreWebApkEnabled(); |
| 58 std::string webapk_package_name = ""; | 58 std::string webapk_package_name = ""; |
| 59 if (is_webapk) { | 59 const GURL& url = shortcut_info->url; |
| 60 webapk_package_name = ShortcutHelper::QueryWebApkPackage( | 60 if (is_webapk) |
| 61 web_contents->GetLastCommittedURL()); | 61 webapk_package_name = ShortcutHelper::QueryWebApkPackage(url); |
| 62 } | |
| 63 bool is_webapk_already_installed = !webapk_package_name.empty(); | 62 bool is_webapk_already_installed = !webapk_package_name.empty(); |
| 64 const GURL& url = shortcut_info->url; | |
| 65 auto infobar_delegate = | 63 auto infobar_delegate = |
| 66 base::WrapUnique(new banners::AppBannerInfoBarDelegateAndroid( | 64 base::WrapUnique(new banners::AppBannerInfoBarDelegateAndroid( |
| 67 weak_manager, app_title, std::move(shortcut_info), std::move(icon), | 65 weak_manager, app_title, std::move(shortcut_info), std::move(icon), |
| 68 event_request_id, is_webapk, is_webapk_already_installed, | 66 event_request_id, is_webapk, is_webapk_already_installed, |
| 69 webapk_install_source)); | 67 webapk_install_source)); |
| 70 auto raw_delegate = infobar_delegate.get(); | 68 auto raw_delegate = infobar_delegate.get(); |
| 71 auto infobar = base::MakeUnique<AppBannerInfoBarAndroid>( | 69 auto infobar = base::MakeUnique<AppBannerInfoBarAndroid>( |
| 72 std::move(infobar_delegate), url, is_webapk); | 70 std::move(infobar_delegate), url, is_webapk); |
| 73 if (!InfoBarService::FromWebContents(web_contents) | 71 if (!InfoBarService::FromWebContents(web_contents) |
| 74 ->AddInfoBar(std::move(infobar))) | 72 ->AddInfoBar(std::move(infobar))) |
| (...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 460 | 458 |
| 461 TrackDismissEvent(DISMISS_EVENT_BANNER_CLICK); | 459 TrackDismissEvent(DISMISS_EVENT_BANNER_CLICK); |
| 462 return true; | 460 return true; |
| 463 } | 461 } |
| 464 | 462 |
| 465 bool RegisterAppBannerInfoBarDelegateAndroid(JNIEnv* env) { | 463 bool RegisterAppBannerInfoBarDelegateAndroid(JNIEnv* env) { |
| 466 return RegisterNativesImpl(env); | 464 return RegisterNativesImpl(env); |
| 467 } | 465 } |
| 468 | 466 |
| 469 } // namespace banners | 467 } // namespace banners |
| OLD | NEW |