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

Side by Side Diff: third_party/WebKit/Source/platform/weborigin/SchemeRegistry.cpp

Issue 2142513003: Use initializer_lists for static WTF::HashSets. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 months 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 | « third_party/WebKit/Source/modules/webdatabase/DatabaseAuthorizer.cpp ('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 /* 1 /*
2 * Copyright (C) 2010 Apple Inc. All Rights Reserved. 2 * Copyright (C) 2010 Apple Inc. All Rights Reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 } 58 }
59 59
60 static URLSchemesSet& displayIsolatedURLSchemes() 60 static URLSchemesSet& displayIsolatedURLSchemes()
61 { 61 {
62 DEFINE_STATIC_LOCAL_WITH_LOCK(URLSchemesSet, displayIsolatedSchemes, ()); 62 DEFINE_STATIC_LOCAL_WITH_LOCK(URLSchemesSet, displayIsolatedSchemes, ());
63 return displayIsolatedSchemes; 63 return displayIsolatedSchemes;
64 } 64 }
65 65
66 static URLSchemesSet& mixedContentRestrictingSchemes() 66 static URLSchemesSet& mixedContentRestrictingSchemes()
67 { 67 {
68 DEFINE_STATIC_LOCAL_WITH_LOCK(URLSchemesSet, mixedContentRestrictingSchemes, ()); 68 DEFINE_STATIC_LOCAL_WITH_LOCK(URLSchemesSet, mixedContentRestrictingSchemes, ({
69 69 "https",
70 if (mixedContentRestrictingSchemes.isEmpty()) 70 }));
71 mixedContentRestrictingSchemes.add("https");
72
73 return mixedContentRestrictingSchemes; 71 return mixedContentRestrictingSchemes;
74 } 72 }
75 73
76 static URLSchemesSet& secureSchemes() 74 static URLSchemesSet& secureSchemes()
77 { 75 {
78 DEFINE_STATIC_LOCAL_WITH_LOCK(URLSchemesSet, secureSchemes, ()); 76 DEFINE_STATIC_LOCAL_WITH_LOCK(URLSchemesSet, secureSchemes, ({
79 77 "https",
80 if (secureSchemes.isEmpty()) { 78 "about",
81 secureSchemes.add("https"); 79 "data",
82 secureSchemes.add("about"); 80 "wss",
83 secureSchemes.add("data"); 81 }));
84 secureSchemes.add("wss");
85 }
86
87 return secureSchemes; 82 return secureSchemes;
88 } 83 }
89 84
90 static URLSchemesSet& schemesWithUniqueOrigins() 85 static URLSchemesSet& schemesWithUniqueOrigins()
91 { 86 {
92 DEFINE_STATIC_LOCAL_WITH_LOCK(URLSchemesSet, schemesWithUniqueOrigins, ()); 87 DEFINE_STATIC_LOCAL_WITH_LOCK(URLSchemesSet, schemesWithUniqueOrigins, ({
93 88 "about",
94 if (schemesWithUniqueOrigins.isEmpty()) { 89 "javascript",
95 schemesWithUniqueOrigins.add("about");
96 schemesWithUniqueOrigins.add("javascript");
97 // This is a willful violation of HTML5. 90 // This is a willful violation of HTML5.
98 // See https://bugs.webkit.org/show_bug.cgi?id=11885 91 // See https://bugs.webkit.org/show_bug.cgi?id=11885
99 schemesWithUniqueOrigins.add("data"); 92 "data",
100 } 93 }));
101
102 return schemesWithUniqueOrigins; 94 return schemesWithUniqueOrigins;
103 } 95 }
104 96
105 static URLSchemesSet& emptyDocumentSchemes() 97 static URLSchemesSet& emptyDocumentSchemes()
106 { 98 {
107 DEFINE_STATIC_LOCAL_WITH_LOCK(URLSchemesSet, emptyDocumentSchemes, ()); 99 DEFINE_STATIC_LOCAL_WITH_LOCK(URLSchemesSet, emptyDocumentSchemes, ({
108 100 "about",
109 if (emptyDocumentSchemes.isEmpty()) 101 }));
110 emptyDocumentSchemes.add("about");
111
112 return emptyDocumentSchemes; 102 return emptyDocumentSchemes;
113 } 103 }
114 104
115 static HashSet<String>& schemesForbiddenFromDomainRelaxation() 105 static HashSet<String>& schemesForbiddenFromDomainRelaxation()
116 { 106 {
117 DEFINE_STATIC_LOCAL_WITH_LOCK(HashSet<String>, schemes, ()); 107 DEFINE_STATIC_LOCAL_WITH_LOCK(HashSet<String>, schemes, ());
118 return schemes; 108 return schemes;
119 } 109 }
120 110
121 static URLSchemesSet& notAllowingJavascriptURLsSchemes() 111 static URLSchemesSet& notAllowingJavascriptURLsSchemes()
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after
468 458
469 bool SchemeRegistry::schemeShouldBypassSecureContextCheck(const String& scheme) 459 bool SchemeRegistry::schemeShouldBypassSecureContextCheck(const String& scheme)
470 { 460 {
471 if (scheme.isEmpty()) 461 if (scheme.isEmpty())
472 return false; 462 return false;
473 MutexLocker locker(mutex()); 463 MutexLocker locker(mutex());
474 return secureContextBypassingSchemes().contains(scheme.lower()); 464 return secureContextBypassingSchemes().contains(scheme.lower());
475 } 465 }
476 466
477 } // namespace blink 467 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/modules/webdatabase/DatabaseAuthorizer.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698