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

Side by Side Diff: net/base/net_util_icu.cc

Issue 1176583003: Move EqualsASCII to the base namespace. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@string_util2
Patch Set: Created 5 years, 6 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
« no previous file with comments | « content/test/mock_webclipboard_impl.cc ('k') | net/ftp/ftp_directory_listing_parser_os2.cc » ('j') | 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 #include "net/base/net_util.h" 5 #include "net/base/net_util.h"
6 6
7 #include <map> 7 #include <map>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/i18n/time_formatting.h" 10 #include "base/i18n/time_formatting.h"
(...skipping 686 matching lines...) Expand 10 before | Expand all | Expand 10 after
697 spec.begin() + parsed.CountCharactersBefore(url::Parsed::USERNAME, true)); 697 spec.begin() + parsed.CountCharactersBefore(url::Parsed::USERNAME, true));
698 const char kHTTP[] = "http://"; 698 const char kHTTP[] = "http://";
699 const char kFTP[] = "ftp."; 699 const char kFTP[] = "ftp.";
700 // url_fixer::FixupURL() treats "ftp.foo.com" as ftp://ftp.foo.com. This 700 // url_fixer::FixupURL() treats "ftp.foo.com" as ftp://ftp.foo.com. This
701 // means that if we trim "http://" off a URL whose host starts with "ftp." and 701 // means that if we trim "http://" off a URL whose host starts with "ftp." and
702 // the user inputs this into any field subject to fixup (which is basically 702 // the user inputs this into any field subject to fixup (which is basically
703 // all input fields), the meaning would be changed. (In fact, often the 703 // all input fields), the meaning would be changed. (In fact, often the
704 // formatted URL is directly pre-filled into an input field.) For this reason 704 // formatted URL is directly pre-filled into an input field.) For this reason
705 // we avoid stripping "http://" in this case. 705 // we avoid stripping "http://" in this case.
706 bool omit_http = (format_types & kFormatUrlOmitHTTP) && 706 bool omit_http = (format_types & kFormatUrlOmitHTTP) &&
707 EqualsASCII(url_string, kHTTP) && 707 base::EqualsASCII(url_string, kHTTP) &&
708 !StartsWithASCII(url.host(), kFTP, true); 708 !StartsWithASCII(url.host(), kFTP, true);
709 new_parsed->scheme = parsed.scheme; 709 new_parsed->scheme = parsed.scheme;
710 710
711 // Username & password. 711 // Username & password.
712 if ((format_types & kFormatUrlOmitUsernamePassword) != 0) { 712 if ((format_types & kFormatUrlOmitUsernamePassword) != 0) {
713 // Remove the username and password fields. We don't want to display those 713 // Remove the username and password fields. We don't want to display those
714 // to the user since they can be used for attacks, 714 // to the user since they can be used for attacks,
715 // e.g. "http://google.com:search@evil.ru/" 715 // e.g. "http://google.com:search@evil.ru/"
716 new_parsed->username.reset(); 716 new_parsed->username.reset();
717 new_parsed->password.reset(); 717 new_parsed->password.reset();
718 // Update the adjustments based on removed username and/or password. 718 // Update the adjustments based on removed username and/or password.
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
826 if (offset_for_adjustment) 826 if (offset_for_adjustment)
827 offsets.push_back(*offset_for_adjustment); 827 offsets.push_back(*offset_for_adjustment);
828 base::string16 result = FormatUrlWithOffsets(url, languages, format_types, 828 base::string16 result = FormatUrlWithOffsets(url, languages, format_types,
829 unescape_rules, new_parsed, prefix_end, &offsets); 829 unescape_rules, new_parsed, prefix_end, &offsets);
830 if (offset_for_adjustment) 830 if (offset_for_adjustment)
831 *offset_for_adjustment = offsets[0]; 831 *offset_for_adjustment = offsets[0];
832 return result; 832 return result;
833 } 833 }
834 834
835 } // namespace net 835 } // namespace net
OLDNEW
« no previous file with comments | « content/test/mock_webclipboard_impl.cc ('k') | net/ftp/ftp_directory_listing_parser_os2.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698