diff options
author | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-12-03 00:39:26 +0000 |
---|---|---|
committer | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-12-03 00:39:26 +0000 |
commit | 476dafb386743bb8db7c3cda201b86b9c70bf753 (patch) | |
tree | 6d43f23f392d4fba47e8690cec1088a27b8fe12b /ui/gfx/text_elider.h | |
parent | abdd6ba46c3c48c3c307ee0c5e5697d9f4f4fc99 (diff) | |
download | chromium_src-476dafb386743bb8db7c3cda201b86b9c70bf753.zip chromium_src-476dafb386743bb8db7c3cda201b86b9c70bf753.tar.gz chromium_src-476dafb386743bb8db7c3cda201b86b9c70bf753.tar.bz2 |
Move more uses of string16 to specify base::
This makes base, ui, and net compile without the "using base::string16" directive that's currently checked in.
BUG=
Review URL: https://codereview.chromium.org/100303003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@238246 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/gfx/text_elider.h')
-rw-r--r-- | ui/gfx/text_elider.h | 65 |
1 files changed, 34 insertions, 31 deletions
diff --git a/ui/gfx/text_elider.h b/ui/gfx/text_elider.h index 95bdeb44..4eaca82 100644 --- a/ui/gfx/text_elider.h +++ b/ui/gfx/text_elider.h @@ -27,7 +27,7 @@ class Font; class FontList; GFX_EXPORT extern const char kEllipsis[]; -GFX_EXPORT extern const char16 kEllipsisUTF16[]; +GFX_EXPORT extern const base::char16 kEllipsisUTF16[]; // Elides a well-formed email address (e.g. username@domain.com) to fit into // |available_pixel_width| using the specified |font_list|. @@ -39,9 +39,9 @@ GFX_EXPORT extern const char16 kEllipsisUTF16[]; // equally with the elided username (should the username be short enough that it // doesn't need half the available width: the elided domain will occupy that // extra width). -GFX_EXPORT string16 ElideEmail(const string16& email, - const gfx::FontList& font_list, - float available_pixel_width); +GFX_EXPORT base::string16 ElideEmail(const base::string16& email, + const gfx::FontList& font_list, + float available_pixel_width); // This function takes a GURL object and elides it. It returns a string // which composed of parts from subdomain, domain, path, filename and query. @@ -57,10 +57,10 @@ GFX_EXPORT string16 ElideEmail(const string16& email, // as an LTR string (using base::i18n::WrapStringWithLTRFormatting()) so that it // is displayed properly in an RTL context. Please refer to // http://crbug.com/6487 for more information. -GFX_EXPORT string16 ElideUrl(const GURL& url, - const gfx::FontList& font_list, - float available_pixel_width, - const std::string& languages); +GFX_EXPORT base::string16 ElideUrl(const GURL& url, + const gfx::FontList& font_list, + float available_pixel_width, + const std::string& languages); enum ElideBehavior { // Add ellipsis at the end of the string. @@ -73,15 +73,15 @@ enum ElideBehavior { // Elides |text| to fit in |available_pixel_width| according to the specified // |elide_behavior|. -GFX_EXPORT string16 ElideText(const string16& text, - const gfx::FontList& font_list, - float available_pixel_width, - ElideBehavior elide_behavior); +GFX_EXPORT base::string16 ElideText(const base::string16& text, + const gfx::FontList& font_list, + float available_pixel_width, + ElideBehavior elide_behavior); // Obsolete version. Use the above version which takes gfx::FontList. -GFX_EXPORT string16 ElideText(const string16& text, - const gfx::Font& font, - float available_pixel_width, - ElideBehavior elide_behavior); +GFX_EXPORT base::string16 ElideText(const base::string16& text, + const gfx::Font& font, + float available_pixel_width, + ElideBehavior elide_behavior); // Elide a filename to fit a given pixel width, with an emphasis on not hiding // the extension unless we have to. If filename contains a path, the path will @@ -89,9 +89,9 @@ GFX_EXPORT string16 ElideText(const string16& text, // filename is forced to have LTR directionality, which means that in RTL UI // the elided filename is wrapped with LRE (Left-To-Right Embedding) mark and // PDF (Pop Directional Formatting) mark. -GFX_EXPORT string16 ElideFilename(const base::FilePath& filename, - const gfx::FontList& font_list, - float available_pixel_width); +GFX_EXPORT base::string16 ElideFilename(const base::FilePath& filename, + const gfx::FontList& font_list, + float available_pixel_width); // SortedDisplayURL maintains a string from a URL suitable for display to the // use. SortedDisplayURL also provides a function used for comparing two @@ -110,20 +110,20 @@ class GFX_EXPORT SortedDisplayURL { int Compare(const SortedDisplayURL& other, icu::Collator* collator) const; // Returns the display string for the URL. - const string16& display_url() const { return display_url_; } + const base::string16& display_url() const { return display_url_; } private: // Returns everything after the host. This is used by Compare if the hosts // match. - string16 AfterHost() const; + base::string16 AfterHost() const; // Host name minus 'www.'. Used by Compare. - string16 sort_host_; + base::string16 sort_host_; // End of the prefix (spec and separator) in display_url_. size_t prefix_end_; - string16 display_url_; + base::string16 display_url_; DISALLOW_COPY_AND_ASSIGN(SortedDisplayURL); }; @@ -141,8 +141,8 @@ class GFX_EXPORT SortedDisplayURL { // puts "Hell...Tom" in str and returns true. // TODO(tsepez): Doesn't handle UTF-16 surrogate pairs properly. // TODO(tsepez): Doesn't handle bidi properly. -GFX_EXPORT bool ElideString(const string16& input, int max_len, - string16* output); +GFX_EXPORT bool ElideString(const base::string16& input, int max_len, + base::string16* output); // Reformat |input| into |output| so that it fits into a |max_rows| by // |max_cols| rectangle of characters. Input newlines are respected, but @@ -153,9 +153,11 @@ GFX_EXPORT bool ElideString(const string16& input, int max_len, // intra-word (respecting UTF-16 surrogate pairs) as necssary. Truncation // (indicated by an added 3 dots) occurs if the result is still too long. // Returns true if the input had to be truncated (and not just reformatted). -GFX_EXPORT bool ElideRectangleString(const string16& input, size_t max_rows, - size_t max_cols, bool strict, - string16* output); +GFX_EXPORT bool ElideRectangleString(const base::string16& input, + size_t max_rows, + size_t max_cols, + bool strict, + base::string16* output); // Specifies the word wrapping behavior of |ElideRectangleText()| when a word // would exceed the available width. @@ -193,19 +195,20 @@ enum ReformattingResultFlags { // param. Returns a combination of |ReformattingResultFlags| that indicate // whether the given rectangle had insufficient space to accommodate |texŧ|, // leading to elision or truncation (and not just reformatting). -GFX_EXPORT int ElideRectangleText(const string16& text, +GFX_EXPORT int ElideRectangleText(const base::string16& text, const gfx::FontList& font_list, float available_pixel_width, int available_pixel_height, WordWrapBehavior wrap_behavior, - std::vector<string16>* lines); + std::vector<base::string16>* lines); // Truncates the string to length characters. This breaks the string at // the first word break before length, adding the horizontal ellipsis // character (unicode character 0x2026) to render ... // The supplied string is returned if the string has length characters or // less. -GFX_EXPORT string16 TruncateString(const string16& string, size_t length); +GFX_EXPORT base::string16 TruncateString(const base::string16& string, + size_t length); } // namespace gfx |