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 CHROME_COMMON_GFX_TEXT_ELIDER_H_ | 5 #ifndef CHROME_COMMON_GFX_TEXT_ELIDER_H_ |
6 #define CHROME_COMMON_GFX_TEXT_ELIDER_H_ | 6 #define CHROME_COMMON_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 |
(...skipping 29 matching lines...) Expand all Loading... |
40 // string is returned. |languages| is a comma separted list of ISO 639 | 40 // string is returned. |languages| is a comma separted list of ISO 639 |
41 // language codes and is used to determine what characters are understood | 41 // language codes and is used to determine what characters are understood |
42 // by a user. It should come from |prefs::kAcceptLanguages|. | 42 // by a user. It should come from |prefs::kAcceptLanguages|. |
43 // | 43 // |
44 // Note: in RTL locales, if the URL returned by this function is going to be | 44 // 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 | 45 // displayed in the UI, then it is likely that the string needs to be marked |
46 // as an LTR string (using l10n_util::WrapStringWithLTRFormatting()) so that it | 46 // as an LTR string (using l10n_util::WrapStringWithLTRFormatting()) so that it |
47 // is displayed properly in an RTL context. Please refer to | 47 // is displayed properly in an RTL context. Please refer to |
48 // http://crbug.com/6487 for more information. | 48 // http://crbug.com/6487 for more information. |
49 std::wstring ElideUrl(const GURL& url, | 49 std::wstring ElideUrl(const GURL& url, |
50 const ChromeFont& font, | 50 const gfx::Font& font, |
51 int available_pixel_width, | 51 int available_pixel_width, |
52 const std::wstring& languages); | 52 const std::wstring& languages); |
53 | 53 |
54 std::wstring ElideText(const std::wstring& text, | 54 std::wstring ElideText(const std::wstring& text, |
55 const ChromeFont& font, | 55 const gfx::Font& font, |
56 int available_pixel_width); | 56 int available_pixel_width); |
57 | 57 |
58 // Elide a filename to fit a given pixel width, with an emphasis on not hiding | 58 // Elide a filename to fit a given pixel width, with an emphasis on not hiding |
59 // the extension unless we have to. If filename contains a path, the path will | 59 // the extension unless we have to. If filename contains a path, the path will |
60 // be removed if filename doesn't fit into available_pixel_width. | 60 // be removed if filename doesn't fit into available_pixel_width. |
61 std::wstring ElideFilename(const FilePath& filename, | 61 std::wstring ElideFilename(const FilePath& filename, |
62 const ChromeFont& font, | 62 const gfx::Font& font, |
63 int available_pixel_width); | 63 int available_pixel_width); |
64 | 64 |
65 // SortedDisplayURL maintains a string from a URL suitable for display to the | 65 // SortedDisplayURL maintains a string from a URL suitable for display to the |
66 // use. SortedDisplayURL also provides a function used for comparing two | 66 // use. SortedDisplayURL also provides a function used for comparing two |
67 // SortedDisplayURLs for use in visually ordering the SortedDisplayURLs. | 67 // SortedDisplayURLs for use in visually ordering the SortedDisplayURLs. |
68 // | 68 // |
69 // SortedDisplayURL is relatively cheap and supports value semantics. | 69 // SortedDisplayURL is relatively cheap and supports value semantics. |
70 class SortedDisplayURL { | 70 class SortedDisplayURL { |
71 public: | 71 public: |
72 SortedDisplayURL(const GURL& url, const std::wstring& languages); | 72 SortedDisplayURL(const GURL& url, const std::wstring& languages); |
(...skipping 17 matching lines...) Expand all Loading... |
90 | 90 |
91 // End of the prefix (spec and separator) in display_url_. | 91 // End of the prefix (spec and separator) in display_url_. |
92 size_t prefix_end_; | 92 size_t prefix_end_; |
93 | 93 |
94 string16 display_url_; | 94 string16 display_url_; |
95 }; | 95 }; |
96 | 96 |
97 } // namespace gfx. | 97 } // namespace gfx. |
98 | 98 |
99 #endif // CHROME_COMMON_GFX_TEXT_ELIDER_H_ | 99 #endif // CHROME_COMMON_GFX_TEXT_ELIDER_H_ |
OLD | NEW |