| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "app/text_elider.h" | 7 #include "app/text_elider.h" |
| 8 #include "base/file_path.h" | 8 #include "base/file_path.h" |
| 9 #include "base/i18n/rtl.h" | 9 #include "base/i18n/rtl.h" |
| 10 #include "base/string_split.h" | 10 #include "base/string_split.h" |
| (...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 389 url_parse::Parsed parsed; | 389 url_parse::Parsed parsed; |
| 390 display_url_ = net::FormatUrl(url, WideToUTF8(languages), | 390 display_url_ = net::FormatUrl(url, WideToUTF8(languages), |
| 391 net::kFormatUrlOmitAll, UnescapeRule::SPACES, &parsed, &prefix_end_, | 391 net::kFormatUrlOmitAll, UnescapeRule::SPACES, &parsed, &prefix_end_, |
| 392 NULL); | 392 NULL); |
| 393 if (sort_host_.length() > host_minus_www.length()) { | 393 if (sort_host_.length() > host_minus_www.length()) { |
| 394 prefix_end_ += sort_host_.length() - host_minus_www.length(); | 394 prefix_end_ += sort_host_.length() - host_minus_www.length(); |
| 395 sort_host_.swap(host_minus_www); | 395 sort_host_.swap(host_minus_www); |
| 396 } | 396 } |
| 397 } | 397 } |
| 398 | 398 |
| 399 SortedDisplayURL::SortedDisplayURL() { |
| 400 } |
| 401 |
| 402 SortedDisplayURL::~SortedDisplayURL() { |
| 403 } |
| 404 |
| 399 int SortedDisplayURL::Compare(const SortedDisplayURL& other, | 405 int SortedDisplayURL::Compare(const SortedDisplayURL& other, |
| 400 icu::Collator* collator) const { | 406 icu::Collator* collator) const { |
| 401 // Compare on hosts first. The host won't contain 'www.'. | 407 // Compare on hosts first. The host won't contain 'www.'. |
| 402 UErrorCode compare_status = U_ZERO_ERROR; | 408 UErrorCode compare_status = U_ZERO_ERROR; |
| 403 UCollationResult host_compare_result = collator->compare( | 409 UCollationResult host_compare_result = collator->compare( |
| 404 static_cast<const UChar*>(sort_host_.c_str()), | 410 static_cast<const UChar*>(sort_host_.c_str()), |
| 405 static_cast<int>(sort_host_.length()), | 411 static_cast<int>(sort_host_.length()), |
| 406 static_cast<const UChar*>(other.sort_host_.c_str()), | 412 static_cast<const UChar*>(other.sort_host_.c_str()), |
| 407 static_cast<int>(other.sort_host_.length()), | 413 static_cast<int>(other.sort_host_.length()), |
| 408 compare_status); | 414 compare_status); |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 440 string16 SortedDisplayURL::AfterHost() const { | 446 string16 SortedDisplayURL::AfterHost() const { |
| 441 size_t slash_index = display_url_.find(sort_host_, prefix_end_); | 447 size_t slash_index = display_url_.find(sort_host_, prefix_end_); |
| 442 if (slash_index == string16::npos) { | 448 if (slash_index == string16::npos) { |
| 443 NOTREACHED(); | 449 NOTREACHED(); |
| 444 return string16(); | 450 return string16(); |
| 445 } | 451 } |
| 446 return display_url_.substr(slash_index + sort_host_.length()); | 452 return display_url_.substr(slash_index + sort_host_.length()); |
| 447 } | 453 } |
| 448 | 454 |
| 449 } // namespace gfx | 455 } // namespace gfx |
| OLD | NEW |