OLD | NEW |
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 CHROME_BROWSER_UI_ELIDE_URL_H_ | 7 #ifndef CHROME_BROWSER_UI_ELIDE_URL_H_ |
8 #define CHROME_BROWSER_UI_ELIDE_URL_H_ | 8 #define CHROME_BROWSER_UI_ELIDE_URL_H_ |
9 | 9 |
10 #include <string> | 10 #include <string> |
(...skipping 27 matching lines...) Expand all Loading... |
38 | 38 |
39 // This function takes a GURL object and elides the host to fit within | 39 // This function takes a GURL object and elides the host to fit within |
40 // the given width. The function will never elide past the TLD+1 point, | 40 // the given width. The function will never elide past the TLD+1 point, |
41 // but after that, will leading-elide the domain name to fit the width. | 41 // but after that, will leading-elide the domain name to fit the width. |
42 // Example: http://sub.domain.com ---> "...domain.com", or "...b.domain.com" | 42 // Example: http://sub.domain.com ---> "...domain.com", or "...b.domain.com" |
43 // depending on the width. | 43 // depending on the width. |
44 base::string16 ElideHost(const GURL& host_url, | 44 base::string16 ElideHost(const GURL& host_url, |
45 const gfx::FontList& font_list, | 45 const gfx::FontList& font_list, |
46 float available_pixel_width); | 46 float available_pixel_width); |
47 | 47 |
| 48 // This is a convenience function for formatting a URL in a concise and |
| 49 // human-friendly way, to help users make security-related decisions (or in |
| 50 // other circumstances when people need to distinguish sites, origins, or |
| 51 // otherwise-simplified URLs from each other). |
| 52 // |
| 53 // Internationalized domain names (IDN) may be presented in Unicode if |
| 54 // |languages| accepts the Unicode representation (see |net::FormatUrl| for more |
| 55 // details on the algorithm). |
| 56 // |
| 57 // - Omits the path for standard schemes, excepting file and filesystem. |
| 58 // - Omits the port if it is the default for the scheme. |
| 59 // |
| 60 // Do not use this for URLs which will be parsed or sent to other applications. |
| 61 base::string16 FormatUrlForSecurityDisplay(const GURL& origin, |
| 62 const std::string& languages); |
| 63 |
48 #endif // CHROME_BROWSER_UI_ELIDE_URL_H_ | 64 #endif // CHROME_BROWSER_UI_ELIDE_URL_H_ |
OLD | NEW |