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

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

Issue 2124703003: Do not show "Add to Home Screen" info bar if WebAPK is installed (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Merge branch 'master' into webapk_app_banner_already_installed Created 4 years, 5 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
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_data_fetcher_android.h" 5 #include "chrome/browser/android/banners/app_banner_data_fetcher_android.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 66
67 GURL image_url = ManifestIconSelector::FindBestMatchingIcon( 67 GURL image_url = ManifestIconSelector::FindBestMatchingIcon(
68 manifest().icons, ideal_splash_image_size_in_dp_, 68 manifest().icons, ideal_splash_image_size_in_dp_,
69 minimum_splash_image_size_in_dp_); 69 minimum_splash_image_size_in_dp_);
70 70
71 return base::Bind(&ShortcutHelper::FetchSplashScreenImage, 71 return base::Bind(&ShortcutHelper::FetchSplashScreenImage,
72 web_contents, image_url, ideal_splash_image_size_in_dp_, 72 web_contents, image_url, ideal_splash_image_size_in_dp_,
73 minimum_splash_image_size_in_dp_, webapp_id); 73 minimum_splash_image_size_in_dp_, webapp_id);
74 } 74 }
75 75
76 bool AppBannerDataFetcherAndroid::IsWebAppInstalled(
77 content::BrowserContext* browser_context,
78 const GURL& start_url) {
79 // Check whether a WebAPK is installed in order to block showing the app
80 // banner if a WebAPK is installed even after a user clears Chrome's data.
81 // This function does not check whether a non-WebAPK web app is installed.
82 return ShortcutHelper::IsWebApkInstalled(start_url);
83 }
84
76 void AppBannerDataFetcherAndroid::ShowBanner(const GURL& icon_url, 85 void AppBannerDataFetcherAndroid::ShowBanner(const GURL& icon_url,
77 const SkBitmap* icon, 86 const SkBitmap* icon,
78 const base::string16& title, 87 const base::string16& title,
79 const std::string& referrer) { 88 const std::string& referrer) {
80 content::WebContents* web_contents = GetWebContents(); 89 content::WebContents* web_contents = GetWebContents();
81 DCHECK(web_contents); 90 DCHECK(web_contents);
82 91
83 infobars::InfoBar* infobar = nullptr; 92 infobars::InfoBar* infobar = nullptr;
84 if (native_app_data_.is_null()) { 93 if (native_app_data_.is_null()) {
85 std::unique_ptr<AppBannerInfoBarDelegateAndroid> delegate( 94 std::unique_ptr<AppBannerInfoBarDelegateAndroid> delegate(
(...skipping 17 matching lines...) Expand all
103 if (infobar) { 112 if (infobar) {
104 RecordDidShowBanner("AppBanner.NativeApp.Shown"); 113 RecordDidShowBanner("AppBanner.NativeApp.Shown");
105 TrackDisplayEvent(DISPLAY_EVENT_NATIVE_APP_BANNER_CREATED); 114 TrackDisplayEvent(DISPLAY_EVENT_NATIVE_APP_BANNER_CREATED);
106 } 115 }
107 } 116 }
108 InfoBarService::FromWebContents(web_contents) 117 InfoBarService::FromWebContents(web_contents)
109 ->AddInfoBar(base::WrapUnique(infobar)); 118 ->AddInfoBar(base::WrapUnique(infobar));
110 } 119 }
111 120
112 } // namespace banners 121 } // namespace banners
OLDNEW
« no previous file with comments | « chrome/browser/android/banners/app_banner_data_fetcher_android.h ('k') | chrome/browser/android/shortcut_helper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698