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

Side by Side Diff: url/url_util.cc

Issue 2584513003: PlzNavigate: identify same-page browser-initiated navigation. (Closed)
Patch Set: Move IsFragmentAddedOrUpdated from net/ to url∕ Created 3 years, 10 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
« url/url_util.h ('K') | « url/url_util.h ('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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "url/url_util.h" 5 #include "url/url_util.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <string.h> 8 #include <string.h>
9 9
10 #include "base/debug/leak_annotations.h" 10 #include "base/debug/leak_annotations.h"
(...skipping 665 matching lines...) Expand 10 before | Expand all | Expand 10 after
676 } 676 }
677 677
678 bool HostIsIPAddress(base::StringPiece host) { 678 bool HostIsIPAddress(base::StringPiece host) {
679 url::RawCanonOutputT<char, 128> ignored_output; 679 url::RawCanonOutputT<char, 128> ignored_output;
680 url::CanonHostInfo host_info; 680 url::CanonHostInfo host_info;
681 url::CanonicalizeIPAddress(host.data(), Component(0, host.length()), 681 url::CanonicalizeIPAddress(host.data(), Component(0, host.length()),
682 &ignored_output, &host_info); 682 &ignored_output, &host_info);
683 return host_info.IsIPAddress(); 683 return host_info.IsIPAddress();
684 } 684 }
685 685
686 bool IsFragmentAddedOrUpdated(const GURL& old_url, const GURL& new_url) {
687 if (!new_url.has_ref() || old_url == new_url)
688 return false;
689
690 url::Replacements<char> replacements;
691 replacements.ClearRef();
692 return old_url.ReplaceComponents(replacements) ==
693 new_url.ReplaceComponents(replacements);
694 }
695
686 bool Canonicalize(const char* spec, 696 bool Canonicalize(const char* spec,
687 int spec_len, 697 int spec_len,
688 bool trim_path_end, 698 bool trim_path_end,
689 CharsetConverter* charset_converter, 699 CharsetConverter* charset_converter,
690 CanonOutput* output, 700 CanonOutput* output,
691 Parsed* output_parsed) { 701 Parsed* output_parsed) {
692 return DoCanonicalize(spec, spec_len, trim_path_end, REMOVE_WHITESPACE, 702 return DoCanonicalize(spec, spec_len, trim_path_end, REMOVE_WHITESPACE,
693 charset_converter, output, output_parsed); 703 charset_converter, output, output_parsed);
694 } 704 }
695 705
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
817 return DoCompareSchemeComponent(spec, component, compare_to); 827 return DoCompareSchemeComponent(spec, component, compare_to);
818 } 828 }
819 829
820 bool CompareSchemeComponent(const base::char16* spec, 830 bool CompareSchemeComponent(const base::char16* spec,
821 const Component& component, 831 const Component& component,
822 const char* compare_to) { 832 const char* compare_to) {
823 return DoCompareSchemeComponent(spec, component, compare_to); 833 return DoCompareSchemeComponent(spec, component, compare_to);
824 } 834 }
825 835
826 } // namespace url 836 } // namespace url
OLDNEW
« url/url_util.h ('K') | « url/url_util.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698