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 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 if (list->isEmpty()) | 203 if (list->isEmpty()) |
204 map.remove(it); | 204 map.remove(it); |
205 } | 205 } |
206 | 206 |
207 void SecurityPolicy::resetOriginAccessWhitelists() | 207 void SecurityPolicy::resetOriginAccessWhitelists() |
208 { | 208 { |
209 ASSERT(isMainThread()); | 209 ASSERT(isMainThread()); |
210 originAccessMap().clear(); | 210 originAccessMap().clear(); |
211 } | 211 } |
212 | 212 |
| 213 bool SecurityPolicy::referrerPolicyFromString(const String& policy, ReferrerPoli
cy* result) |
| 214 { |
| 215 ASSERT(!policy.isNull()); |
| 216 |
| 217 if (equalIgnoringCase(policy, "no-referrer") || equalIgnoringCase(policy, "n
ever")) { |
| 218 *result = ReferrerPolicyNever; |
| 219 return true; |
| 220 } |
| 221 if (equalIgnoringCase(policy, "unsafe-url") || equalIgnoringCase(policy, "al
ways")) { |
| 222 *result = ReferrerPolicyAlways; |
| 223 return true; |
| 224 } |
| 225 if (equalIgnoringCase(policy, "origin")) { |
| 226 *result = ReferrerPolicyOrigin; |
| 227 return true; |
| 228 } |
| 229 if (equalIgnoringCase(policy, "origin-when-cross-origin") || equalIgnoringCa
se(policy, "origin-when-crossorigin")) { |
| 230 *result = ReferrerPolicyOriginWhenCrossOrigin; |
| 231 return true; |
| 232 } |
| 233 if (equalIgnoringCase(policy, "no-referrer-when-downgrade") || equalIgnoring
Case(policy, "default")) { |
| 234 *result = ReferrerPolicyNoReferrerWhenDowngrade; |
| 235 return true; |
| 236 } |
| 237 return false; |
| 238 } |
| 239 |
213 } // namespace blink | 240 } // namespace blink |
OLD | NEW |