| OLD | NEW |
| 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" |
| 11 #include "base/logging.h" | 11 #include "base/logging.h" |
| 12 #include "base/strings/string_util.h" | 12 #include "base/strings/string_util.h" |
| 13 #include "url/gurl.h" | |
| 14 #include "url/url_canon_internal.h" | 13 #include "url/url_canon_internal.h" |
| 15 #include "url/url_constants.h" | 14 #include "url/url_constants.h" |
| 16 #include "url/url_file.h" | 15 #include "url/url_file.h" |
| 17 #include "url/url_util_internal.h" | 16 #include "url/url_util_internal.h" |
| 18 | 17 |
| 19 namespace url { | 18 namespace url { |
| 20 | 19 |
| 21 namespace { | 20 namespace { |
| 22 | 21 |
| 23 // Pass this enum through for methods which would like to know if whitespace | 22 // Pass this enum through for methods which would like to know if whitespace |
| (...skipping 614 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 638 SchemeType unused_scheme_type; | 637 SchemeType unused_scheme_type; |
| 639 return DoIsStandard(spec, scheme, &unused_scheme_type); | 638 return DoIsStandard(spec, scheme, &unused_scheme_type); |
| 640 } | 639 } |
| 641 | 640 |
| 642 bool IsReferrerScheme(const char* spec, const Component& scheme) { | 641 bool IsReferrerScheme(const char* spec, const Component& scheme) { |
| 643 Initialize(); | 642 Initialize(); |
| 644 SchemeType unused_scheme_type; | 643 SchemeType unused_scheme_type; |
| 645 return DoIsInSchemes(spec, scheme, &unused_scheme_type, *referrer_schemes); | 644 return DoIsInSchemes(spec, scheme, &unused_scheme_type, *referrer_schemes); |
| 646 } | 645 } |
| 647 | 646 |
| 648 bool IsAboutBlank(const GURL& url) { | |
| 649 if (!url.SchemeIs(url::kAboutScheme)) | |
| 650 return false; | |
| 651 | |
| 652 if (url.has_host() || url.has_username() || url.has_password() || | |
| 653 url.has_port()) { | |
| 654 return false; | |
| 655 } | |
| 656 | |
| 657 if (url.path() != kAboutBlankPath && url.path() != kAboutBlankWithHashPath) | |
| 658 return false; | |
| 659 | |
| 660 return true; | |
| 661 } | |
| 662 | |
| 663 bool FindAndCompareScheme(const char* str, | 647 bool FindAndCompareScheme(const char* str, |
| 664 int str_len, | 648 int str_len, |
| 665 const char* compare, | 649 const char* compare, |
| 666 Component* found_scheme) { | 650 Component* found_scheme) { |
| 667 return DoFindAndCompareScheme(str, str_len, compare, found_scheme); | 651 return DoFindAndCompareScheme(str, str_len, compare, found_scheme); |
| 668 } | 652 } |
| 669 | 653 |
| 670 bool FindAndCompareScheme(const base::char16* str, | 654 bool FindAndCompareScheme(const base::char16* str, |
| 671 int str_len, | 655 int str_len, |
| 672 const char* compare, | 656 const char* compare, |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 853 return DoCompareSchemeComponent(spec, component, compare_to); | 837 return DoCompareSchemeComponent(spec, component, compare_to); |
| 854 } | 838 } |
| 855 | 839 |
| 856 bool CompareSchemeComponent(const base::char16* spec, | 840 bool CompareSchemeComponent(const base::char16* spec, |
| 857 const Component& component, | 841 const Component& component, |
| 858 const char* compare_to) { | 842 const char* compare_to) { |
| 859 return DoCompareSchemeComponent(spec, component, compare_to); | 843 return DoCompareSchemeComponent(spec, component, compare_to); |
| 860 } | 844 } |
| 861 | 845 |
| 862 } // namespace url | 846 } // namespace url |
| OLD | NEW |