OLD | NEW |
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 652 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
663 DCHECK(adjustments != NULL); | 663 DCHECK(adjustments != NULL); |
664 adjustments->clear(); | 664 adjustments->clear(); |
665 url::Parsed parsed_temp; | 665 url::Parsed parsed_temp; |
666 if (!new_parsed) | 666 if (!new_parsed) |
667 new_parsed = &parsed_temp; | 667 new_parsed = &parsed_temp; |
668 else | 668 else |
669 *new_parsed = url::Parsed(); | 669 *new_parsed = url::Parsed(); |
670 | 670 |
671 // Special handling for view-source:. Don't use content::kViewSourceScheme | 671 // Special handling for view-source:. Don't use content::kViewSourceScheme |
672 // because this library shouldn't depend on chrome. | 672 // because this library shouldn't depend on chrome. |
673 const char* const kViewSource = "view-source"; | 673 const char kViewSource[] = "view-source"; |
674 // Reject "view-source:view-source:..." to avoid deep recursion. | 674 // Reject "view-source:view-source:..." to avoid deep recursion. |
675 const char* const kViewSourceTwice = "view-source:view-source:"; | 675 const char kViewSourceTwice[] = "view-source:view-source:"; |
676 if (url.SchemeIs(kViewSource) && | 676 if (url.SchemeIs(kViewSource) && |
677 !StartsWithASCII(url.possibly_invalid_spec(), kViewSourceTwice, false)) { | 677 !StartsWithASCII(url.possibly_invalid_spec(), kViewSourceTwice, false)) { |
678 return FormatViewSourceUrl(url, languages, format_types, | 678 return FormatViewSourceUrl(url, languages, format_types, |
679 unescape_rules, new_parsed, prefix_end, | 679 unescape_rules, new_parsed, prefix_end, |
680 adjustments); | 680 adjustments); |
681 } | 681 } |
682 | 682 |
683 // We handle both valid and invalid URLs (this will give us the spec | 683 // We handle both valid and invalid URLs (this will give us the spec |
684 // regardless of validity). | 684 // regardless of validity). |
685 const std::string& spec = url.possibly_invalid_spec(); | 685 const std::string& spec = url.possibly_invalid_spec(); |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 |
OLD | NEW |