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

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

Issue 15140003: Add support for split Public Suffix List distinctions. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased again Created 7 years, 7 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
« no previous file with comments | « net/tools/tld_cleanup/tld_cleanup_util_unittest.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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 // This file implements utility functions for eliding and formatting UI text. 5 // This file implements utility functions for eliding and formatting UI text.
6 // 6 //
7 // Note that several of the functions declared in text_elider.h are implemented 7 // Note that several of the functions declared in text_elider.h are implemented
8 // in this file using helper classes in an unnamed namespace. 8 // in this file using helper classes in an unnamed namespace.
9 9
10 #include "ui/base/text/text_elider.h" 10 #include "ui/base/text/text_elider.h"
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 const string16 url_minus_query = 245 const string16 url_minus_query =
246 url_string.substr(0, path_start_index + path_len); 246 url_string.substr(0, path_start_index + path_len);
247 if (available_pixel_width >= font.GetStringWidth(url_minus_query)) 247 if (available_pixel_width >= font.GetStringWidth(url_minus_query))
248 return ElideText(url_string, font, available_pixel_width, ELIDE_AT_END); 248 return ElideText(url_string, font, available_pixel_width, ELIDE_AT_END);
249 249
250 // Get Host. 250 // Get Host.
251 string16 url_host = UTF8ToUTF16(url.host()); 251 string16 url_host = UTF8ToUTF16(url.host());
252 252
253 // Get domain and registry information from the URL. 253 // Get domain and registry information from the URL.
254 string16 url_domain = UTF8ToUTF16( 254 string16 url_domain = UTF8ToUTF16(
255 net::RegistryControlledDomainService::GetDomainAndRegistry(url)); 255 net::registry_controlled_domains::GetDomainAndRegistry(
256 url, net::registry_controlled_domains::EXCLUDE_PRIVATE_REGISTRIES));
256 if (url_domain.empty()) 257 if (url_domain.empty())
257 url_domain = url_host; 258 url_domain = url_host;
258 259
259 // Add port if required. 260 // Add port if required.
260 if (!url.port().empty()) { 261 if (!url.port().empty()) {
261 url_host += UTF8ToUTF16(":" + url.port()); 262 url_host += UTF8ToUTF16(":" + url.port());
262 url_domain += UTF8ToUTF16(":" + url.port()); 263 url_domain += UTF8ToUTF16(":" + url.port());
263 } 264 }
264 265
265 // Get sub domain. 266 // Get sub domain.
(...skipping 861 matching lines...) Expand 10 before | Expand all | Expand 10 after
1127 index = char_iterator.getIndex(); 1128 index = char_iterator.getIndex();
1128 } else { 1129 } else {
1129 // String has leading whitespace, return the elide string. 1130 // String has leading whitespace, return the elide string.
1130 return kElideString; 1131 return kElideString;
1131 } 1132 }
1132 } 1133 }
1133 return string.substr(0, index) + kElideString; 1134 return string.substr(0, index) + kElideString;
1134 } 1135 }
1135 1136
1136 } // namespace ui 1137 } // namespace ui
OLDNEW
« no previous file with comments | « net/tools/tld_cleanup/tld_cleanup_util_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698