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

Unified Diff: components/url_formatter/elide_url.h

Issue 1843063002: Don't show scheme in permission prompts if it is HTTPS (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 8 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: components/url_formatter/elide_url.h
diff --git a/components/url_formatter/elide_url.h b/components/url_formatter/elide_url.h
index 60a513116a534dd754ea4e494ec95ec0e528c28e..5f929cab3e9b9098d6bf231efee7a015c74f6506 100644
--- a/components/url_formatter/elide_url.h
+++ b/components/url_formatter/elide_url.h
@@ -48,6 +48,13 @@ base::string16 ElideHost(const GURL& host_url,
float available_pixel_width);
#endif // !defined(OS_ANDROID)
+enum class SchemeDisplay {
+ SHOW,
+ OMIT_HTTP_AND_HTTPS,
+ // Omit cryptographic (i.e. https and wss).
+ OMIT_CRYPTOGRAPHIC,
+};
+
// This is a convenience function for formatting a URL in a concise and
// human-friendly way, to help users make security-related decisions (or in
// other circumstances when people need to distinguish sites, origins, or
@@ -62,18 +69,14 @@ base::string16 ElideHost(const GURL& host_url,
//
// Do not use this for URLs which will be parsed or sent to other applications.
//
-// Generally, set prefer this function to
-// |FormatUrlForSecurityDisplayOmitScheme| unless there is plenty of indication
-// as to whether the origin is secure elsewhere in the UX. For example, in
-// Chrome's Origin Info Bubble, there are icons and strings indicating origin
-// (non-)security. But in the HTTP Basic Auth prompt (for example), the scheme
-// may be the only indicator.
-base::string16 FormatUrlForSecurityDisplay(const GURL& origin);
-
-// Just like |FormatUrlForSecurityDisplay|, but also:
-//
-// - Omits the scheme if SchemeIsHTTPOrHTTPS().
-base::string16 FormatUrlForSecurityDisplayOmitScheme(const GURL& origin);
+// Generally, prefer SchemeDisplay::SHOW to omitting the scheme unless there is
+// plenty of indication as to whether the origin is secure elsewhere in the UX.
+// For example, in Chrome's Origin Info Bubble, there are icons and strings
+// indicating origin (non-)security. But in the HTTP Basic Auth prompt (for
+// example), the scheme may be the only indicator.
+base::string16 FormatUrlForSecurityDisplay(
+ const GURL& origin,
+ const SchemeDisplay scheme_display = SchemeDisplay::SHOW);
} // namespace url_formatter
« no previous file with comments | « components/password_manager/core/browser/password_ui_utils.cc ('k') | components/url_formatter/elide_url.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698