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 <string.h> | 7 #include <string.h> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 17 matching lines...) Expand all Loading... |
28 inline bool DoLowerCaseEqualsASCII(Iter a_begin, Iter a_end, const char* b) { | 28 inline bool DoLowerCaseEqualsASCII(Iter a_begin, Iter a_end, const char* b) { |
29 for (Iter it = a_begin; it != a_end; ++it, ++b) { | 29 for (Iter it = a_begin; it != a_end; ++it, ++b) { |
30 if (!*b || ToLowerASCII(*it) != *b) | 30 if (!*b || ToLowerASCII(*it) != *b) |
31 return false; | 31 return false; |
32 } | 32 } |
33 return *b == 0; | 33 return *b == 0; |
34 } | 34 } |
35 | 35 |
36 const int kNumStandardURLSchemes = 8; | 36 const int kNumStandardURLSchemes = 8; |
37 const char* kStandardURLSchemes[kNumStandardURLSchemes] = { | 37 const char* kStandardURLSchemes[kNumStandardURLSchemes] = { |
38 "http", | 38 kHttpScheme, |
39 "https", | 39 kHttpsScheme, |
40 kFileScheme, // Yes, file urls can have a hostname! | 40 kFileScheme, // Yes, file urls can have a hostname! |
41 "ftp", | 41 kFtpScheme, |
42 "gopher", | 42 kGopherScheme, |
43 "ws", // WebSocket. | 43 kWsScheme, // WebSocket. |
44 "wss", // WebSocket secure. | 44 kWssScheme, // WebSocket secure. |
45 kFileSystemScheme, | 45 kFileSystemScheme, |
46 }; | 46 }; |
47 | 47 |
48 // List of the currently installed standard schemes. This list is lazily | 48 // List of the currently installed standard schemes. This list is lazily |
49 // initialized by InitStandardSchemes and is leaked on shutdown to prevent | 49 // initialized by InitStandardSchemes and is leaked on shutdown to prevent |
50 // any destructors from being called that will slow us down or cause problems. | 50 // any destructors from being called that will slow us down or cause problems. |
51 std::vector<const char*>* standard_schemes = NULL; | 51 std::vector<const char*>* standard_schemes = NULL; |
52 | 52 |
53 // See the LockStandardSchemes declaration in the header. | 53 // See the LockStandardSchemes declaration in the header. |
54 bool standard_schemes_locked = false; | 54 bool standard_schemes_locked = false; |
(...skipping 519 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
574 return DoCompareSchemeComponent(spec, component, compare_to); | 574 return DoCompareSchemeComponent(spec, component, compare_to); |
575 } | 575 } |
576 | 576 |
577 bool CompareSchemeComponent(const base::char16* spec, | 577 bool CompareSchemeComponent(const base::char16* spec, |
578 const Component& component, | 578 const Component& component, |
579 const char* compare_to) { | 579 const char* compare_to) { |
580 return DoCompareSchemeComponent(spec, component, compare_to); | 580 return DoCompareSchemeComponent(spec, component, compare_to); |
581 } | 581 } |
582 | 582 |
583 } // namespace url | 583 } // namespace url |
OLD | NEW |