OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 #ifndef APP_GFX_TEXT_ELIDER_H_ | 5 #ifndef APP_GFX_TEXT_ELIDER_H_ |
6 #define APP_GFX_TEXT_ELIDER_H_ | 6 #define APP_GFX_TEXT_ELIDER_H_ |
7 | 7 |
8 #include <unicode/coll.h> | 8 #include <unicode/coll.h> |
9 #include <unicode/uchar.h> | 9 #include <unicode/uchar.h> |
10 | 10 |
11 #include "app/gfx/font.h" | 11 #include "app/gfx/font.h" |
12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
13 #include "base/string16.h" | 13 #include "base/string16.h" |
14 | 14 |
15 class FilePath; | 15 class FilePath; |
16 class GURL; | 16 class GURL; |
17 | 17 |
18 namespace url_parse { | |
19 struct Parsed; | |
20 } | |
21 | |
22 // TODO(port): this file should deal in string16s rather than wstrings. | 18 // TODO(port): this file should deal in string16s rather than wstrings. |
23 namespace gfx { | 19 namespace gfx { |
24 | 20 |
25 // A function to get URL string from a GURL that will be suitable for display | |
26 // to the user. The parsing of the URL may change because various parts of the | |
27 // string will change lengths. The new parsing will be placed in the given out | |
28 // parameter. |prefix_end| is set to the end of the prefix (spec and separator | |
29 // characters before host). | |
30 // |languages|, |new_parsed|, and |prefix_end| may all be empty or NULL. | |
31 std::wstring GetCleanStringFromUrl(const GURL& url, | |
32 const std::wstring& languages, | |
33 url_parse::Parsed* new_parsed, | |
34 size_t* prefix_end); | |
35 | |
36 // 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 |
37 // which composed of parts from subdomain, domain, path, filename and query. | 22 // which composed of parts from subdomain, domain, path, filename and query. |
38 // 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 |
39 // than the available pixel width. For available pixel width = 0, empty | 24 // than the available pixel width. For available pixel width = 0, empty |
40 // string is returned. |languages| is a comma separted list of ISO 639 | 25 // string is returned. |languages| is a comma separted list of ISO 639 |
41 // language codes and is used to determine what characters are understood | 26 // language codes and is used to determine what characters are understood |
42 // by a user. It should come from |prefs::kAcceptLanguages|. | 27 // by a user. It should come from |prefs::kAcceptLanguages|. |
43 // | 28 // |
44 // Note: in RTL locales, if the URL returned by this function is going to be | 29 // Note: in RTL locales, if the URL returned by this function is going to be |
45 // displayed in the UI, then it is likely that the string needs to be marked | 30 // displayed in the UI, then it is likely that the string needs to be marked |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 | 75 |
91 // End of the prefix (spec and separator) in display_url_. | 76 // End of the prefix (spec and separator) in display_url_. |
92 size_t prefix_end_; | 77 size_t prefix_end_; |
93 | 78 |
94 string16 display_url_; | 79 string16 display_url_; |
95 }; | 80 }; |
96 | 81 |
97 } // namespace gfx. | 82 } // namespace gfx. |
98 | 83 |
99 #endif // APP_GFX_TEXT_ELIDER_H_ | 84 #endif // APP_GFX_TEXT_ELIDER_H_ |
OLD | NEW |