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

Unified Diff: chrome/browser/ui/webui/web_ui_util.h

Issue 7068007: Revise about: and chrome: url handling. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Cleanup and improve patch. Created 9 years, 7 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/ui/webui/web_ui_util.h
diff --git a/chrome/browser/ui/webui/web_ui_util.h b/chrome/browser/ui/webui/web_ui_util.h
index 0a0eebf5dde6791b730a43f68e6ac3b44c6869d4..0a3ef11637fe12007181371e9eeb821605556ab5 100644
--- a/chrome/browser/ui/webui/web_ui_util.h
+++ b/chrome/browser/ui/webui/web_ui_util.h
@@ -25,6 +25,21 @@ std::string GetImageDataUrl(const SkBitmap& bitmap);
// |resource_id|.
std::string GetImageDataUrlFromResource(int resource_id);
+// Returns true if |url| has a chrome: or about: scheme.
+bool IsChromeURL(const GURL& url);
+
+// GURL typically parses "scheme://host/path?query#ref" correctly, however:
+// If chrome: omits scheme separator slashes, e.g. "chrome:host/path?query#ref",
+// then GURL reports that the URL has no host and path "host/path?qry#ref".
+// If about: has scheme separator slashes, e.g. "about://host/path?query#ref",
+// then GURL reports that the URL has no host and path "//host/path?qry#ref".
+// These functions parse common about and chrome URL formats as intended.
+std::string GetChromeURLHost(const GURL& url);
+std::string GetChromeURLPath(const GURL& url);
abarth-chromium 2011/05/27 17:19:25 Should we fix GURL to get these cases right instea
msw 2011/05/31 13:34:29 I rewrote this as URLFixerUpper::FixupChromeURL. I
+
+// Returns true if |url|'s host matches |host|.
+bool HostEquals(const GURL& url, const char* host);
+
// Returns true if |url| has a chrome: or about: scheme and matching |host|.
// The url may contain a path under the host.
bool ChromeURLHostEquals(const GURL& url, const char* host);

Powered by Google App Engine
This is Rietveld 408576698