Commit 61ec142f authored by ddoman's avatar ddoman Committed by Commit bot

Convert --enable-md-history to a feature flag.

The Material Design history flag (#enable-md-history) uses the old-style
UI with only an enable/disable button. It should have a drop-down with
"Default", "Enable", "Disable" like all new feature flags.

BUG=586340

Review URL: https://codereview.chromium.org/1766273002

Cr-Commit-Position: refs/heads/master@{#381662}
parent cbdd98ca
...@@ -1693,7 +1693,7 @@ const FeatureEntry kFeatureEntries[] = { ...@@ -1693,7 +1693,7 @@ const FeatureEntry kFeatureEntries[] = {
#endif // OS_ANDROID #endif // OS_ANDROID
{"enable-md-history", IDS_FLAGS_ENABLE_MATERIAL_DESIGN_HISTORY_NAME, {"enable-md-history", IDS_FLAGS_ENABLE_MATERIAL_DESIGN_HISTORY_NAME,
IDS_FLAGS_ENABLE_MATERIAL_DESIGN_HISTORY_DESCRIPTION, kOsDesktop, IDS_FLAGS_ENABLE_MATERIAL_DESIGN_HISTORY_DESCRIPTION, kOsDesktop,
SINGLE_VALUE_TYPE(switches::kEnableMaterialDesignHistory)}, FEATURE_VALUE_TYPE(features::kMaterialDesignHistoryFeature)},
#if defined(OS_WIN) #if defined(OS_WIN)
{"enable-windows-desktop-search-redirection", {"enable-windows-desktop-search-redirection",
IDS_FLAGS_WINDOWS_DESKTOP_SEARCH_REDIRECTION_NAME, IDS_FLAGS_WINDOWS_DESKTOP_SEARCH_REDIRECTION_NAME,
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
#include "build/build_config.h" #include "build/build_config.h"
#include "chrome/browser/lifetime/application_lifetime.h" #include "chrome/browser/lifetime/application_lifetime.h"
#include "chrome/browser/ui/browser_dialogs.h" #include "chrome/browser/ui/browser_dialogs.h"
#include "chrome/common/chrome_features.h"
#include "chrome/common/chrome_switches.h" #include "chrome/common/chrome_switches.h"
#include "chrome/common/url_constants.h" #include "chrome/common/url_constants.h"
#include "components/url_formatter/url_fixer.h" #include "components/url_formatter/url_fixer.h"
...@@ -74,7 +75,7 @@ bool WillHandleBrowserAboutURL(GURL* url, ...@@ -74,7 +75,7 @@ bool WillHandleBrowserAboutURL(GURL* url,
} else if (host == chrome::kChromeUIHistoryHost) { } else if (host == chrome::kChromeUIHistoryHost) {
// Material design history is handled on the top-level chrome://history // Material design history is handled on the top-level chrome://history
// host. // host.
if (::switches::MdHistoryEnabled()) { if (base::FeatureList::IsEnabled(features::kMaterialDesignHistoryFeature)) {
host = chrome::kChromeUIHistoryHost; host = chrome::kChromeUIHistoryHost;
path = url->path(); path = url->path();
} else { } else {
......
...@@ -55,6 +55,7 @@ ...@@ -55,6 +55,7 @@
#include "chrome/browser/ui/webui/translate_internals/translate_internals_ui.h" #include "chrome/browser/ui/webui/translate_internals/translate_internals_ui.h"
#include "chrome/browser/ui/webui/user_actions/user_actions_ui.h" #include "chrome/browser/ui/webui/user_actions/user_actions_ui.h"
#include "chrome/browser/ui/webui/version_ui.h" #include "chrome/browser/ui/webui/version_ui.h"
#include "chrome/common/chrome_features.h"
#include "chrome/common/chrome_switches.h" #include "chrome/common/chrome_switches.h"
#include "chrome/common/pref_names.h" #include "chrome/common/pref_names.h"
#include "chrome/common/url_constants.h" #include "chrome/common/url_constants.h"
...@@ -400,7 +401,7 @@ WebUIFactoryFunction GetWebUIFactoryFunction(WebUI* web_ui, ...@@ -400,7 +401,7 @@ WebUIFactoryFunction GetWebUIFactoryFunction(WebUI* web_ui,
return &NewWebUI<extensions::ExtensionsUI>; return &NewWebUI<extensions::ExtensionsUI>;
} }
// Material Design history is on its own host, rather than on an Uber page. // Material Design history is on its own host, rather than on an Uber page.
if (::switches::MdHistoryEnabled() && if (base::FeatureList::IsEnabled(features::kMaterialDesignHistoryFeature) &&
url.host() == chrome::kChromeUIHistoryHost) { url.host() == chrome::kChromeUIHistoryHost) {
return &NewWebUI<MdHistoryUI>; return &NewWebUI<MdHistoryUI>;
} }
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
#include "chrome/browser/ui/webui/extensions/extensions_ui.h" #include "chrome/browser/ui/webui/extensions/extensions_ui.h"
#include "chrome/browser/ui/webui/log_web_ui_url.h" #include "chrome/browser/ui/webui/log_web_ui_url.h"
#include "chrome/browser/ui/webui/options/options_ui.h" #include "chrome/browser/ui/webui/options/options_ui.h"
#include "chrome/common/chrome_features.h"
#include "chrome/common/chrome_switches.h" #include "chrome/common/chrome_switches.h"
#include "chrome/common/extensions/chrome_manifest_url_handlers.h" #include "chrome/common/extensions/chrome_manifest_url_handlers.h"
#include "chrome/common/url_constants.h" #include "chrome/common/url_constants.h"
...@@ -108,8 +109,11 @@ content::WebUIDataSource* CreateUberFrameHTMLSource( ...@@ -108,8 +109,11 @@ content::WebUIDataSource* CreateUberFrameHTMLSource(
bool overrides_history = bool overrides_history =
HasExtensionType(browser_context, chrome::kChromeUIHistoryHost); HasExtensionType(browser_context, chrome::kChromeUIHistoryHost);
source->AddString("overridesHistory", overrides_history ? "yes" : "no"); source->AddString("overridesHistory", overrides_history ? "yes" : "no");
source->AddBoolean("hideHistory", source->AddBoolean(
::switches::MdHistoryEnabled() && !overrides_history); "hideHistory",
base::FeatureList::IsEnabled(features::kMaterialDesignHistoryFeature)
&& !overrides_history);
source->DisableDenyXFrameOptions(); source->DisableDenyXFrameOptions();
source->OverrideContentSecurityPolicyFrameSrc("frame-src chrome:;"); source->OverrideContentSecurityPolicyFrameSrc("frame-src chrome:;");
......
...@@ -12,10 +12,12 @@ ...@@ -12,10 +12,12 @@
#include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h" #include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/common/chrome_features.h"
#include "chrome/common/chrome_switches.h" #include "chrome/common/chrome_switches.h"
#include "chrome/common/url_constants.h" #include "chrome/common/url_constants.h"
#include "chrome/test/base/ui_test_utils.h" #include "chrome/test/base/ui_test_utils.h"
#include "chrome/test/base/web_ui_browser_test.h" #include "chrome/test/base/web_ui_browser_test.h"
#include "content/public/common/content_switches.h"
#include "content/public/test/browser_test_utils.h" #include "content/public/test/browser_test_utils.h"
#include "extensions/browser/extension_registry.h" #include "extensions/browser/extension_registry.h"
#include "extensions/common/extension.h" #include "extensions/common/extension.h"
...@@ -92,8 +94,12 @@ IN_PROC_BROWSER_TEST_F(UberUIBrowserTest, EnableMdExtensionsHidesExtensions) { ...@@ -92,8 +94,12 @@ IN_PROC_BROWSER_TEST_F(UberUIBrowserTest, EnableMdExtensionsHidesExtensions) {
} }
IN_PROC_BROWSER_TEST_F(UberUIBrowserTest, EnableMdHistoryHidesHistory) { IN_PROC_BROWSER_TEST_F(UberUIBrowserTest, EnableMdHistoryHidesHistory) {
base::CommandLine::ForCurrentProcess()->AppendSwitch( scoped_ptr<base::FeatureList> feature_list(new base::FeatureList);
::switches::kEnableMaterialDesignHistory); feature_list->InitializeFromCommandLine(
features::kMaterialDesignHistoryFeature.name, "");
base::FeatureList::ClearInstanceForTesting();
base::FeatureList::SetInstance(std::move(feature_list));
ui_test_utils::NavigateToURL(browser(), GURL(chrome::kChromeUIUberFrameURL)); ui_test_utils::NavigateToURL(browser(), GURL(chrome::kChromeUIUberFrameURL));
SelectTab(); SelectTab();
EXPECT_TRUE(GetJsBool("$('history').hidden")); EXPECT_TRUE(GetJsBool("$('history').hidden"));
......
...@@ -22,6 +22,11 @@ const base::Feature kLinuxObsoleteSystemIsEndOfTheLine{ ...@@ -22,6 +22,11 @@ const base::Feature kLinuxObsoleteSystemIsEndOfTheLine{
"LinuxObsoleteSystemIsEndOfTheLine", base::FEATURE_DISABLED_BY_DEFAULT}; "LinuxObsoleteSystemIsEndOfTheLine", base::FEATURE_DISABLED_BY_DEFAULT};
#endif #endif
// Enables or disables the Material Design version of chrome://history.
const base::Feature kMaterialDesignHistoryFeature {
"MaterialDesignHistory", base::FEATURE_DISABLED_BY_DEFAULT
};
#if defined(OS_CHROMEOS) #if defined(OS_CHROMEOS)
// Runtime flag that indicates whether this leak detector should be enabled in // Runtime flag that indicates whether this leak detector should be enabled in
// the current instance of Chrome. // the current instance of Chrome.
......
...@@ -23,6 +23,7 @@ extern const base::Feature kAutomaticTabDiscarding; ...@@ -23,6 +23,7 @@ extern const base::Feature kAutomaticTabDiscarding;
extern const base::Feature kLinuxObsoleteSystemIsEndOfTheLine; extern const base::Feature kLinuxObsoleteSystemIsEndOfTheLine;
#endif #endif
extern const base::Feature kMaterialDesignHistoryFeature;
#if defined(OS_CHROMEOS) #if defined(OS_CHROMEOS)
extern const base::Feature kRuntimeMemoryLeakDetector; extern const base::Feature kRuntimeMemoryLeakDetector;
......
...@@ -426,9 +426,6 @@ const char kEnableFastUnload[] = "enable-fast-unload"; ...@@ -426,9 +426,6 @@ const char kEnableFastUnload[] = "enable-fast-unload";
// Enables the Material Design version of chrome://extensions. // Enables the Material Design version of chrome://extensions.
const char kEnableMaterialDesignExtensions[] = "enable-md-extensions"; const char kEnableMaterialDesignExtensions[] = "enable-md-extensions";
// Enables the Material Design version of chrome://history.
const char kEnableMaterialDesignHistory[] = "enable-md-history";
// Enables the Material Design policy page at chrome://md-policy. // Enables the Material Design policy page at chrome://md-policy.
const char kEnableMaterialDesignPolicyPage[] = "enable-md-policy-page"; const char kEnableMaterialDesignPolicyPage[] = "enable-md-policy-page";
...@@ -1349,11 +1346,6 @@ bool MdExtensionsEnabled() { ...@@ -1349,11 +1346,6 @@ bool MdExtensionsEnabled() {
::switches::kEnableMaterialDesignExtensions); ::switches::kEnableMaterialDesignExtensions);
} }
bool MdHistoryEnabled() {
return base::CommandLine::ForCurrentProcess()->HasSwitch(
::switches::kEnableMaterialDesignHistory);
}
bool MdPolicyPageEnabled() { bool MdPolicyPageEnabled() {
return base::CommandLine::ForCurrentProcess()->HasSwitch( return base::CommandLine::ForCurrentProcess()->HasSwitch(
::switches::kEnableMaterialDesignPolicyPage); ::switches::kEnableMaterialDesignPolicyPage);
......
...@@ -122,7 +122,6 @@ extern const char kEnableExtensionActivityLogging[]; ...@@ -122,7 +122,6 @@ extern const char kEnableExtensionActivityLogging[];
extern const char kEnableExtensionActivityLogTesting[]; extern const char kEnableExtensionActivityLogTesting[];
extern const char kEnableFastUnload[]; extern const char kEnableFastUnload[];
extern const char kEnableMaterialDesignExtensions[]; extern const char kEnableMaterialDesignExtensions[];
extern const char kEnableMaterialDesignHistory[];
extern const char kEnableMaterialDesignPolicyPage[]; extern const char kEnableMaterialDesignPolicyPage[];
extern const char kEnableNaCl[]; extern const char kEnableNaCl[];
extern const char kEnableNativeNotifications[]; extern const char kEnableNativeNotifications[];
...@@ -402,7 +401,6 @@ extern const char kDisableInputImeAPI[]; ...@@ -402,7 +401,6 @@ extern const char kDisableInputImeAPI[];
bool AboutInSettingsEnabled(); bool AboutInSettingsEnabled();
bool MdExtensionsEnabled(); bool MdExtensionsEnabled();
bool MdHistoryEnabled();
bool MdPolicyPageEnabled(); bool MdPolicyPageEnabled();
bool PdfMaterialUIEnabled(); bool PdfMaterialUIEnabled();
bool SettingsWindowEnabled(); bool SettingsWindowEnabled();
......
...@@ -20,7 +20,8 @@ MaterialHistoryBrowserTest.prototype = { ...@@ -20,7 +20,8 @@ MaterialHistoryBrowserTest.prototype = {
browsePreload: 'chrome://history', browsePreload: 'chrome://history',
commandLineSwitches: [{switchName: 'enable-md-history'}], commandLineSwitches: [{switchName: 'enable-features',
switchValue: 'MaterialDesignHistory'}],
/** @override */ /** @override */
runAccessibilityChecks: false, runAccessibilityChecks: false,
......
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