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 UI_SECURE_DISPLAY_ELIDE_URL_H_ |
8 #define CHROME_BROWSER_UI_ELIDE_URL_H_ | 8 #define UI_SECURE_DISPLAY_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 | 13 |
14 class GURL; | 14 class GURL; |
15 | 15 |
16 namespace gfx { | 16 namespace gfx { |
17 class FontList; | 17 class FontList; |
18 } | 18 } |
19 | 19 |
| 20 namespace secure_display { |
20 // This function takes a GURL object and elides it. It returns a string | 21 // This function takes a GURL object and elides it. It returns a string |
21 // which composed of parts from subdomain, domain, path, filename and query. | 22 // which composed of parts from subdomain, domain, path, filename and query. |
22 // A "..." is added automatically at the end if the elided string is bigger | 23 // A "..." is added automatically at the end if the elided string is bigger |
23 // than the |available_pixel_width|. For |available_pixel_width| == 0, a | 24 // than the |available_pixel_width|. For |available_pixel_width| == 0, a |
24 // formatted, but un-elided, string is returned. |languages| is a comma | 25 // formatted, but un-elided, string is returned. |languages| is a comma |
25 // separated list of ISO 639 language codes and is used to determine what | 26 // separated list of ISO 639 language codes and is used to determine what |
26 // characters are understood by a user. It should come from | 27 // characters are understood by a user. It should come from |
27 // |prefs::kAcceptLanguages|. | 28 // |prefs::kAcceptLanguages|. |
28 // | 29 // |
29 // Note: in RTL locales, if the URL returned by this function is going to be | 30 // Note: in RTL locales, if the URL returned by this function is going to be |
(...skipping 24 matching lines...) Expand all Loading... |
54 // |languages| accepts the Unicode representation (see |net::FormatUrl| for more | 55 // |languages| accepts the Unicode representation (see |net::FormatUrl| for more |
55 // details on the algorithm). | 56 // details on the algorithm). |
56 // | 57 // |
57 // - Omits the path for standard schemes, excepting file and filesystem. | 58 // - Omits the path for standard schemes, excepting file and filesystem. |
58 // - Omits the port if it is the default for the scheme. | 59 // - Omits the port if it is the default for the scheme. |
59 // | 60 // |
60 // Do not use this for URLs which will be parsed or sent to other applications. | 61 // Do not use this for URLs which will be parsed or sent to other applications. |
61 base::string16 FormatUrlForSecurityDisplay(const GURL& origin, | 62 base::string16 FormatUrlForSecurityDisplay(const GURL& origin, |
62 const std::string& languages); | 63 const std::string& languages); |
63 | 64 |
64 #endif // CHROME_BROWSER_UI_ELIDE_URL_H_ | 65 } // namespace |
| 66 |
| 67 #endif // UI_SECURE_DISPLAY_ELIDE_URL_H_ |
OLD | NEW |