Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(162)

Side by Side Diff: ui/base/text/text_elider.cc

Issue 6898026: Eliminate wstring from base/utf_offset_string_conversions.h, net/base/escape.h, and net/base/net_... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« net/base/net_util_unittest.cc ('K') | « net/base/sdch_manager.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« net/base/net_util_unittest.cc ('K') | « net/base/sdch_manager.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698