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

Unified Diff: chrome/browser/android/shortcut_helper.cc

Issue 935533002: Prevent future app banners when app is added to the homescreen via menu (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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 | « chrome/browser/android/shortcut_helper.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/android/shortcut_helper.cc
diff --git a/chrome/browser/android/shortcut_helper.cc b/chrome/browser/android/shortcut_helper.cc
index 0131235a0bd00941a492a282df336dae94cea224..9ee1d426ccddfa052c457bbc70a55b42a243ba6e 100644
--- a/chrome/browser/android/shortcut_helper.cc
+++ b/chrome/browser/android/shortcut_helper.cc
@@ -17,6 +17,7 @@
#include "base/threading/worker_pool.h"
#include "chrome/browser/android/manifest_icon_selector.h"
#include "chrome/browser/android/tab_android.h"
+#include "chrome/browser/banners/app_banner_settings_helper.h"
#include "chrome/browser/favicon/favicon_service.h"
#include "chrome/browser/favicon/favicon_service_factory.h"
#include "chrome/browser/profiles/profile.h"
@@ -218,6 +219,8 @@ void ShortcutHelper::AddShortcutUsingManifestIcon() {
// Stop observing so we don't get destroyed while doing the last steps.
Observe(NULL);
+ RecordAddToHomescreen();
+
base::WorkerPool::PostTask(
FROM_HERE,
base::Bind(&ShortcutHelper::AddShortcutInBackgroundWithSkBitmap,
@@ -229,6 +232,8 @@ void ShortcutHelper::AddShortcutUsingManifestIcon() {
}
void ShortcutHelper::AddShortcutUsingFavicon() {
+ RecordAddToHomescreen();
gone 2015/02/17 17:58:43 The common point in the pathway for these is to go
benwells 2015/02/17 19:49:53 That's true but it is on the wrong thread. See htt
gone 2015/02/17 19:52:08 Hrm, fair point.
+
Profile* profile =
Profile::FromBrowserContext(web_contents()->GetBrowserContext());
@@ -336,3 +341,12 @@ void ShortcutHelper::AddShortcutInBackgroundWithSkBitmap(
info.display == content::Manifest::DISPLAY_MODE_STANDALONE,
info.orientation);
}
+
+void ShortcutHelper::RecordAddToHomescreen() {
+ // Record that the shortcut has been added, so no banners will be shown
+ // for this app.
+ AppBannerSettingsHelper::RecordBannerEvent(
+ web_contents(), shortcut_info_.url, shortcut_info_.url.spec(),
+ AppBannerSettingsHelper::APP_BANNER_EVENT_DID_ADD_TO_HOMESCREEN,
+ base::Time::Now());
+}
« no previous file with comments | « chrome/browser/android/shortcut_helper.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698