Commit 07e3277b authored by Chris Lu's avatar Chris Lu Committed by Chromium LUCI CQ

[ios] Persist Crash Restore flag

Add a feature flag to encapsulate logic that will persist the crash
restore infobar across navigations.

Bug: 1162312
Change-Id: I70c00d3ebe8d382c4406286da18a49b608c6744e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2606625
Commit-Queue: Chris Lu <thegreenfrog@chromium.org>
Reviewed-by: default avatarRohit Rao <rohitrao@chromium.org>
Cr-Commit-Position: refs/heads/master@{#839681}
parent 4c66b853
......@@ -3100,6 +3100,11 @@
"owners": [ "livvielin", "bling-flags@google.com" ],
"expiry_milestone": 89
},
{
"name": "ios-persist-crash-restore-infobar",
"owners": [ "thegreenfrog", "bling-flags@google.com" ],
"expiry_milestone": 91
},
{
"name": "ios-shared-highlighting-color-change",
"owners": [ "cheickcisse" ],
......
......@@ -76,6 +76,7 @@ source_set("crash_report_internal") {
"//ios/chrome/browser/sessions:restoration_agent",
"//ios/chrome/browser/sessions:serialisation",
"//ios/chrome/browser/sessions:session_service",
"//ios/chrome/browser/ui:feature_flags",
"//ios/chrome/browser/ui/main:scene_state_header",
"//ios/chrome/browser/ui/util:multiwindow_util",
"//ios/chrome/browser/web:tab_id_tab_helper",
......
......@@ -7,6 +7,7 @@
#include <memory>
#include <utility>
#include "base/feature_list.h"
#include "base/metrics/histogram_functions.h"
#include "base/metrics/user_metrics.h"
#include "base/metrics/user_metrics_action.h"
......@@ -35,6 +36,7 @@
#import "ios/chrome/browser/sessions/session_window_ios.h"
#import "ios/chrome/browser/ui/main/scene_state.h"
#import "ios/chrome/browser/ui/main/scene_state_browser_agent.h"
#include "ios/chrome/browser/ui/ui_feature_flags.h"
#import "ios/chrome/browser/ui/util/multi_window_support.h"
#include "ios/chrome/browser/web_state_list/web_state_list.h"
#include "ios/chrome/grit/ios_theme_resources.h"
......@@ -141,6 +143,7 @@ class SessionCrashedInfoBarDelegate : public ConfirmInfoBarDelegate {
base::string16 GetButtonLabel(InfoBarButton button) const override;
bool Accept() override;
void InfoBarDismissed() override;
bool ShouldExpire(const NavigationDetails& details) const override;
int GetIconId() const override;
// TimeInterval when the delegate was created.
......@@ -215,6 +218,15 @@ void SessionCrashedInfoBarDelegate::InfoBarDismissed() {
forInfobarConfirmType:InfobarConfirmType::kInfobarConfirmTypeRestore];
}
bool SessionCrashedInfoBarDelegate::ShouldExpire(
const NavigationDetails& details) const {
if (base::FeatureList::IsEnabled(kIOSPersistCrashRestore)) {
return false;
} else {
return InfoBarDelegate::ShouldExpire(details);
}
}
int SessionCrashedInfoBarDelegate::GetIconId() const {
return IDR_IOS_INFOBAR_RESTORE_SESSION;
}
......
......@@ -583,6 +583,10 @@ const flags_ui::FeatureEntry kFeatureEntries[] = {
flag_descriptions::kIOSSharedHighlightingColorChangeName,
flag_descriptions::kIOSSharedHighlightingColorChangeDescription,
flags_ui::kOsIos, FEATURE_VALUE_TYPE(kIOSSharedHighlightingColorChange)},
{"ios-persist-crash-restore-infobar",
flag_descriptions::kIOSPersistCrashRestoreName,
flag_descriptions::kIOSPersistCrashRestoreDescription, flags_ui::kOsIos,
FEATURE_VALUE_TYPE(kIOSPersistCrashRestore)},
};
bool SkipConditionalFeatureEntry(const flags_ui::FeatureEntry& entry) {
......
......@@ -265,6 +265,11 @@ const char kIOSLegacyTLSInterstitialsDescription[] =
"that use legacy TLS connections, and subresources using legacy TLS "
"connections will be blocked.";
const char kIOSPersistCrashRestoreName[] = "Persist Crash Restore Infobar";
const char kIOSPersistCrashRestoreDescription[] =
"When enabled, the Crash Restore Infobar will persist through navigations "
"instead of dismissing.";
const char kIOSSharedHighlightingColorChangeName[] =
"IOS Shared Highlighting color change";
const char kIOSSharedHighlightingColorChangeDescription[] =
......
......@@ -227,6 +227,11 @@ extern const char kInProductHelpDemoModeDescription[];
extern const char kIOSLegacyTLSInterstitialsName[];
extern const char kIOSLegacyTLSInterstitialsDescription[];
// Title and description for the flag to persist the Crash Restore Infobar
// across navigations.
extern const char kIOSPersistCrashRestoreName[];
extern const char kIOSPersistCrashRestoreDescription[];
// Title and description for the flag to enable Shared Highlighting color
// change in iOS.
extern const char kIOSSharedHighlightingColorChangeName[];
......
......@@ -69,3 +69,6 @@ const base::Feature kDefaultBrowserFullscreenPromoExperiment{
const base::Feature kIOSSharedHighlightingColorChange{
"IOSSharedHighlightingColorChange", base::FEATURE_DISABLED_BY_DEFAULT};
const base::Feature kIOSPersistCrashRestore{"IOSPersistCrashRestore",
base::FEATURE_DISABLED_BY_DEFAULT};
......@@ -74,4 +74,8 @@ extern const base::Feature kDefaultBrowserFullscreenPromoExperiment;
// Feature flag that enable Shared Highlighting color change in iOS.
extern const base::Feature kIOSSharedHighlightingColorChange;
// Feature flag that enables persisting the Crash Restore Infobar across
// navigations.
extern const base::Feature kIOSPersistCrashRestore;
#endif // IOS_CHROME_BROWSER_UI_UI_FEATURE_FLAGS_H_
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