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

Unified Diff: chrome/browser/chrome_content_browser_client.cc

Issue 2664063002: MD Settings: Redirect chrome://help and chrome://chrome to About page. (Closed)
Patch Set: remove obsolete test. Created 3 years, 11 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/browser_about_handler_unittest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chrome_content_browser_client.cc
diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/chrome_content_browser_client.cc
index b8ee4de63eb65f7835a38e32825d65732622c8cb..5660e22e33c06e1a74443f9dd1cb6165df0ea80d 100644
--- a/chrome/browser/chrome_content_browser_client.cc
+++ b/chrome/browser/chrome_content_browser_client.cc
@@ -532,6 +532,17 @@ bool HandleNewTabPageLocationOverride(
// Handles rewriting Web UI URLs.
bool HandleWebUI(GURL* url, content::BrowserContext* browser_context) {
+ if (base::FeatureList::IsEnabled(features::kMaterialDesignSettings)) {
+ // Rewrite chrome://help and chrome://chrome to chrome://settings/help.
+ if (url->host() == chrome::kChromeUIHelpHost ||
+ (url->host() == chrome::kChromeUIUberHost &&
+ (url->path().empty() || url->path() == "/"))) {
+ *url = ReplaceURLHostAndPath(*url, chrome::kChromeUISettingsHost,
+ chrome::kChromeUIHelpHost);
+ return true; // Return true to update the displayed URL.
+ }
+ }
+
// Do not handle special URLs such as "about:foo"
if (!url->host().empty()) {
const GURL chrome_url = AddUberHost(*url);
@@ -567,6 +578,13 @@ bool HandleWebUI(GURL* url, content::BrowserContext* browser_context) {
// Reverse URL handler for Web UI. Maps "chrome://chrome/foo/" to
// "chrome://foo/".
bool HandleWebUIReverse(GURL* url, content::BrowserContext* browser_context) {
+ // No need to actually reverse-rewrite the URL, but return true to update the
+ // displayed URL when rewriting chrome://help to chrome://settings/help.
+ if (base::FeatureList::IsEnabled(features::kMaterialDesignSettings) &&
+ url->host() == chrome::kChromeUISettingsHost) {
+ return true;
+ }
+
if (!url->is_valid() || !url->SchemeIs(content::kChromeUIScheme))
return false;
« no previous file with comments | « chrome/browser/browser_about_handler_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698