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

Unified Diff: chrome/browser/ui/elide_url.h

Issue 1147363005: Create FormatUrlForSecurityDisplay helper function. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Respond to comments, add tests with languages. Created 5 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/elide_url.h
diff --git a/chrome/browser/ui/elide_url.h b/chrome/browser/ui/elide_url.h
index bd5321a633fbfb5513374903427ca6353be26ada..b0609f5540f87125b4ccab50722f9cb43df626ec 100644
--- a/chrome/browser/ui/elide_url.h
+++ b/chrome/browser/ui/elide_url.h
@@ -45,4 +45,20 @@ base::string16 ElideHost(const GURL& host_url,
const gfx::FontList& font_list,
float available_pixel_width);
+// This is a convenience function for formatting a URL as an origin in a concise
+// and human-friendly way. Use this instead of |net::FormatUrl| when the reader
+// needs only to understand the origin (rather than the entire URL).
+//
+// - Omits the path for standard schemes, excepting file and filesystem.
+// - Omits the port if it is the default for the scheme.
+//
+// Do not use this for URLs which will be parsed or sent to other applications.
+// Callers should only set |omit_scheme| to true when it is safe to do so: in
+// contexts where the origin is known to be secure or is always secure by
+// necessity. (For example when GURL::SchemeIsCryptographic() or
+// content::IsOriginSecure() return true.
Ryan Sleevi 2015/05/29 18:28:31 Mostly a question for the enamel people - but shou
palmer 2015/05/29 20:40:10 OK, I'm convinced this policy should be internal t
+base::string16 FormatOriginForDisplay(const GURL& origin,
+ const std::string& languages,
+ bool omit_scheme);
+
#endif // CHROME_BROWSER_UI_ELIDE_URL_H_

Powered by Google App Engine
This is Rietveld 408576698