Limit offline content suggestions to dino page
Previously, offline content suggestions would show on
any net error page. Now they only show on the dino page, as intended.
As a beneficial side-effect, the error strings (available on page load) will
indicate whether offline content may be inserted to the page later. This is
important for implementing the final UI because, for instance, we need to hide
error help suggestions to make room for content.
I moved the feature flag from browser/ to chrome/common so that it is accessible
from the error page code.
This code was previously reviewed here: https://chromium-review.googlesource.com/c/chromium/src/+/1185282
and needed move to another issue for an OOO reviewer.
Bug: 852872
Cq-Include-Trybots: luci.chromium.try:ios-simulator-full-configs;master.tryserver.chromium.mac:ios-simulator-cronet
Change-Id: I86392d2b10d1f243525f043e0627b04f41f83b96
Reviewed-on: https://chromium-review.googlesource.com/1194245
Reviewed-by: Shakti Sahu <[email protected]>
Reviewed-by: Matt Menke <[email protected]>
Reviewed-by: Carlos Knippschild <[email protected]>
Reviewed-by: Peter Lee <[email protected]>
Commit-Queue: Dan H <[email protected]>
Cr-Commit-Position: refs/heads/master@{#586781}
diff --git a/chrome/browser/BUILD.gn b/chrome/browser/BUILD.gn
index 37ac1734..4b21423 100644
--- a/chrome/browser/BUILD.gn
+++ b/chrome/browser/BUILD.gn
@@ -2120,8 +2120,6 @@
"android/download/items/offline_content_aggregator_factory_android.cc",
"android/download/local_media_data_source_factory.cc",
"android/download/local_media_data_source_factory.h",
- "android/download/new_net_error_page_feature.cc",
- "android/download/new_net_error_page_feature.h",
"android/download/service/download_background_task.cc",
"android/download/service/download_task_scheduler.cc",
"android/download/service/download_task_scheduler.h",
diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc
index 6c026bd..a35b486 100644
--- a/chrome/browser/about_flags.cc
+++ b/chrome/browser/about_flags.cc
@@ -144,7 +144,6 @@
#if defined(OS_ANDROID)
#include "chrome/browser/android/chrome_feature_list.h"
-#include "chrome/browser/android/download/new_net_error_page_feature.h"
#include "chrome/browser/android/explore_sites/explore_sites_feature.h"
#else // OS_ANDROID
#include "chrome/browser/media/router/media_router_feature.h"
@@ -1234,17 +1233,17 @@
#if defined(OS_ANDROID)
const FeatureEntry::FeatureParam kNewNetErrorPageUIContentList = {
- chrome::android::new_net_error_ui::kUIAlternateParameterName,
- chrome::android::new_net_error_ui::kUIAlternateContentList};
+ features::kNewNetErrorPageUIAlternateParameterName,
+ features::kNewNetErrorPageUIAlternateContentList};
const FeatureEntry::FeatureParam kNewNetErrorPageUIContentListAutoDL = {
- chrome::android::new_net_error_ui::kUIAlternateParameterName,
- chrome::android::new_net_error_ui::kUIAlternateContentListAutoDownload};
+ features::kNewNetErrorPageUIAlternateParameterName,
+ features::kNewNetErrorPageUIAlternateContentListAutoDownload};
const FeatureEntry::FeatureParam kNewNetErrorPageUIContentPreview = {
- chrome::android::new_net_error_ui::kUIAlternateParameterName,
- chrome::android::new_net_error_ui::kUIAlternateContentPreview};
+ features::kNewNetErrorPageUIAlternateParameterName,
+ features::kNewNetErrorPageUIAlternateContentPreview};
const FeatureEntry::FeatureParam kNewNetErrorPageUIContentPreviewAutoDL = {
- chrome::android::new_net_error_ui::kUIAlternateParameterName,
- chrome::android::new_net_error_ui::kUIAlternateContentPreviewAutoDownload};
+ features::kNewNetErrorPageUIAlternateParameterName,
+ features::kNewNetErrorPageUIAlternateContentPreviewAutoDownload};
const FeatureEntry::FeatureVariation kNewNetErrorPageUIVariations[] = {
{"Content List", &kNewNetErrorPageUIContentList, 1, nullptr},
@@ -3699,7 +3698,7 @@
#if defined(OS_ANDROID)
{"new-net-error-page-ui", flag_descriptions::kNewNetErrorPageUIName,
flag_descriptions::kNewNetErrorPageUIDescription, kOsAndroid,
- FEATURE_WITH_PARAMS_VALUE_TYPE(chrome::android::kNewNetErrorPageUI,
+ FEATURE_WITH_PARAMS_VALUE_TYPE(features::kNewNetErrorPageUI,
kNewNetErrorPageUIVariations,
"NewNetErrorPageUI")},
#endif // defined(OS_ANDROID)
diff --git a/chrome/browser/android/chrome_feature_list.cc b/chrome/browser/android/chrome_feature_list.cc
index 6611676..a850143 100644
--- a/chrome/browser/android/chrome_feature_list.cc
+++ b/chrome/browser/android/chrome_feature_list.cc
@@ -117,7 +117,6 @@
&kLongPressBackNewDesign,
&kModalPermissionDialogView,
&kNewContactsPicker,
- &kNewNetErrorPageUI,
&kNewPhotoPicker,
&kNoCreditCardAbort,
&kNTPButton,
@@ -340,9 +339,6 @@
const base::Feature kNewContactsPicker{"NewContactsPicker",
base::FEATURE_DISABLED_BY_DEFAULT};
-const base::Feature kNewNetErrorPageUI{"NewNetErrorPageUI",
- base::FEATURE_DISABLED_BY_DEFAULT};
-
const base::Feature kNewPhotoPicker{"NewPhotoPicker",
base::FEATURE_ENABLED_BY_DEFAULT};
diff --git a/chrome/browser/android/chrome_feature_list.h b/chrome/browser/android/chrome_feature_list.h
index 4bfb63c..c446c75 100644
--- a/chrome/browser/android/chrome_feature_list.h
+++ b/chrome/browser/android/chrome_feature_list.h
@@ -61,7 +61,6 @@
extern const base::Feature kModalPermissionDialogView;
extern const base::Feature kSearchEnginePromoExistingDevice;
extern const base::Feature kSearchEnginePromoNewDevice;
-extern const base::Feature kNewNetErrorPageUI;
extern const base::Feature kNewContactsPicker;
extern const base::Feature kNewPhotoPicker;
extern const base::Feature kNoCreditCardAbort;
diff --git a/chrome/browser/android/download/available_offline_content_provider.cc b/chrome/browser/android/download/available_offline_content_provider.cc
index bdf81923..ac2020d 100644
--- a/chrome/browser/android/download/available_offline_content_provider.cc
+++ b/chrome/browser/android/download/available_offline_content_provider.cc
@@ -8,9 +8,9 @@
#include "base/strings/strcat.h"
#include "base/strings/utf_string_conversions.h"
#include "base/time/time.h"
-#include "chrome/browser/android/chrome_feature_list.h"
#include "chrome/browser/android/download/download_manager_service.h"
#include "chrome/browser/offline_items_collection/offline_content_aggregator_factory.h"
+#include "chrome/common/chrome_features.h"
#include "components/offline_items_collection/core/offline_content_aggregator.h"
#include "components/offline_items_collection/core/offline_item.h"
#include "mojo/public/cpp/bindings/strong_binding.h"
@@ -214,7 +214,7 @@
AvailableOfflineContentProvider::~AvailableOfflineContentProvider() = default;
void AvailableOfflineContentProvider::List(ListCallback callback) {
- if (!base::FeatureList::IsEnabled(chrome::android::kNewNetErrorPageUI)) {
+ if (!base::FeatureList::IsEnabled(features::kNewNetErrorPageUI)) {
std::move(callback).Run({});
return;
}
diff --git a/chrome/browser/android/download/available_offline_content_provider_unittest.cc b/chrome/browser/android/download/available_offline_content_provider_unittest.cc
index c570e0b..61afd858 100644
--- a/chrome/browser/android/download/available_offline_content_provider_unittest.cc
+++ b/chrome/browser/android/download/available_offline_content_provider_unittest.cc
@@ -7,8 +7,8 @@
#include "base/strings/string_util.h"
#include "base/test/bind_test_util.h"
#include "base/test/scoped_feature_list.h"
-#include "chrome/browser/android/chrome_feature_list.h"
#include "chrome/browser/offline_items_collection/offline_content_aggregator_factory.h"
+#include "chrome/common/chrome_features.h"
#include "chrome/test/base/testing_profile.h"
#include "components/offline_items_collection/core/offline_content_aggregator.h"
#include "components/offline_items_collection/core/offline_item.h"
@@ -131,8 +131,7 @@
}
TEST_F(AvailableOfflineContentTest, AllContentFilteredOut) {
- scoped_feature_list_.InitAndEnableFeature(
- chrome::android::kNewNetErrorPageUI);
+ scoped_feature_list_.InitAndEnableFeature(features::kNewNetErrorPageUI);
content_provider_.SetItems({UselessItem(), OldOfflinePage()});
std::vector<chrome::mojom::AvailableOfflineContentPtr> suggestions =
@@ -142,8 +141,7 @@
}
TEST_F(AvailableOfflineContentTest, ThreeItems) {
- scoped_feature_list_.InitAndEnableFeature(
- chrome::android::kNewNetErrorPageUI);
+ scoped_feature_list_.InitAndEnableFeature(features::kNewNetErrorPageUI);
content_provider_.SetItems({
UselessItem(), VideoItem(), SuggestedOfflinePageItem(), AudioItem(),
});
@@ -183,8 +181,7 @@
}
TEST_F(AvailableOfflineContentTest, NotEnabled) {
- scoped_feature_list_.InitAndDisableFeature(
- chrome::android::kNewNetErrorPageUI);
+ scoped_feature_list_.InitAndDisableFeature(features::kNewNetErrorPageUI);
content_provider_.SetItems({SuggestedOfflinePageItem()});
std::vector<chrome::mojom::AvailableOfflineContentPtr> suggestions =
diff --git a/chrome/browser/android/download/new_net_error_page_feature.cc b/chrome/browser/android/download/new_net_error_page_feature.cc
deleted file mode 100644
index fd261425..0000000
--- a/chrome/browser/android/download/new_net_error_page_feature.cc
+++ /dev/null
@@ -1,21 +0,0 @@
-// Copyright (c) 2018 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "chrome/browser/android/download/new_net_error_page_feature.h"
-
-namespace chrome {
-namespace android {
-namespace new_net_error_ui {
-
-const char kUIAlternateParameterName[] = "ui-alternate";
-
-const char kUIAlternateContentList[] = "content_list";
-const char kUIAlternateContentListAutoDownload[] = "content_list_auto_download";
-const char kUIAlternateContentPreview[] = "content_preview";
-const char kUIAlternateContentPreviewAutoDownload[] =
- "content_preview_auto_download";
-
-} // namespace new_net_error_ui
-} // namespace android
-} // namespace chrome
diff --git a/chrome/browser/android/download/new_net_error_page_feature.h b/chrome/browser/android/download/new_net_error_page_feature.h
deleted file mode 100644
index 23c518b..0000000
--- a/chrome/browser/android/download/new_net_error_page_feature.h
+++ /dev/null
@@ -1,22 +0,0 @@
-// Copyright (c) 2018 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef CHROME_BROWSER_ANDROID_DOWNLOAD_NEW_NET_ERROR_PAGE_FEATURE_H_
-#define CHROME_BROWSER_ANDROID_DOWNLOAD_NEW_NET_ERROR_PAGE_FEATURE_H_
-
-namespace chrome {
-namespace android {
-namespace new_net_error_ui {
-
-extern const char kUIAlternateParameterName[];
-
-extern const char kUIAlternateContentList[];
-extern const char kUIAlternateContentListAutoDownload[];
-extern const char kUIAlternateContentPreview[];
-extern const char kUIAlternateContentPreviewAutoDownload[];
-} // namespace new_net_error_ui
-} // namespace android
-} // namespace chrome
-
-#endif // CHROME_BROWSER_ANDROID_DOWNLOAD_NEW_NET_ERROR_PAGE_FEATURE_H_