| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google 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 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 { | 61 { |
| 62 DEFINE_STATIC_LOCAL(OriginSet, trustworthyOriginSet, ()); | 62 DEFINE_STATIC_LOCAL(OriginSet, trustworthyOriginSet, ()); |
| 63 return trustworthyOriginSet; | 63 return trustworthyOriginSet; |
| 64 } | 64 } |
| 65 | 65 |
| 66 static bool referrerPolicyFromStringImpl(const String& policy, ReferrerPolicyLeg
acyKeywordsSupport legacyKeywordsSupport, ReferrerPolicy* result) | 66 static bool referrerPolicyFromStringImpl(const String& policy, ReferrerPolicyLeg
acyKeywordsSupport legacyKeywordsSupport, ReferrerPolicy* result) |
| 67 { | 67 { |
| 68 DCHECK(!policy.isNull()); | 68 DCHECK(!policy.isNull()); |
| 69 bool supportLegacyKeywords = (legacyKeywordsSupport == SupportReferrerPolicy
LegacyKeywords); | 69 bool supportLegacyKeywords = (legacyKeywordsSupport == SupportReferrerPolicy
LegacyKeywords); |
| 70 | 70 |
| 71 if (equalIgnoringCase(policy, "no-referrer") || (supportLegacyKeywords && eq
ualIgnoringCase(policy, "never"))) { | 71 if (equalIgnoringASCIICase(policy, "no-referrer") || (supportLegacyKeywords
&& equalIgnoringASCIICase(policy, "never"))) { |
| 72 *result = ReferrerPolicyNever; | 72 *result = ReferrerPolicyNever; |
| 73 return true; | 73 return true; |
| 74 } | 74 } |
| 75 if (equalIgnoringCase(policy, "unsafe-url") || (supportLegacyKeywords && equ
alIgnoringCase(policy, "always"))) { | 75 if (equalIgnoringASCIICase(policy, "unsafe-url") || (supportLegacyKeywords &
& equalIgnoringASCIICase(policy, "always"))) { |
| 76 *result = ReferrerPolicyAlways; | 76 *result = ReferrerPolicyAlways; |
| 77 return true; | 77 return true; |
| 78 } | 78 } |
| 79 if (equalIgnoringCase(policy, "origin")) { | 79 if (equalIgnoringASCIICase(policy, "origin")) { |
| 80 *result = ReferrerPolicyOrigin; | 80 *result = ReferrerPolicyOrigin; |
| 81 return true; | 81 return true; |
| 82 } | 82 } |
| 83 if (equalIgnoringCase(policy, "origin-when-cross-origin") || (supportLegacyK
eywords && equalIgnoringCase(policy, "origin-when-crossorigin"))) { | 83 if (equalIgnoringASCIICase(policy, "origin-when-cross-origin") || (supportLe
gacyKeywords && equalIgnoringASCIICase(policy, "origin-when-crossorigin"))) { |
| 84 *result = ReferrerPolicyOriginWhenCrossOrigin; | 84 *result = ReferrerPolicyOriginWhenCrossOrigin; |
| 85 return true; | 85 return true; |
| 86 } | 86 } |
| 87 if (equalIgnoringCase(policy, "no-referrer-when-downgrade") || (supportLegac
yKeywords && equalIgnoringCase(policy, "default"))) { | 87 if (equalIgnoringASCIICase(policy, "no-referrer-when-downgrade") || (support
LegacyKeywords && equalIgnoringASCIICase(policy, "default"))) { |
| 88 *result = ReferrerPolicyNoReferrerWhenDowngrade; | 88 *result = ReferrerPolicyNoReferrerWhenDowngrade; |
| 89 return true; | 89 return true; |
| 90 } | 90 } |
| 91 return false; | 91 return false; |
| 92 } | 92 } |
| 93 | 93 |
| 94 void SecurityPolicy::init() | 94 void SecurityPolicy::init() |
| 95 { | 95 { |
| 96 originAccessMap(); | 96 originAccessMap(); |
| 97 trustworthyOriginSet(); | 97 trustworthyOriginSet(); |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 260 { | 260 { |
| 261 return referrerPolicyFromStringImpl(policy, DoNotSupportReferrerPolicyLegacy
Keywords, result); | 261 return referrerPolicyFromStringImpl(policy, DoNotSupportReferrerPolicyLegacy
Keywords, result); |
| 262 } | 262 } |
| 263 | 263 |
| 264 bool SecurityPolicy::referrerPolicyFromStringWithLegacyKeywords(const String& po
licy, ReferrerPolicy* result) | 264 bool SecurityPolicy::referrerPolicyFromStringWithLegacyKeywords(const String& po
licy, ReferrerPolicy* result) |
| 265 { | 265 { |
| 266 return referrerPolicyFromStringImpl(policy, SupportReferrerPolicyLegacyKeywo
rds, result); | 266 return referrerPolicyFromStringImpl(policy, SupportReferrerPolicyLegacyKeywo
rds, result); |
| 267 } | 267 } |
| 268 | 268 |
| 269 } // namespace blink | 269 } // namespace blink |
| OLD | NEW |