| 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" |
| (...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 384 hi = guess; | 384 hi = guess; |
| 385 else | 385 else |
| 386 lo = guess; | 386 lo = guess; |
| 387 } | 387 } |
| 388 | 388 |
| 389 return CutString(text, lo, elide_in_middle, true); | 389 return CutString(text, lo, elide_in_middle, true); |
| 390 } | 390 } |
| 391 | 391 |
| 392 SortedDisplayURL::SortedDisplayURL(const GURL& url, | 392 SortedDisplayURL::SortedDisplayURL(const GURL& url, |
| 393 const std::string& languages) { | 393 const std::string& languages) { |
| 394 std::wstring host; | 394 net::AppendFormattedHost(url, languages, &sort_host_); |
| 395 net::AppendFormattedHost(url, UTF8ToWide(languages), &host, NULL, NULL); | 395 string16 host_minus_www = net::StripWWW(sort_host_); |
| 396 sort_host_ = WideToUTF16Hack(host); | |
| 397 string16 host_minus_www = net::StripWWW(WideToUTF16Hack(host)); | |
| 398 url_parse::Parsed parsed; | 396 url_parse::Parsed parsed; |
| 399 display_url_ = net::FormatUrl(url, languages, | 397 display_url_ = net::FormatUrl(url, languages, |
| 400 net::kFormatUrlOmitAll, UnescapeRule::SPACES, &parsed, &prefix_end_, | 398 net::kFormatUrlOmitAll, UnescapeRule::SPACES, &parsed, &prefix_end_, |
| 401 NULL); | 399 NULL); |
| 402 if (sort_host_.length() > host_minus_www.length()) { | 400 if (sort_host_.length() > host_minus_www.length()) { |
| 403 prefix_end_ += sort_host_.length() - host_minus_www.length(); | 401 prefix_end_ += sort_host_.length() - host_minus_www.length(); |
| 404 sort_host_.swap(host_minus_www); | 402 sort_host_.swap(host_minus_www); |
| 405 } | 403 } |
| 406 } | 404 } |
| 407 | 405 |
| (...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 664 | 662 |
| 665 bool ElideRectangleString(const string16& input, size_t max_rows, | 663 bool ElideRectangleString(const string16& input, size_t max_rows, |
| 666 size_t max_cols, bool strict, string16* output) { | 664 size_t max_cols, bool strict, string16* output) { |
| 667 RectangleString rect(max_rows, max_cols, strict, output); | 665 RectangleString rect(max_rows, max_cols, strict, output); |
| 668 rect.Init(); | 666 rect.Init(); |
| 669 rect.AddString(input); | 667 rect.AddString(input); |
| 670 return rect.Finalize(); | 668 return rect.Finalize(); |
| 671 } | 669 } |
| 672 | 670 |
| 673 } // namespace ui | 671 } // namespace ui |
| OLD | NEW |