Commit 6c3202e0 authored by sczs's avatar sczs Committed by Commit Bot

[ios] Creates kConfirmInfobarMessagesUI feature flag.

This flag will be used so ConfirmInfobars use the new Messages UI.
It will be enabled by default, but it will only work if the core
InfobarUIReboot flag is enabled. This way we'll be able to maintain the
same population that has been using Messages the past releases, and
we'll also be able to turn off this specific feature in case something
goes wrong.


Bug: 961343
Change-Id: Ia69664ece14235fcafdf693c9b6e3d193a57e53f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1827681
Commit-Queue: Sergio Collazos <sczs@chromium.org>
Reviewed-by: default avatarPeter Lee <pkl@chromium.org>
Cr-Commit-Position: refs/heads/master@{#701371}
parent e5ad06a7
...@@ -136,7 +136,7 @@ bool SessionCrashedInfoBarDelegate::Create( ...@@ -136,7 +136,7 @@ bool SessionCrashedInfoBarDelegate::Create(
std::unique_ptr<ConfirmInfoBarDelegate> delegate( std::unique_ptr<ConfirmInfoBarDelegate> delegate(
new SessionCrashedInfoBarDelegate(crash_restore_helper)); new SessionCrashedInfoBarDelegate(crash_restore_helper));
if (IsInfobarUIRebootEnabled()) { if (IsConfirmInfobarMessagesUIEnabled()) {
return !!infobar_manager->AddInfoBar( return !!infobar_manager->AddInfoBar(
::CreateHighPriorityConfirmInfoBar(std::move(delegate))); ::CreateHighPriorityConfirmInfoBar(std::move(delegate)));
} else { } else {
......
...@@ -555,6 +555,10 @@ const flags_ui::FeatureEntry kFeatureEntries[] = { ...@@ -555,6 +555,10 @@ const flags_ui::FeatureEntry kFeatureEntries[] = {
flag_descriptions::kEmbedderBlockRestoreUrlName, flag_descriptions::kEmbedderBlockRestoreUrlName,
flag_descriptions::kEmbedderBlockRestoreUrlDescription, flags_ui::kOsIos, flag_descriptions::kEmbedderBlockRestoreUrlDescription, flags_ui::kOsIos,
FEATURE_VALUE_TYPE(kEmbedderBlockRestoreUrl)}, FEATURE_VALUE_TYPE(kEmbedderBlockRestoreUrl)},
{"messages-confirm-infobars",
flag_descriptions::kConfirmInfobarMessagesUIName,
flag_descriptions::kConfirmInfobarMessagesUIDescription, flags_ui::kOsIos,
FEATURE_VALUE_TYPE(kConfirmInfobarMessagesUI)},
}; };
// Add all switches from experimental flags to |command_line|. // Add all switches from experimental flags to |command_line|.
......
...@@ -120,6 +120,10 @@ const char kCollectionsCardPresentationStyleDescription[] = ...@@ -120,6 +120,10 @@ const char kCollectionsCardPresentationStyleDescription[] =
"When enabled collections are presented using the new iOS13 card " "When enabled collections are presented using the new iOS13 card "
"style."; "style.";
const char kConfirmInfobarMessagesUIName[] = "Confirm Infobars Messages UI";
const char kConfirmInfobarMessagesUIDescription[] =
"When enabled Confirm Infobars use the new Messages UI.";
const char kCopiedContentBehaviorName[] = const char kCopiedContentBehaviorName[] =
"Enable differentiating between copied urls, text, and images"; "Enable differentiating between copied urls, text, and images";
const char kCopiedContentBehaviorDescription[] = const char kCopiedContentBehaviorDescription[] =
......
...@@ -92,6 +92,11 @@ extern const char kBrowserContainerKeepsContentViewDescription[]; ...@@ -92,6 +92,11 @@ extern const char kBrowserContainerKeepsContentViewDescription[];
extern const char kCollectionsCardPresentationStyleName[]; extern const char kCollectionsCardPresentationStyleName[];
extern const char kCollectionsCardPresentationStyleDescription[]; extern const char kCollectionsCardPresentationStyleDescription[];
// Title and description for the flag that enables Messages UI on
// ConfirmInfobars.
extern const char kConfirmInfobarMessagesUIName[];
extern const char kConfirmInfobarMessagesUIDescription[];
// Title and description for the flag to diffentiate between copied // Title and description for the flag to diffentiate between copied
// urls, strings, and images. // urls, strings, and images.
extern const char kCopiedContentBehaviorName[]; extern const char kCopiedContentBehaviorName[];
......
...@@ -20,9 +20,7 @@ ...@@ -20,9 +20,7 @@
std::unique_ptr<infobars::InfoBar> CreateConfirmInfoBar( std::unique_ptr<infobars::InfoBar> CreateConfirmInfoBar(
std::unique_ptr<ConfirmInfoBarDelegate> delegate) { std::unique_ptr<ConfirmInfoBarDelegate> delegate) {
// TODO(crbug.com/961343): Temporarily disabling the use of if (IsConfirmInfobarMessagesUIEnabled()) {
// InfobarConfirmCoordinator until multiple message support has been added.
if (IsInfobarUIRebootEnabled() && NO) {
// TODO(crbug.com/927064): Coordinators shouldn't be created at this level, // TODO(crbug.com/927064): Coordinators shouldn't be created at this level,
// we should probably send only the delegate and have the presenting // we should probably send only the delegate and have the presenting
// Coordinator create the right Coordinator using that delegate. // Coordinator create the right Coordinator using that delegate.
......
...@@ -7,10 +7,21 @@ ...@@ -7,10 +7,21 @@
#include "base/feature_list.h" #include "base/feature_list.h"
// Feature to choose whether to use the new Infobar design, or the legacy one. // Feature to choose whether to use the new Messages Infobar design, or the
// legacy one.
// Use IsInfobarUIRebootEnabled() instead of this constant directly.
extern const base::Feature kInfobarUIReboot; extern const base::Feature kInfobarUIReboot;
// Whether the Infobar UI Reboot is enabled. // Feature to choose whether Confirm Infobars use the new Messages UI or the
// legacy one. In order for it to work kInfobarUIReboot also needs to be
// enabled.
// Use IsConfirmInfobarMessagesUIEnabled() instead of this constant directly.
extern const base::Feature kConfirmInfobarMessagesUI;
// Whether the Messages Infobar UI is enabled.
bool IsInfobarUIRebootEnabled(); bool IsInfobarUIRebootEnabled();
// Whether the Confirm Infobar Messages UI is enabled.
bool IsConfirmInfobarMessagesUIEnabled();
#endif // IOS_CHROME_BROWSER_UI_INFOBARS_INFOBAR_FEATURE_H_ #endif // IOS_CHROME_BROWSER_UI_INFOBARS_INFOBAR_FEATURE_H_
...@@ -11,6 +11,17 @@ ...@@ -11,6 +11,17 @@
const base::Feature kInfobarUIReboot{"InfobarUIReboot", const base::Feature kInfobarUIReboot{"InfobarUIReboot",
base::FEATURE_DISABLED_BY_DEFAULT}; base::FEATURE_DISABLED_BY_DEFAULT};
// Feature enabled by default since it will always be checked along
// kInfobarUIReboot, effectively working as a kill switch. Meaning that if
// kInfobarUIReboot is not enabled this feature won't work.
const base::Feature kConfirmInfobarMessagesUI{"ConfirmInfobarMessagesUI",
base::FEATURE_ENABLED_BY_DEFAULT};
bool IsInfobarUIRebootEnabled() { bool IsInfobarUIRebootEnabled() {
return base::FeatureList::IsEnabled(kInfobarUIReboot); return base::FeatureList::IsEnabled(kInfobarUIReboot);
} }
bool IsConfirmInfobarMessagesUIEnabled() {
return base::FeatureList::IsEnabled(kConfirmInfobarMessagesUI) &&
IsInfobarUIRebootEnabled();
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment