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

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

Issue 320253004: Componentize URLFixerUpper. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Win64 fix Created 6 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 | Annotate | Revision Log
« no previous file with comments | « components/url_fixer/url_fixer_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 #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 674 matching lines...) Expand 10 before | Expand all | Expand 10 after
685 const std::string& spec = url.possibly_invalid_spec(); 685 const std::string& spec = url.possibly_invalid_spec();
686 const url::Parsed& parsed = url.parsed_for_possibly_invalid_spec(); 686 const url::Parsed& parsed = url.parsed_for_possibly_invalid_spec();
687 687
688 // Scheme & separators. These are ASCII. 688 // Scheme & separators. These are ASCII.
689 base::string16 url_string; 689 base::string16 url_string;
690 url_string.insert( 690 url_string.insert(
691 url_string.end(), spec.begin(), 691 url_string.end(), spec.begin(),
692 spec.begin() + parsed.CountCharactersBefore(url::Parsed::USERNAME, true)); 692 spec.begin() + parsed.CountCharactersBefore(url::Parsed::USERNAME, true));
693 const char kHTTP[] = "http://"; 693 const char kHTTP[] = "http://";
694 const char kFTP[] = "ftp."; 694 const char kFTP[] = "ftp.";
695 // URLFixerUpper::FixupURL() treats "ftp.foo.com" as ftp://ftp.foo.com. This 695 // url_fixer::FixupURL() treats "ftp.foo.com" as ftp://ftp.foo.com. This
696 // means that if we trim "http://" off a URL whose host starts with "ftp." and 696 // means that if we trim "http://" off a URL whose host starts with "ftp." and
697 // the user inputs this into any field subject to fixup (which is basically 697 // the user inputs this into any field subject to fixup (which is basically
698 // all input fields), the meaning would be changed. (In fact, often the 698 // all input fields), the meaning would be changed. (In fact, often the
699 // formatted URL is directly pre-filled into an input field.) For this reason 699 // formatted URL is directly pre-filled into an input field.) For this reason
700 // we avoid stripping "http://" in this case. 700 // we avoid stripping "http://" in this case.
701 bool omit_http = (format_types & kFormatUrlOmitHTTP) && 701 bool omit_http = (format_types & kFormatUrlOmitHTTP) &&
702 EqualsASCII(url_string, kHTTP) && 702 EqualsASCII(url_string, kHTTP) &&
703 !StartsWithASCII(url.host(), kFTP, true); 703 !StartsWithASCII(url.host(), kFTP, true);
704 new_parsed->scheme = parsed.scheme; 704 new_parsed->scheme = parsed.scheme;
705 705
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
821 if (offset_for_adjustment) 821 if (offset_for_adjustment)
822 offsets.push_back(*offset_for_adjustment); 822 offsets.push_back(*offset_for_adjustment);
823 base::string16 result = FormatUrlWithOffsets(url, languages, format_types, 823 base::string16 result = FormatUrlWithOffsets(url, languages, format_types,
824 unescape_rules, new_parsed, prefix_end, &offsets); 824 unescape_rules, new_parsed, prefix_end, &offsets);
825 if (offset_for_adjustment) 825 if (offset_for_adjustment)
826 *offset_for_adjustment = offsets[0]; 826 *offset_for_adjustment = offsets[0];
827 return result; 827 return result;
828 } 828 }
829 829
830 } // namespace net 830 } // namespace net
OLDNEW
« no previous file with comments | « components/url_fixer/url_fixer_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698