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

Side by Side Diff: components/url_formatter/url_formatter.cc

Issue 2478573004: Convert GURL::{host,path} to GURL::{host_piece,path_piece} for ==. (Closed)
Patch Set: rebase to #431874 Created 4 years, 1 month 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "components/url_formatter/url_formatter.h" 5 #include "components/url_formatter/url_formatter.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/lazy_instance.h" 10 #include "base/lazy_instance.h"
(...skipping 760 matching lines...) Expand 10 before | Expand all | Expand 10 after
771 AdjustAllComponentsButScheme(delta, new_parsed); 771 AdjustAllComponentsButScheme(delta, new_parsed);
772 } 772 }
773 773
774 return url_string; 774 return url_string;
775 } 775 }
776 776
777 bool CanStripTrailingSlash(const GURL& url) { 777 bool CanStripTrailingSlash(const GURL& url) {
778 // Omit the path only for standard, non-file URLs with nothing but "/" after 778 // Omit the path only for standard, non-file URLs with nothing but "/" after
779 // the hostname. 779 // the hostname.
780 return url.IsStandard() && !url.SchemeIsFile() && !url.SchemeIsFileSystem() && 780 return url.IsStandard() && !url.SchemeIsFile() && !url.SchemeIsFileSystem() &&
781 !url.has_query() && !url.has_ref() && url.path() == "/"; 781 !url.has_query() && !url.has_ref() && url.path_piece() == "/";
782 } 782 }
783 783
784 void AppendFormattedHost(const GURL& url, base::string16* output) { 784 void AppendFormattedHost(const GURL& url, base::string16* output) {
785 AppendFormattedComponent( 785 AppendFormattedComponent(
786 url.possibly_invalid_spec(), url.parsed_for_possibly_invalid_spec().host, 786 url.possibly_invalid_spec(), url.parsed_for_possibly_invalid_spec().host,
787 HostComponentTransform(), output, NULL, NULL); 787 HostComponentTransform(), output, NULL, NULL);
788 } 788 }
789 789
790 base::string16 IDNToUnicode(base::StringPiece host) { 790 base::string16 IDNToUnicode(base::StringPiece host) {
791 return IDNToUnicodeWithAdjustments(host, nullptr); 791 return IDNToUnicodeWithAdjustments(host, nullptr);
792 } 792 }
793 793
794 base::string16 StripWWW(const base::string16& text) { 794 base::string16 StripWWW(const base::string16& text) {
795 const base::string16 www(base::ASCIIToUTF16("www.")); 795 const base::string16 www(base::ASCIIToUTF16("www."));
796 return base::StartsWith(text, www, base::CompareCase::SENSITIVE) 796 return base::StartsWith(text, www, base::CompareCase::SENSITIVE)
797 ? text.substr(www.length()) : text; 797 ? text.substr(www.length()) : text;
798 } 798 }
799 799
800 base::string16 StripWWWFromHost(const GURL& url) { 800 base::string16 StripWWWFromHost(const GURL& url) {
801 DCHECK(url.is_valid()); 801 DCHECK(url.is_valid());
802 return StripWWW(base::ASCIIToUTF16(url.host_piece())); 802 return StripWWW(base::ASCIIToUTF16(url.host_piece()));
803 } 803 }
804 804
805 } // namespace url_formatter 805 } // namespace url_formatter
OLDNEW
« no previous file with comments | « components/sessions/content/content_serialized_navigation_driver.cc ('k') | content/browser/appcache/appcache_quota_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698