| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #include <vector> | 5 #include <vector> |
| 6 | 6 |
| 7 #include "ui/base/text/text_elider.h" | 7 #include "ui/base/text/text_elider.h" |
| 8 | 8 |
| 9 #include "base/file_path.h" | 9 #include "base/file_path.h" |
| 10 #include "base/i18n/break_iterator.h" | 10 #include "base/i18n/break_iterator.h" |
| 11 #include "base/i18n/char_iterator.h" | 11 #include "base/i18n/char_iterator.h" |
| 12 #include "base/i18n/rtl.h" | 12 #include "base/i18n/rtl.h" |
| 13 #include "base/string_split.h" | 13 #include "base/string_split.h" |
| 14 #include "base/string_util.h" | 14 #include "base/string_util.h" |
| 15 #include "base/sys_string_conversions.h" | 15 #include "base/sys_string_conversions.h" |
| 16 #include "base/utf_string_conversions.h" | 16 #include "base/utf_string_conversions.h" |
| 17 #include "googleurl/src/gurl.h" | 17 #include "googleurl/src/gurl.h" |
| 18 #include "net/base/escape.h" | 18 #include "net/base/escape.h" |
| 19 #include "net/base/net_util.h" | 19 #include "net/base/net_util.h" |
| 20 #include "net/base/registry_controlled_domain.h" | 20 #include "net/base/registry_controlled_domain.h" |
| 21 #include "ui/gfx/font.h" | 21 #include "ui/gfx/font.h" |
| 22 | 22 |
| 23 namespace ui { | 23 namespace ui { |
| 24 | 24 |
| 25 // U+2026 in utf8 |
| 26 const char kEllipsis[] = "\xE2\x80\xA6"; |
| 27 |
| 25 namespace { | 28 namespace { |
| 26 | 29 |
| 27 const char* kEllipsis = "\xE2\x80\xA6"; | |
| 28 | |
| 29 // Cuts |text| to be |length| characters long. If |cut_in_middle| is true, the | 30 // Cuts |text| to be |length| characters long. If |cut_in_middle| is true, the |
| 30 // middle of the string is removed to leave equal-length pieces from the | 31 // middle of the string is removed to leave equal-length pieces from the |
| 31 // beginning and end of the string; otherwise, the end of the string is removed | 32 // beginning and end of the string; otherwise, the end of the string is removed |
| 32 // and only the beginning remains. If |insert_ellipsis| is true, then an | 33 // and only the beginning remains. If |insert_ellipsis| is true, then an |
| 33 // ellipsis character will by inserted at the cut point. | 34 // ellipsis character will by inserted at the cut point. |
| 34 string16 CutString(const string16& text, | 35 string16 CutString(const string16& text, |
| 35 size_t length, | 36 size_t length, |
| 36 bool cut_in_middle, | 37 bool cut_in_middle, |
| 37 bool insert_ellipsis) { | 38 bool insert_ellipsis) { |
| 38 // TODO(tony): This is wrong, it might split the string in the middle of a | 39 // TODO(tony): This is wrong, it might split the string in the middle of a |
| (...skipping 616 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 655 | 656 |
| 656 bool ElideRectangleString(const string16& input, size_t max_rows, | 657 bool ElideRectangleString(const string16& input, size_t max_rows, |
| 657 size_t max_cols, string16* output) { | 658 size_t max_cols, string16* output) { |
| 658 RectangleString rect(max_rows, max_cols, output); | 659 RectangleString rect(max_rows, max_cols, output); |
| 659 rect.Init(); | 660 rect.Init(); |
| 660 rect.AddString(input); | 661 rect.AddString(input); |
| 661 return rect.Finalize(); | 662 return rect.Finalize(); |
| 662 } | 663 } |
| 663 | 664 |
| 664 } // namespace ui | 665 } // namespace ui |
| OLD | NEW |