Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(796)

Side by Side Diff: url/url_util.cc

Issue 2403713002: Add suborigin logic to url::Origin (Closed)
Patch Set: Fix unit test Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « url/url_constants.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <stddef.h> 7 #include <stddef.h>
8 #include <string.h> 8 #include <string.h>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/debug/leak_annotations.h" 11 #include "base/debug/leak_annotations.h"
12 #include "base/logging.h" 12 #include "base/logging.h"
13 #include "base/strings/string_util.h" 13 #include "base/strings/string_util.h"
14 #include "url/url_canon_internal.h" 14 #include "url/url_canon_internal.h"
15 #include "url/url_file.h" 15 #include "url/url_file.h"
16 #include "url/url_util_internal.h" 16 #include "url/url_util_internal.h"
17 17
18 namespace url { 18 namespace url {
19 19
20 namespace { 20 namespace {
21 21
22 const int kNumStandardURLSchemes = 8; 22 const int kNumStandardURLSchemes = 10;
23 const SchemeWithType kStandardURLSchemes[kNumStandardURLSchemes] = { 23 const SchemeWithType kStandardURLSchemes[kNumStandardURLSchemes] = {
24 {kHttpScheme, SCHEME_WITH_PORT}, 24 {kHttpScheme, SCHEME_WITH_PORT},
25 {kHttpsScheme, SCHEME_WITH_PORT}, 25 {kHttpsScheme, SCHEME_WITH_PORT},
26 // Yes, file URLs can have a hostname, so file URLs should be handled as 26 // Yes, file URLs can have a hostname, so file URLs should be handled as
27 // "standard". File URLs never have a port as specified by the SchemeType 27 // "standard". File URLs never have a port as specified by the SchemeType
28 // field. 28 // field.
29 {kFileScheme, SCHEME_WITHOUT_PORT}, 29 {kFileScheme, SCHEME_WITHOUT_PORT},
30 {kFtpScheme, SCHEME_WITH_PORT}, 30 {kFtpScheme, SCHEME_WITH_PORT},
31 {kGopherScheme, SCHEME_WITH_PORT}, 31 {kGopherScheme, SCHEME_WITH_PORT},
32 {kWsScheme, SCHEME_WITH_PORT}, // WebSocket. 32 {kWsScheme, SCHEME_WITH_PORT}, // WebSocket.
33 {kWssScheme, SCHEME_WITH_PORT}, // WebSocket secure. 33 {kWssScheme, SCHEME_WITH_PORT}, // WebSocket secure.
34 {kFileSystemScheme, SCHEME_WITHOUT_AUTHORITY}, 34 {kFileSystemScheme, SCHEME_WITHOUT_AUTHORITY},
35 {kHttpSuboriginScheme, SCHEME_WITH_PORT},
36 {kHttpsSuboriginScheme, SCHEME_WITH_PORT},
35 }; 37 };
36 38
37 const int kNumReferrerURLSchemes = 2; 39 const int kNumReferrerURLSchemes = 4;
38 const SchemeWithType kReferrerURLSchemes[kNumReferrerURLSchemes] = { 40 const SchemeWithType kReferrerURLSchemes[kNumReferrerURLSchemes] = {
39 {kHttpScheme, SCHEME_WITH_PORT}, 41 {kHttpScheme, SCHEME_WITH_PORT},
40 {kHttpsScheme, SCHEME_WITH_PORT}, 42 {kHttpsScheme, SCHEME_WITH_PORT},
43 {kHttpSuboriginScheme, SCHEME_WITH_PORT},
44 {kHttpsSuboriginScheme, SCHEME_WITH_PORT},
41 }; 45 };
42 46
43 // Lists of the currently installed standard and referrer schemes. These lists 47 // Lists of the currently installed standard and referrer schemes. These lists
44 // are lazily initialized by InitStandardSchemes and InitReferrerSchemes and are 48 // are lazily initialized by InitStandardSchemes and InitReferrerSchemes and are
45 // leaked on shutdown to prevent any destructors from being called that will 49 // leaked on shutdown to prevent any destructors from being called that will
46 // slow us down or cause problems. 50 // slow us down or cause problems.
47 std::vector<SchemeWithType>* standard_schemes = nullptr; 51 std::vector<SchemeWithType>* standard_schemes = nullptr;
48 std::vector<SchemeWithType>* referrer_schemes = nullptr; 52 std::vector<SchemeWithType>* referrer_schemes = nullptr;
49 53
50 // See the LockSchemeRegistries declaration in the header. 54 // See the LockSchemeRegistries declaration in the header.
(...skipping 608 matching lines...) Expand 10 before | Expand all | Expand 10 after
659 return DoCompareSchemeComponent(spec, component, compare_to); 663 return DoCompareSchemeComponent(spec, component, compare_to);
660 } 664 }
661 665
662 bool CompareSchemeComponent(const base::char16* spec, 666 bool CompareSchemeComponent(const base::char16* spec,
663 const Component& component, 667 const Component& component,
664 const char* compare_to) { 668 const char* compare_to) {
665 return DoCompareSchemeComponent(spec, component, compare_to); 669 return DoCompareSchemeComponent(spec, component, compare_to);
666 } 670 }
667 671
668 } // namespace url 672 } // namespace url
OLDNEW
« no previous file with comments | « url/url_constants.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698