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

Unified Diff: chrome/browser/chrome_content_browser_client.cc

Issue 2931243002: Unframe chrome://extensions as it's the last (and only) uber item (Closed)
Patch Set: merge Created 3 years, 6 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
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 6435b992c26d0a5e156de5c71694b04009df0b4e..0e01535d3130cb7b4650eaccc57085226e699b27 100644
--- a/chrome/browser/chrome_content_browser_client.cc
+++ b/chrome/browser/chrome_content_browser_client.cc
@@ -592,50 +592,6 @@ GURL ReplaceURLHostAndPath(const GURL& url,
return url.ReplaceComponents(replacements);
}
-// Maps "foo://bar/baz/" to "foo://chrome/bar/baz/".
-GURL AddUberHost(const GURL& url) {
- const std::string uber_host = chrome::kChromeUIUberHost;
- std::string new_path;
- url.host_piece().AppendToString(&new_path);
- url.path_piece().AppendToString(&new_path);
-
- return ReplaceURLHostAndPath(url, uber_host, new_path);
-}
-
-// If url->host() is "chrome" and url->path() has characters other than the
-// first slash, changes the url from "foo://chrome/bar/" to "foo://bar/" and
-// returns true. Otherwise returns false.
-bool RemoveUberHost(GURL* url) {
- if (url->host() != chrome::kChromeUIUberHost)
- return false;
-
- if (url->path().empty() || url->path() == "/")
- return false;
-
- const std::string old_path = url->path();
-
- const std::string::size_type separator = old_path.find('/', 1);
- std::string new_host;
- std::string new_path;
- if (separator == std::string::npos) {
- new_host = old_path.substr(1);
- } else {
- new_host = old_path.substr(1, separator - 1);
- new_path = old_path.substr(separator);
- }
-
- // Do not allow URLs with paths empty before the first slash since we can't
- // have an empty host. (e.g "foo://chrome//")
- if (new_host.empty())
- return false;
-
- *url = ReplaceURLHostAndPath(*url, new_host, new_path);
-
- DCHECK(url->is_valid());
-
- return true;
-}
-
// Handles the rewriting of the new tab page URL based on group policy.
bool HandleNewTabPageLocationOverride(
GURL* url,
@@ -665,20 +621,10 @@ bool HandleWebUI(GURL* url, content::BrowserContext* browser_context) {
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);
-
- // Handle valid "chrome://chrome/foo" URLs so the reverse handler will
- // be called.
- if (ChromeWebUIControllerFactory::GetInstance()->UseWebUIForURL(
- browser_context, chrome_url))
- return true;
- }
-
if (!ChromeWebUIControllerFactory::GetInstance()->UseWebUIForURL(
- browser_context, *url))
+ browser_context, *url)) {
return false;
+ }
#if defined(OS_CHROMEOS)
// Special case : in ChromeOS in Guest mode bookmarks and history are
@@ -702,13 +648,7 @@ bool HandleWebUI(GURL* url, content::BrowserContext* browser_context) {
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 (url->host() == chrome::kChromeUISettingsHost)
- return true;
-
- if (!url->is_valid() || !url->SchemeIs(content::kChromeUIScheme))
- return false;
-
- return RemoveUberHost(url);
+ return url->host() == chrome::kChromeUISettingsHost;
}
bool CertMatchesFilter(const net::X509Certificate& cert,

Powered by Google App Engine
This is Rietveld 408576698