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 <algorithm> | 7 #include <algorithm> |
8 #include <iterator> | 8 #include <iterator> |
9 #include <map> | 9 #include <map> |
10 | 10 |
(...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
477 } | 477 } |
478 return false; | 478 return false; |
479 } | 479 } |
480 | 480 |
481 void SetExemplarSetForLang(const std::string& lang, | 481 void SetExemplarSetForLang(const std::string& lang, |
482 icu::UnicodeSet* lang_set) { | 482 icu::UnicodeSet* lang_set) { |
483 LangToExemplarSetMap& map = LangToExemplarSet::GetInstance()->map; | 483 LangToExemplarSetMap& map = LangToExemplarSet::GetInstance()->map; |
484 map.insert(std::make_pair(lang, lang_set)); | 484 map.insert(std::make_pair(lang, lang_set)); |
485 } | 485 } |
486 | 486 |
487 static base::LazyInstance<base::Lock, | 487 static base::LazyInstance<base::Lock>::Leaky |
488 base::LeakyLazyInstanceTraits<base::Lock> > | |
489 g_lang_set_lock = LAZY_INSTANCE_INITIALIZER; | 488 g_lang_set_lock = LAZY_INSTANCE_INITIALIZER; |
490 | 489 |
491 // Returns true if all the characters in component_characters are used by | 490 // Returns true if all the characters in component_characters are used by |
492 // the language |lang|. | 491 // the language |lang|. |
493 bool IsComponentCoveredByLang(const icu::UnicodeSet& component_characters, | 492 bool IsComponentCoveredByLang(const icu::UnicodeSet& component_characters, |
494 const std::string& lang) { | 493 const std::string& lang) { |
495 CR_DEFINE_STATIC_LOCAL( | 494 CR_DEFINE_STATIC_LOCAL( |
496 const icu::UnicodeSet, kASCIILetters, ('a', 'z')); | 495 const icu::UnicodeSet, kASCIILetters, ('a', 'z')); |
497 icu::UnicodeSet* lang_set; | 496 icu::UnicodeSet* lang_set; |
498 // We're called from both the UI thread and the history thread. | 497 // We're called from both the UI thread and the history thread. |
(...skipping 604 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1103 | 1102 |
1104 } // namespace | 1103 } // namespace |
1105 | 1104 |
1106 const FormatUrlType kFormatUrlOmitNothing = 0; | 1105 const FormatUrlType kFormatUrlOmitNothing = 0; |
1107 const FormatUrlType kFormatUrlOmitUsernamePassword = 1 << 0; | 1106 const FormatUrlType kFormatUrlOmitUsernamePassword = 1 << 0; |
1108 const FormatUrlType kFormatUrlOmitHTTP = 1 << 1; | 1107 const FormatUrlType kFormatUrlOmitHTTP = 1 << 1; |
1109 const FormatUrlType kFormatUrlOmitTrailingSlashOnBareHostname = 1 << 2; | 1108 const FormatUrlType kFormatUrlOmitTrailingSlashOnBareHostname = 1 << 2; |
1110 const FormatUrlType kFormatUrlOmitAll = kFormatUrlOmitUsernamePassword | | 1109 const FormatUrlType kFormatUrlOmitAll = kFormatUrlOmitUsernamePassword | |
1111 kFormatUrlOmitHTTP | kFormatUrlOmitTrailingSlashOnBareHostname; | 1110 kFormatUrlOmitHTTP | kFormatUrlOmitTrailingSlashOnBareHostname; |
1112 | 1111 |
1113 static base::LazyInstance<std::multiset<int>, | 1112 static base::LazyInstance<std::multiset<int> >::Leaky |
1114 base::LeakyLazyInstanceTraits<std::multiset<int> > > | |
1115 g_explicitly_allowed_ports = LAZY_INSTANCE_INITIALIZER; | 1113 g_explicitly_allowed_ports = LAZY_INSTANCE_INITIALIZER; |
1116 | 1114 |
1117 size_t GetCountOfExplicitlyAllowedPorts() { | 1115 size_t GetCountOfExplicitlyAllowedPorts() { |
1118 return g_explicitly_allowed_ports.Get().size(); | 1116 return g_explicitly_allowed_ports.Get().size(); |
1119 } | 1117 } |
1120 | 1118 |
1121 GURL FilePathToFileURL(const FilePath& path) { | 1119 GURL FilePathToFileURL(const FilePath& path) { |
1122 // Produce a URL like "file:///C:/foo" for a regular file, or | 1120 // Produce a URL like "file:///C:/foo" for a regular file, or |
1123 // "file://///server/path" for UNC. The URL canonicalizer will fix up the | 1121 // "file://///server/path" for UNC. The URL canonicalizer will fix up the |
1124 // latter case to be the canonical UNC form: "file://server/path" | 1122 // latter case to be the canonical UNC form: "file://server/path" |
(...skipping 1333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2458 | 2456 |
2459 NetworkInterface::NetworkInterface(const std::string& name, | 2457 NetworkInterface::NetworkInterface(const std::string& name, |
2460 const IPAddressNumber& address) | 2458 const IPAddressNumber& address) |
2461 : name(name), address(address) { | 2459 : name(name), address(address) { |
2462 } | 2460 } |
2463 | 2461 |
2464 NetworkInterface::~NetworkInterface() { | 2462 NetworkInterface::~NetworkInterface() { |
2465 } | 2463 } |
2466 | 2464 |
2467 } // namespace net | 2465 } // namespace net |
OLD | NEW |