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

Side by Side Diff: components/url_formatter/elide_url.h

Issue 1959933002: Add FormatOriginForSecurityDisplay which takes a const url::Origin& origin (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address brettw@'s comments Created 4 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 unified diff | Download patch
« no previous file with comments | « no previous file | components/url_formatter/elide_url.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 // 4 //
5 // This file defines utility functions for eliding URLs. 5 // This file defines utility functions for eliding URLs.
6 6
7 #ifndef COMPONENTS_URL_FORMATTER_ELIDE_URL_H_ 7 #ifndef COMPONENTS_URL_FORMATTER_ELIDE_URL_H_
8 #define COMPONENTS_URL_FORMATTER_ELIDE_URL_H_ 8 #define COMPONENTS_URL_FORMATTER_ELIDE_URL_H_
9 9
10 #include <string> 10 #include <string>
11 11
12 #include "base/strings/string16.h" 12 #include "base/strings/string16.h"
13 #include "build/build_config.h" 13 #include "build/build_config.h"
14 14
15 class GURL; 15 class GURL;
16 16
17 namespace gfx { 17 namespace gfx {
18 class FontList; 18 class FontList;
19 } 19 }
20 20
21 namespace url {
22 class Origin;
23 }
24
21 namespace url_formatter { 25 namespace url_formatter {
22 26
23 // ElideUrl and Elide host require 27 // ElideUrl and Elide host require
24 // gfx::GetStringWidthF which is not implemented in Android 28 // gfx::GetStringWidthF which is not implemented in Android
25 #if !defined(OS_ANDROID) 29 #if !defined(OS_ANDROID)
26 // This function takes a GURL object and elides it. It returns a string 30 // This function takes a GURL object and elides it. It returns a string
27 // which composed of parts from subdomain, domain, path, filename and query. 31 // which composed of parts from subdomain, domain, path, filename and query.
28 // A "..." is added automatically at the end if the elided string is bigger 32 // A "..." is added automatically at the end if the elided string is bigger
29 // than the |available_pixel_width|. For |available_pixel_width| == 0, a 33 // than the |available_pixel_width|. For |available_pixel_width| == 0, a
30 // formatted, but un-elided, string is returned. 34 // formatted, but un-elided, string is returned.
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 // 75 //
72 // Generally, prefer SchemeDisplay::SHOW to omitting the scheme unless there is 76 // Generally, prefer SchemeDisplay::SHOW to omitting the scheme unless there is
73 // plenty of indication as to whether the origin is secure elsewhere in the UX. 77 // plenty of indication as to whether the origin is secure elsewhere in the UX.
74 // For example, in Chrome's Origin Info Bubble, there are icons and strings 78 // For example, in Chrome's Origin Info Bubble, there are icons and strings
75 // indicating origin (non-)security. But in the HTTP Basic Auth prompt (for 79 // indicating origin (non-)security. But in the HTTP Basic Auth prompt (for
76 // example), the scheme may be the only indicator. 80 // example), the scheme may be the only indicator.
77 base::string16 FormatUrlForSecurityDisplay( 81 base::string16 FormatUrlForSecurityDisplay(
78 const GURL& origin, 82 const GURL& origin,
79 const SchemeDisplay scheme_display = SchemeDisplay::SHOW); 83 const SchemeDisplay scheme_display = SchemeDisplay::SHOW);
80 84
85 // This is a convenience function for formatting a url::Origin in a concise and
86 // human-friendly way, to help users make security-related decisions.
87 base::string16 FormatOriginForSecurityDisplay(
88 const url::Origin& origin,
89 const SchemeDisplay scheme_display = SchemeDisplay::SHOW);
90
81 } // namespace url_formatter 91 } // namespace url_formatter
82 92
83 #endif // COMPONENTS_URL_FORMATTER_ELIDE_URL_H_ 93 #endif // COMPONENTS_URL_FORMATTER_ELIDE_URL_H_
OLDNEW
« no previous file with comments | « no previous file | components/url_formatter/elide_url.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698