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

Unified Diff: chrome/browser/android/banners/app_banner_infobar_delegate_android.cc

Issue 2913383002: Remove unnecessary IsInfoEmpty() call in app_banner_infobar_delegate_android.cc (Closed)
Patch Set: Merge branch 'master' into same_infobar_title0 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/android/banners/app_banner_infobar_delegate_android.cc
diff --git a/chrome/browser/android/banners/app_banner_infobar_delegate_android.cc b/chrome/browser/android/banners/app_banner_infobar_delegate_android.cc
index 2755e15d24f5591b3320cfc12529e6e52e386840..b9229eb88efa2a24ef9b62f51fa8386300560155 100644
--- a/chrome/browser/android/banners/app_banner_infobar_delegate_android.cc
+++ b/chrome/browser/android/banners/app_banner_infobar_delegate_android.cc
@@ -35,14 +35,6 @@ using base::android::ConvertUTF16ToJavaString;
using base::android::JavaParamRef;
using base::android::ScopedJavaLocalRef;
-namespace {
-
-bool IsInfoEmpty(const std::unique_ptr<ShortcutInfo>& info) {
- return !info || info->url.is_empty();
-}
-
-} // anonymous namespace
-
namespace banners {
// static
@@ -56,7 +48,11 @@ bool AppBannerInfoBarDelegateAndroid::Create(
int event_request_id,
bool is_webapk,
webapk::InstallSource webapk_install_source) {
+ DCHECK(shortcut_info);
const GURL url = shortcut_info->url;
+ if (url.is_empty())
+ return false;
+
auto infobar_delegate =
base::WrapUnique(new banners::AppBannerInfoBarDelegateAndroid(
weak_manager, app_title, std::move(shortcut_info), primary_icon,
@@ -225,7 +221,6 @@ AppBannerInfoBarDelegateAndroid::AppBannerInfoBarDelegateAndroid(
install_state_(INSTALL_NOT_STARTED),
webapk_install_source_(webapk_install_source),
weak_ptr_factory_(this) {
- DCHECK(!IsInfoEmpty(shortcut_info_));
CreateJavaDelegate();
}
@@ -280,8 +275,6 @@ bool AppBannerInfoBarDelegateAndroid::AcceptNativeApp(
bool AppBannerInfoBarDelegateAndroid::AcceptWebApp(
content::WebContents* web_contents) {
- if (IsInfoEmpty(shortcut_info_))
- return true;
TrackUserResponse(USER_RESPONSE_WEB_APP_ACCEPTED);
AppBannerSettingsHelper::RecordBannerInstallEvent(
@@ -296,9 +289,6 @@ bool AppBannerInfoBarDelegateAndroid::AcceptWebApp(
bool AppBannerInfoBarDelegateAndroid::AcceptWebApk(
content::WebContents* web_contents) {
- if (IsInfoEmpty(shortcut_info_))
- return true;
-
JNIEnv* env = base::android::AttachCurrentThread();
// If the WebAPK is installed and the "Open" button is clicked, open the
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698