OLD | NEW |
1 // Copyright (c) 2009 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> |
11 #include <unicode/ulocdata.h> | 11 #include <unicode/ulocdata.h> |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 #include "base/string_tokenizer.h" | 46 #include "base/string_tokenizer.h" |
47 #include "base/string_util.h" | 47 #include "base/string_util.h" |
48 #include "base/sys_string_conversions.h" | 48 #include "base/sys_string_conversions.h" |
49 #include "base/time.h" | 49 #include "base/time.h" |
50 #include "base/utf_offset_string_conversions.h" | 50 #include "base/utf_offset_string_conversions.h" |
51 #include "base/utf_string_conversions.h" | 51 #include "base/utf_string_conversions.h" |
52 #include "grit/net_resources.h" | 52 #include "grit/net_resources.h" |
53 #include "googleurl/src/gurl.h" | 53 #include "googleurl/src/gurl.h" |
54 #include "googleurl/src/url_canon.h" | 54 #include "googleurl/src/url_canon.h" |
55 #include "googleurl/src/url_parse.h" | 55 #include "googleurl/src/url_parse.h" |
| 56 #include "net/base/dns_util.h" |
56 #include "net/base/escape.h" | 57 #include "net/base/escape.h" |
57 #include "net/base/net_module.h" | 58 #include "net/base/net_module.h" |
58 #if defined(OS_WIN) | 59 #if defined(OS_WIN) |
59 #include "net/base/winsock_init.h" | 60 #include "net/base/winsock_init.h" |
60 #endif | 61 #endif |
61 #include "unicode/datefmt.h" | 62 #include "unicode/datefmt.h" |
62 | 63 |
63 | 64 |
64 using base::Time; | 65 using base::Time; |
65 | 66 |
(...skipping 1213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1279 std::wstring* username, | 1280 std::wstring* username, |
1280 std::wstring* password) { | 1281 std::wstring* password) { |
1281 UnescapeRule::Type flags = | 1282 UnescapeRule::Type flags = |
1282 UnescapeRule::SPACES | UnescapeRule::URL_SPECIAL_CHARS; | 1283 UnescapeRule::SPACES | UnescapeRule::URL_SPECIAL_CHARS; |
1283 *username = UTF16ToWideHack(UnescapeAndDecodeUTF8URLComponent(url.username(), | 1284 *username = UTF16ToWideHack(UnescapeAndDecodeUTF8URLComponent(url.username(), |
1284 flags, NULL)); | 1285 flags, NULL)); |
1285 *password = UTF16ToWideHack(UnescapeAndDecodeUTF8URLComponent(url.password(), | 1286 *password = UTF16ToWideHack(UnescapeAndDecodeUTF8URLComponent(url.password(), |
1286 flags, NULL)); | 1287 flags, NULL)); |
1287 } | 1288 } |
1288 | 1289 |
| 1290 std::string GetHostOrSpecFromURL(const GURL& url) { |
| 1291 return url.has_host() ? net::TrimEndingDot(url.host()) : url.spec(); |
| 1292 } |
| 1293 |
1289 void AppendFormattedHost(const GURL& url, | 1294 void AppendFormattedHost(const GURL& url, |
1290 const std::wstring& languages, | 1295 const std::wstring& languages, |
1291 std::wstring* output, | 1296 std::wstring* output, |
1292 url_parse::Parsed* new_parsed, | 1297 url_parse::Parsed* new_parsed, |
1293 size_t* offset_for_adjustment) { | 1298 size_t* offset_for_adjustment) { |
1294 DCHECK(output); | 1299 DCHECK(output); |
1295 const url_parse::Component& host = | 1300 const url_parse::Component& host = |
1296 url.parsed_for_possibly_invalid_spec().host; | 1301 url.parsed_for_possibly_invalid_spec().host; |
1297 | 1302 |
1298 if (host.is_nonempty()) { | 1303 if (host.is_nonempty()) { |
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1681 | 1686 |
1682 IPv6SupportResults(IPV6_GLOBAL_ADDRESS_MISSING); | 1687 IPv6SupportResults(IPV6_GLOBAL_ADDRESS_MISSING); |
1683 return false; | 1688 return false; |
1684 #else | 1689 #else |
1685 NOTIMPLEMENTED(); | 1690 NOTIMPLEMENTED(); |
1686 return true; | 1691 return true; |
1687 #endif // defined(various platforms) | 1692 #endif // defined(various platforms) |
1688 } | 1693 } |
1689 | 1694 |
1690 } // namespace net | 1695 } // namespace net |
OLD | NEW |