| OLD | NEW |
| 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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 localSchemes.add("file"); | 53 localSchemes.add("file"); |
| 54 | 54 |
| 55 return localSchemes; | 55 return localSchemes; |
| 56 } | 56 } |
| 57 | 57 |
| 58 static URLSchemesSet& displayIsolatedURLSchemes() { | 58 static URLSchemesSet& displayIsolatedURLSchemes() { |
| 59 DEFINE_STATIC_LOCAL_WITH_LOCK(URLSchemesSet, displayIsolatedSchemes, ()); | 59 DEFINE_STATIC_LOCAL_WITH_LOCK(URLSchemesSet, displayIsolatedSchemes, ()); |
| 60 return displayIsolatedSchemes; | 60 return displayIsolatedSchemes; |
| 61 } | 61 } |
| 62 | 62 |
| 63 static URLSchemesSet& mixedContentRestrictingSchemes() { | |
| 64 DEFINE_STATIC_LOCAL_WITH_LOCK(URLSchemesSet, mixedContentRestrictingSchemes, | |
| 65 ({ | |
| 66 "https", | |
| 67 })); | |
| 68 return mixedContentRestrictingSchemes; | |
| 69 } | |
| 70 | |
| 71 static URLSchemesSet& secureSchemes() { | 63 static URLSchemesSet& secureSchemes() { |
| 72 DEFINE_STATIC_LOCAL_WITH_LOCK(URLSchemesSet, secureSchemes, | 64 DEFINE_STATIC_LOCAL_WITH_LOCK(URLSchemesSet, secureSchemes, |
| 73 ({ | 65 ({ |
| 74 "https", "about", "data", "wss", | 66 "https", "about", "data", "wss", |
| 75 })); | 67 })); |
| 76 return secureSchemes; | 68 return secureSchemes; |
| 77 } | 69 } |
| 78 | 70 |
| 79 static URLSchemesSet& schemesWithUniqueOrigins() { | 71 static URLSchemesSet& schemesWithUniqueOrigins() { |
| 80 DEFINE_STATIC_LOCAL_WITH_LOCK(URLSchemesSet, schemesWithUniqueOrigins, | 72 DEFINE_STATIC_LOCAL_WITH_LOCK(URLSchemesSet, schemesWithUniqueOrigins, |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 | 208 |
| 217 bool SchemeRegistry::shouldTreatURLSchemeAsDisplayIsolated( | 209 bool SchemeRegistry::shouldTreatURLSchemeAsDisplayIsolated( |
| 218 const String& scheme) { | 210 const String& scheme) { |
| 219 DCHECK_EQ(scheme, scheme.lower()); | 211 DCHECK_EQ(scheme, scheme.lower()); |
| 220 if (scheme.isEmpty()) | 212 if (scheme.isEmpty()) |
| 221 return false; | 213 return false; |
| 222 MutexLocker locker(mutex()); | 214 MutexLocker locker(mutex()); |
| 223 return displayIsolatedURLSchemes().contains(scheme); | 215 return displayIsolatedURLSchemes().contains(scheme); |
| 224 } | 216 } |
| 225 | 217 |
| 226 void SchemeRegistry::registerURLSchemeAsRestrictingMixedContent( | |
| 227 const String& scheme) { | |
| 228 DCHECK_EQ(scheme, scheme.lower()); | |
| 229 MutexLocker locker(mutex()); | |
| 230 mixedContentRestrictingSchemes().add(scheme); | |
| 231 } | |
| 232 | |
| 233 bool SchemeRegistry::shouldTreatURLSchemeAsRestrictingMixedContent( | 218 bool SchemeRegistry::shouldTreatURLSchemeAsRestrictingMixedContent( |
| 234 const String& scheme) { | 219 const String& scheme) { |
| 235 DCHECK_EQ(scheme, scheme.lower()); | 220 DCHECK_EQ(scheme, scheme.lower()); |
| 236 if (scheme.isEmpty()) | 221 return scheme == "https"; |
| 237 return false; | |
| 238 MutexLocker locker(mutex()); | |
| 239 return mixedContentRestrictingSchemes().contains(scheme); | |
| 240 } | 222 } |
| 241 | 223 |
| 242 void SchemeRegistry::registerURLSchemeAsSecure(const String& scheme) { | 224 void SchemeRegistry::registerURLSchemeAsSecure(const String& scheme) { |
| 243 DCHECK_EQ(scheme, scheme.lower()); | 225 DCHECK_EQ(scheme, scheme.lower()); |
| 244 MutexLocker locker(mutex()); | 226 MutexLocker locker(mutex()); |
| 245 secureSchemes().add(scheme); | 227 secureSchemes().add(scheme); |
| 246 } | 228 } |
| 247 | 229 |
| 248 bool SchemeRegistry::shouldTreatURLSchemeAsSecure(const String& scheme) { | 230 bool SchemeRegistry::shouldTreatURLSchemeAsSecure(const String& scheme) { |
| 249 DCHECK_EQ(scheme, scheme.lower()); | 231 DCHECK_EQ(scheme, scheme.lower()); |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 462 | 444 |
| 463 bool SchemeRegistry::schemeShouldBypassSecureContextCheck( | 445 bool SchemeRegistry::schemeShouldBypassSecureContextCheck( |
| 464 const String& scheme) { | 446 const String& scheme) { |
| 465 if (scheme.isEmpty()) | 447 if (scheme.isEmpty()) |
| 466 return false; | 448 return false; |
| 467 MutexLocker locker(mutex()); | 449 MutexLocker locker(mutex()); |
| 468 return secureContextBypassingSchemes().contains(scheme.lower()); | 450 return secureContextBypassingSchemes().contains(scheme.lower()); |
| 469 } | 451 } |
| 470 | 452 |
| 471 } // namespace blink | 453 } // namespace blink |
| OLD | NEW |