| 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 #include "app/gfx/font.h" | 5 #include "app/gfx/font.h" |
| 6 #include "app/gfx/text_elider.h" | 6 #include "app/gfx/text_elider.h" |
| 7 #include "base/file_path.h" | 7 #include "base/file_path.h" |
| 8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
| 9 #include "base/sys_string_conversions.h" | 9 #include "base/sys_string_conversions.h" |
| 10 #include "googleurl/src/gurl.h" | 10 #include "googleurl/src/gurl.h" |
| (...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 330 url_parse::Parsed parsed; | 330 url_parse::Parsed parsed; |
| 331 display_url_ = WideToUTF16Hack(net::FormatUrl(url, languages, | 331 display_url_ = WideToUTF16Hack(net::FormatUrl(url, languages, |
| 332 true, UnescapeRule::SPACES, &parsed, &prefix_end_)); | 332 true, UnescapeRule::SPACES, &parsed, &prefix_end_)); |
| 333 if (sort_host_.length() > host_minus_www.length()) { | 333 if (sort_host_.length() > host_minus_www.length()) { |
| 334 prefix_end_ += sort_host_.length() - host_minus_www.length(); | 334 prefix_end_ += sort_host_.length() - host_minus_www.length(); |
| 335 sort_host_.swap(host_minus_www); | 335 sort_host_.swap(host_minus_www); |
| 336 } | 336 } |
| 337 } | 337 } |
| 338 | 338 |
| 339 int SortedDisplayURL::Compare(const SortedDisplayURL& other, | 339 int SortedDisplayURL::Compare(const SortedDisplayURL& other, |
| 340 Collator* collator) const { | 340 icu::Collator* collator) const { |
| 341 // Compare on hosts first. The host won't contain 'www.'. | 341 // Compare on hosts first. The host won't contain 'www.'. |
| 342 UErrorCode compare_status = U_ZERO_ERROR; | 342 UErrorCode compare_status = U_ZERO_ERROR; |
| 343 UCollationResult host_compare_result = collator->compare( | 343 UCollationResult host_compare_result = collator->compare( |
| 344 static_cast<const UChar*>(sort_host_.c_str()), | 344 static_cast<const UChar*>(sort_host_.c_str()), |
| 345 static_cast<int>(sort_host_.length()), | 345 static_cast<int>(sort_host_.length()), |
| 346 static_cast<const UChar*>(other.sort_host_.c_str()), | 346 static_cast<const UChar*>(other.sort_host_.c_str()), |
| 347 static_cast<int>(other.sort_host_.length()), | 347 static_cast<int>(other.sort_host_.length()), |
| 348 compare_status); | 348 compare_status); |
| 349 DCHECK(U_SUCCESS(compare_status)); | 349 DCHECK(U_SUCCESS(compare_status)); |
| 350 if (host_compare_result != 0) | 350 if (host_compare_result != 0) |
| (...skipping 29 matching lines...) Expand all Loading... |
| 380 string16 SortedDisplayURL::AfterHost() const { | 380 string16 SortedDisplayURL::AfterHost() const { |
| 381 size_t slash_index = display_url_.find(sort_host_, prefix_end_); | 381 size_t slash_index = display_url_.find(sort_host_, prefix_end_); |
| 382 if (slash_index == string16::npos) { | 382 if (slash_index == string16::npos) { |
| 383 NOTREACHED(); | 383 NOTREACHED(); |
| 384 return string16(); | 384 return string16(); |
| 385 } | 385 } |
| 386 return display_url_.substr(slash_index + sort_host_.length()); | 386 return display_url_.substr(slash_index + sort_host_.length()); |
| 387 } | 387 } |
| 388 | 388 |
| 389 } // namespace gfx. | 389 } // namespace gfx. |
| OLD | NEW |