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

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

Issue 941823002: [App banners] Add server-controlled experiment to disable app banners (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add flag BACK to about:flags, use it to disable half of the feature 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/banners/app_banner_manager.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/banners/app_banner_manager.cc
diff --git a/chrome/browser/android/banners/app_banner_manager.cc b/chrome/browser/android/banners/app_banner_manager.cc
index a579f652fae1bddb26a61cc8fcadee0a5ed54ea8..6788b76f3b18da6d2d2b49a642973a2eb0522e39 100644
--- a/chrome/browser/android/banners/app_banner_manager.cc
+++ b/chrome/browser/android/banners/app_banner_manager.cc
@@ -8,6 +8,7 @@
#include "base/android/jni_string.h"
#include "base/bind.h"
#include "base/command_line.h"
+#include "base/metrics/field_trial.h"
#include "base/metrics/histogram.h"
#include "chrome/browser/android/banners/app_banner_infobar_delegate.h"
#include "chrome/browser/android/manifest_icon_selector.h"
@@ -152,6 +153,9 @@ void AppBannerManager::OnDidGetManifest(const content::Manifest& manifest) {
|| !manifest.start_url.is_valid()
|| (manifest.name.is_null() && manifest.short_name.is_null())) {
// No usable manifest, see if there is a play store meta tag.
+ if (!IsEnabledForNativeApps())
+ return;
+
Send(new ChromeViewMsg_RetrieveMetaTagContent(routing_id(),
validated_url_,
kBannerTag));
@@ -361,6 +365,12 @@ bool AppBannerManager::FetchIcon(const GURL& image_url) {
}
// static
+bool AppBannerManager::IsEnabledForNativeApps() {
+ return base::CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kEnableAppInstallAlerts);
+}
+
+// static
base::Time AppBannerManager::GetCurrentTime() {
return base::Time::Now() + gTimeDeltaForTesting;
}
@@ -371,8 +381,9 @@ jlong Init(JNIEnv* env, jobject obj, jint icon_size) {
}
jboolean IsEnabled(JNIEnv* env, jclass clazz) {
- return base::CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kEnableAppInstallAlerts);
+ const std::string group_name =
+ base::FieldTrialList::FindFullName("AppBanners");
+ return group_name == "Enabled";
}
void SetTimeDeltaForTesting(JNIEnv* env, jclass clazz, jint days) {
« no previous file with comments | « chrome/browser/android/banners/app_banner_manager.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698