OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 <algorithm> | 7 #include <algorithm> |
8 #include <map> | 8 #include <map> |
9 #include <unicode/ucnv.h> | 9 #include <unicode/ucnv.h> |
10 #include <unicode/uidna.h> | 10 #include <unicode/uidna.h> |
(...skipping 722 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
733 const std::wstring& languages, | 733 const std::wstring& languages, |
734 net::FormatUrlTypes format_types, | 734 net::FormatUrlTypes format_types, |
735 UnescapeRule::Type unescape_rules, | 735 UnescapeRule::Type unescape_rules, |
736 url_parse::Parsed* new_parsed, | 736 url_parse::Parsed* new_parsed, |
737 size_t* prefix_end, | 737 size_t* prefix_end, |
738 size_t* offset_for_adjustment) { | 738 size_t* offset_for_adjustment) { |
739 DCHECK(new_parsed); | 739 DCHECK(new_parsed); |
740 const wchar_t* const kWideViewSource = L"view-source:"; | 740 const wchar_t* const kWideViewSource = L"view-source:"; |
741 const size_t kViewSourceLengthPlus1 = 12; | 741 const size_t kViewSourceLengthPlus1 = 12; |
742 | 742 |
| 743 // 'view-source' requires http, so don't strip it. |
| 744 format_types &= ~net::kFormatUrlOmitHTTP; |
743 GURL real_url(url.possibly_invalid_spec().substr(kViewSourceLengthPlus1)); | 745 GURL real_url(url.possibly_invalid_spec().substr(kViewSourceLengthPlus1)); |
744 size_t temp_offset = (*offset_for_adjustment == std::wstring::npos) ? | 746 size_t temp_offset = (*offset_for_adjustment == std::wstring::npos) ? |
745 std::wstring::npos : (*offset_for_adjustment - kViewSourceLengthPlus1); | 747 std::wstring::npos : (*offset_for_adjustment - kViewSourceLengthPlus1); |
746 size_t* temp_offset_ptr = (*offset_for_adjustment < kViewSourceLengthPlus1) ? | 748 size_t* temp_offset_ptr = (*offset_for_adjustment < kViewSourceLengthPlus1) ? |
747 NULL : &temp_offset; | 749 NULL : &temp_offset; |
748 std::wstring result = net::FormatUrl(real_url, languages, | 750 std::wstring result = net::FormatUrl(real_url, languages, |
749 format_types, unescape_rules, new_parsed, prefix_end, temp_offset_ptr); | 751 format_types, unescape_rules, new_parsed, prefix_end, temp_offset_ptr); |
750 result.insert(0, kWideViewSource); | 752 result.insert(0, kWideViewSource); |
751 | 753 |
752 // Adjust position values. | 754 // Adjust position values. |
(...skipping 984 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1737 | 1739 |
1738 IPv6SupportResults(IPV6_GLOBAL_ADDRESS_MISSING); | 1740 IPv6SupportResults(IPV6_GLOBAL_ADDRESS_MISSING); |
1739 return false; | 1741 return false; |
1740 #else | 1742 #else |
1741 NOTIMPLEMENTED(); | 1743 NOTIMPLEMENTED(); |
1742 return true; | 1744 return true; |
1743 #endif // defined(various platforms) | 1745 #endif // defined(various platforms) |
1744 } | 1746 } |
1745 | 1747 |
1746 } // namespace net | 1748 } // namespace net |
OLD | NEW |